-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcp-node.js
14 lines (14 loc) · 358 KB
/
cp-node.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
* Minified version of SqueakJS VM (incl. CodeParadise adaptations and plugins)
* SqueakJS VM: Copyright (c) 2013-2020 Vanessa Freudenberg
* CodeParadise: https://github.com/ErikOnBike/CodeParadise
*/
"use strict";var require$$0$4=require("os"),require$$0$3=require("fs"),require$$2$1=require("process"),require$$1$1=require("path"),require$$0$2=require("events"),require$$1=require("https"),require$$2=require("http"),require$$3=require("net"),require$$4=require("tls"),require$$0$1=require("crypto"),require$$6=require("url"),require$$0=require("stream"),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},node_app={},permessageDeflate,hasRequiredPermessageDeflate,constants,hasRequiredConstants;function requirePermessageDeflate(){return hasRequiredPermessageDeflate?permessageDeflate:(hasRequiredPermessageDeflate=1,permessageDeflate={extensionName:"PerMessageDeflate"})}function requireConstants(){return hasRequiredConstants?constants:(hasRequiredConstants=1,constants={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),EMPTY_BUFFER:Buffer.alloc(0),NOOP:()=>{}})}var bufferUtil={exports:{}},hasRequiredBufferUtil;function requireBufferUtil(){if(hasRequiredBufferUtil)return bufferUtil.exports;hasRequiredBufferUtil=1;const{EMPTY_BUFFER}=requireConstants();function concat(list,totalLength){if(0===list.length)return EMPTY_BUFFER;if(1===list.length)return list[0];const target=Buffer.allocUnsafe(totalLength);let offset=0;for(let i=0;i<list.length;i++){const buf=list[i];target.set(buf,offset),offset+=buf.length}return target}function _mask(source,mask,output,offset,length){for(let i=0;i<length;i++)output[offset+i]=source[i]^mask[3&i]}function _unmask(buffer,mask){const length=buffer.length;for(let i=0;i<length;i++)buffer[i]^=mask[3&i]}function toArrayBuffer(buf){return buf.byteLength===buf.buffer.byteLength?buf.buffer:buf.buffer.slice(buf.byteOffset,buf.byteOffset+buf.byteLength)}function toBuffer(data){if(toBuffer.readOnly=!0,Buffer.isBuffer(data))return data;let buf;return data instanceof ArrayBuffer?buf=Buffer.from(data):ArrayBuffer.isView(data)?buf=function(view){const buf=Buffer.from(view.buffer);if(view.byteLength!==view.buffer.byteLength)return buf.slice(view.byteOffset,view.byteOffset+view.byteLength);return buf}(data):(buf=Buffer.from(data),toBuffer.readOnly=!1),buf}try{const bufferUtil$1=require("bufferutil"),bu=bufferUtil$1.BufferUtil||bufferUtil$1;bufferUtil.exports={concat,mask(source,mask,output,offset,length){length<48?_mask(source,mask,output,offset,length):bu.mask(source,mask,output,offset,length)},toArrayBuffer,toBuffer,unmask(buffer,mask){buffer.length<32?_unmask(buffer,mask):bu.unmask(buffer,mask)}}}catch(e){bufferUtil.exports={concat,mask:_mask,toArrayBuffer,toBuffer,unmask:_unmask}}return bufferUtil.exports}var validation={},hasRequiredValidation,receiver,hasRequiredReceiver,sender,hasRequiredSender,eventTarget,hasRequiredEventTarget,extension,hasRequiredExtension,websocket,hasRequiredWebsocket,WebSocket_1,hasRequiredWebSocket;function requireValidation(){if(hasRequiredValidation)return validation;hasRequiredValidation=1;try{const isValidUTF8=require("utf-8-validate");validation.isValidUTF8="object"==typeof isValidUTF8?isValidUTF8.Validation.isValidUTF8:isValidUTF8}catch(e){validation.isValidUTF8=()=>!0}return validation.isValidStatusCode=code=>code>=1e3&&code<=1013&&1004!==code&&1005!==code&&1006!==code||code>=3e3&&code<=4999,validation}function requireReceiver(){if(hasRequiredReceiver)return receiver;hasRequiredReceiver=1;const{Writable}=require$$0,PerMessageDeflate=requirePermessageDeflate(),{BINARY_TYPES,EMPTY_BUFFER,kStatusCode,kWebSocket}=requireConstants(),{concat,toArrayBuffer,unmask}=requireBufferUtil(),{isValidStatusCode,isValidUTF8}=requireValidation();function error(ErrorCtor,message,prefix,statusCode){const err=new ErrorCtor(prefix?`Invalid WebSocket frame: ${message}`:message);return Error.captureStackTrace(err,error),err[kStatusCode]=statusCode,err}return receiver=class Receiver extends Writable{constructor(binaryType,extensions,maxPayload){super(),this._binaryType=binaryType||BINARY_TYPES[0],this[kWebSocket]=void 0,this._extensions=extensions||{},this._maxPayload=0|maxPayload,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(chunk,encoding,cb){if(8===this._opcode&&0==this._state)return cb();this._bufferedBytes+=chunk.length,this._buffers.push(chunk),this.startLoop(cb)}consume(n){if(this._bufferedBytes-=n,n===this._buffers[0].length)return this._buffers.shift();if(n<this._buffers[0].length){const buf=this._buffers[0];return this._buffers[0]=buf.slice(n),buf.slice(0,n)}const dst=Buffer.allocUnsafe(n);do{const buf=this._buffers[0],offset=dst.length-n;n>=buf.length?dst.set(this._buffers.shift(),offset):(dst.set(new Uint8Array(buf.buffer,buf.byteOffset,n),offset),this._buffers[0]=buf.slice(n)),n-=buf.length}while(n>0);return dst}startLoop(cb){let err;this._loop=!0;do{switch(this._state){case 0:err=this.getInfo();break;case 1:err=this.getPayloadLength16();break;case 2:err=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:err=this.getData(cb);break;default:return void(this._loop=!1)}}while(this._loop);cb(err)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const buf=this.consume(2);if(0!=(48&buf[0]))return this._loop=!1,error(RangeError,"RSV2 and RSV3 must be clear",!0,1002);const compressed=64==(64&buf[0]);if(compressed&&!this._extensions[PerMessageDeflate.extensionName])return this._loop=!1,error(RangeError,"RSV1 must be clear",!0,1002);if(this._fin=128==(128&buf[0]),this._opcode=15&buf[0],this._payloadLength=127&buf[1],0===this._opcode){if(compressed)return this._loop=!1,error(RangeError,"RSV1 must be clear",!0,1002);if(!this._fragmented)return this._loop=!1,error(RangeError,"invalid opcode 0",!0,1002);this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,error(RangeError,`invalid opcode ${this._opcode}`,!0,1002);this._compressed=compressed}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,error(RangeError,`invalid opcode ${this._opcode}`,!0,1002);if(!this._fin)return this._loop=!1,error(RangeError,"FIN must be set",!0,1002);if(compressed)return this._loop=!1,error(RangeError,"RSV1 must be clear",!0,1002);if(this._payloadLength>125)return this._loop=!1,error(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002)}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&buf[1]),126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const buf=this.consume(8),num=buf.readUInt32BE(0);return num>Math.pow(2,21)-1?(this._loop=!1,error(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009)):(this._payloadLength=num*Math.pow(2,32)+buf.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,error(RangeError,"Max payload size exceeded",!1,1009);this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(cb){let data=EMPTY_BUFFER;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);data=this.consume(this._payloadLength),this._masked&&unmask(data,this._mask)}return this._opcode>7?this.controlMessage(data):this._compressed?(this._state=5,void this.decompress(data,cb)):(data.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(data)),this.dataMessage())}decompress(data,cb){this._extensions[PerMessageDeflate.extensionName].decompress(data,this._fin,((err,buf)=>{if(err)return cb(err);if(buf.length){if(this._messageLength+=buf.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return cb(error(RangeError,"Max payload size exceeded",!1,1009));this._fragments.push(buf)}const er=this.dataMessage();if(er)return cb(er);this.startLoop(cb)}))}dataMessage(){if(this._fin){const messageLength=this._messageLength,fragments=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let data;data="nodebuffer"===this._binaryType?concat(fragments,messageLength):"arraybuffer"===this._binaryType?toArrayBuffer(concat(fragments,messageLength)):fragments,this.emit("message",data)}else{const buf=concat(fragments,messageLength);if(!isValidUTF8(buf))return this._loop=!1,error(Error,"invalid UTF-8 sequence",!0,1007);this.emit("message",buf.toString())}}this._state=0}controlMessage(data){if(8===this._opcode)if(this._loop=!1,0===data.length)this.emit("conclude",1005,""),this.end();else{if(1===data.length)return error(RangeError,"invalid payload length 1",!0,1002);{const code=data.readUInt16BE(0);if(!isValidStatusCode(code))return error(RangeError,`invalid status code ${code}`,!0,1002);const buf=data.slice(2);if(!isValidUTF8(buf))return error(Error,"invalid UTF-8 sequence",!0,1007);this.emit("conclude",code,buf.toString()),this.end()}}else 9===this._opcode?this.emit("ping",data):this.emit("pong",data);this._state=0}}}function requireSender(){if(hasRequiredSender)return sender;hasRequiredSender=1;const{randomFillSync}=require$$0$1,PerMessageDeflate=requirePermessageDeflate(),{EMPTY_BUFFER}=requireConstants(),{isValidStatusCode}=requireValidation(),{mask:applyMask,toBuffer}=requireBufferUtil(),mask=Buffer.alloc(4);class Sender{constructor(socket,extensions){this._extensions=extensions||{},this._socket=socket,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(data,options){const merge=options.mask&&options.readOnly;let offset=options.mask?6:2,payloadLength=data.length;data.length>=65536?(offset+=8,payloadLength=127):data.length>125&&(offset+=2,payloadLength=126);const target=Buffer.allocUnsafe(merge?data.length+offset:offset);return target[0]=options.fin?128|options.opcode:options.opcode,options.rsv1&&(target[0]|=64),target[1]=payloadLength,126===payloadLength?target.writeUInt16BE(data.length,2):127===payloadLength&&(target.writeUInt32BE(0,2),target.writeUInt32BE(data.length,6)),options.mask?(randomFillSync(mask,0,4),target[1]|=128,target[offset-4]=mask[0],target[offset-3]=mask[1],target[offset-2]=mask[2],target[offset-1]=mask[3],merge?(applyMask(data,mask,target,offset,data.length),[target]):(applyMask(data,mask,data,0,data.length),[target,data])):[target,data]}close(code,data,mask,cb){let buf;if(void 0===code)buf=EMPTY_BUFFER;else{if("number"!=typeof code||!isValidStatusCode(code))throw new TypeError("First argument must be a valid error code number");void 0===data||""===data?(buf=Buffer.allocUnsafe(2),buf.writeUInt16BE(code,0)):(buf=Buffer.allocUnsafe(2+Buffer.byteLength(data)),buf.writeUInt16BE(code,0),buf.write(data,2))}this._deflating?this.enqueue([this.doClose,buf,mask,cb]):this.doClose(buf,mask,cb)}doClose(data,mask,cb){this.sendFrame(Sender.frame(data,{fin:!0,rsv1:!1,opcode:8,mask,readOnly:!1}),cb)}ping(data,mask,cb){const buf=toBuffer(data);this._deflating?this.enqueue([this.doPing,buf,mask,toBuffer.readOnly,cb]):this.doPing(buf,mask,toBuffer.readOnly,cb)}doPing(data,mask,readOnly,cb){this.sendFrame(Sender.frame(data,{fin:!0,rsv1:!1,opcode:9,mask,readOnly}),cb)}pong(data,mask,cb){const buf=toBuffer(data);this._deflating?this.enqueue([this.doPong,buf,mask,toBuffer.readOnly,cb]):this.doPong(buf,mask,toBuffer.readOnly,cb)}doPong(data,mask,readOnly,cb){this.sendFrame(Sender.frame(data,{fin:!0,rsv1:!1,opcode:10,mask,readOnly}),cb)}send(data,options,cb){const buf=toBuffer(data),perMessageDeflate=this._extensions[PerMessageDeflate.extensionName];let opcode=options.binary?2:1,rsv1=options.compress;if(this._firstFragment?(this._firstFragment=!1,rsv1&&perMessageDeflate&&(rsv1=buf.length>=perMessageDeflate._threshold),this._compress=rsv1):(rsv1=!1,opcode=0),options.fin&&(this._firstFragment=!0),perMessageDeflate){const opts={fin:options.fin,rsv1,opcode,mask:options.mask,readOnly:toBuffer.readOnly};this._deflating?this.enqueue([this.dispatch,buf,this._compress,opts,cb]):this.dispatch(buf,this._compress,opts,cb)}else this.sendFrame(Sender.frame(buf,{fin:options.fin,rsv1:!1,opcode,mask:options.mask,readOnly:toBuffer.readOnly}),cb)}dispatch(data,compress,options,cb){if(!compress)return void this.sendFrame(Sender.frame(data,options),cb);const perMessageDeflate=this._extensions[PerMessageDeflate.extensionName];this._deflating=!0,perMessageDeflate.compress(data,options.fin,((_,buf)=>{this._deflating=!1,options.readOnly=!1,this.sendFrame(Sender.frame(buf,options),cb),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const params=this._queue.shift();this._bufferedBytes-=params[1].length,Reflect.apply(params[0],this,params.slice(1))}}enqueue(params){this._bufferedBytes+=params[1].length,this._queue.push(params)}sendFrame(list,cb){2===list.length?(this._socket.cork(),this._socket.write(list[0]),this._socket.write(list[1],cb),this._socket.uncork()):this._socket.write(list[0],cb)}}return sender=Sender}function requireEventTarget(){if(hasRequiredEventTarget)return eventTarget;hasRequiredEventTarget=1;class Event{constructor(type,target){this.target=target,this.type=type}}class MessageEvent extends Event{constructor(data,target){super("message",target),this.data=data}}class CloseEvent extends Event{constructor(code,reason,target){super("close",target),this.wasClean=target._closeFrameReceived&&target._closeFrameSent,this.reason=reason,this.code=code}}class OpenEvent extends Event{constructor(target){super("open",target)}}class ErrorEvent extends Event{constructor(error,target){super("error",target),this.message=error.message,this.error=error}}return eventTarget={addEventListener(method,listener){function onMessage(data){listener.call(this,new MessageEvent(data,this))}function onClose(code,message){listener.call(this,new CloseEvent(code,message,this))}function onError(error){listener.call(this,new ErrorEvent(error,this))}function onOpen(){listener.call(this,new OpenEvent(this))}"function"==typeof listener&&("message"===method?(onMessage._listener=listener,this.on(method,onMessage)):"close"===method?(onClose._listener=listener,this.on(method,onClose)):"error"===method?(onError._listener=listener,this.on(method,onError)):"open"===method?(onOpen._listener=listener,this.on(method,onOpen)):this.on(method,listener))},removeEventListener(method,listener){const listeners=this.listeners(method);for(let i=0;i<listeners.length;i++)listeners[i]!==listener&&listeners[i]._listener!==listener||this.removeListener(method,listeners[i])}}}function requireExtension(){if(hasRequiredExtension)return extension;hasRequiredExtension=1;const tokenChars=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function push(dest,name,elem){void 0===dest[name]?dest[name]=[elem]:dest[name].push(elem)}return extension={format:function(extensions){return Object.keys(extensions).map((extension=>{let configurations=extensions[extension];return Array.isArray(configurations)||(configurations=[configurations]),configurations.map((params=>[extension].concat(Object.keys(params).map((k=>{let values=params[k];return Array.isArray(values)||(values=[values]),values.map((v=>!0===v?k:`${k}=${v}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(header){const offers=Object.create(null);if(void 0===header||""===header)return offers;let extensionName,paramName,params=Object.create(null),mustUnescape=!1,isEscaping=!1,inQuotes=!1,start=-1,end=-1,i=0;for(;i<header.length;i++){const code=header.charCodeAt(i);if(void 0===extensionName)if(-1===end&&1===tokenChars[code])-1===start&&(start=i);else if(32===code||9===code)-1===end&&-1!==start&&(end=i);else{if(59!==code&&44!==code)throw new SyntaxError(`Unexpected character at index ${i}`);{if(-1===start)throw new SyntaxError(`Unexpected character at index ${i}`);-1===end&&(end=i);const name=header.slice(start,end);44===code?(push(offers,name,params),params=Object.create(null)):extensionName=name,start=end=-1}}else if(void 0===paramName)if(-1===end&&1===tokenChars[code])-1===start&&(start=i);else if(32===code||9===code)-1===end&&-1!==start&&(end=i);else if(59===code||44===code){if(-1===start)throw new SyntaxError(`Unexpected character at index ${i}`);-1===end&&(end=i),push(params,header.slice(start,end),!0),44===code&&(push(offers,extensionName,params),params=Object.create(null),extensionName=void 0),start=end=-1}else{if(61!==code||-1===start||-1!==end)throw new SyntaxError(`Unexpected character at index ${i}`);paramName=header.slice(start,i),start=end=-1}else if(isEscaping){if(1!==tokenChars[code])throw new SyntaxError(`Unexpected character at index ${i}`);-1===start?start=i:mustUnescape||(mustUnescape=!0),isEscaping=!1}else if(inQuotes)if(1===tokenChars[code])-1===start&&(start=i);else if(34===code&&-1!==start)inQuotes=!1,end=i;else{if(92!==code)throw new SyntaxError(`Unexpected character at index ${i}`);isEscaping=!0}else if(34===code&&61===header.charCodeAt(i-1))inQuotes=!0;else if(-1===end&&1===tokenChars[code])-1===start&&(start=i);else if(-1===start||32!==code&&9!==code){if(59!==code&&44!==code)throw new SyntaxError(`Unexpected character at index ${i}`);{if(-1===start)throw new SyntaxError(`Unexpected character at index ${i}`);-1===end&&(end=i);let value=header.slice(start,end);mustUnescape&&(value=value.replace(/\\/g,""),mustUnescape=!1),push(params,paramName,value),44===code&&(push(offers,extensionName,params),params=Object.create(null),extensionName=void 0),paramName=void 0,start=end=-1}}else-1===end&&(end=i)}if(-1===start||inQuotes)throw new SyntaxError("Unexpected end of input");-1===end&&(end=i);const token=header.slice(start,end);return void 0===extensionName?push(offers,token,params):(void 0===paramName?push(params,token,!0):push(params,paramName,mustUnescape?token.replace(/\\/g,""):token),push(offers,extensionName,params)),offers}}}function requireWebsocket(){if(hasRequiredWebsocket)return websocket;hasRequiredWebsocket=1;const EventEmitter=require$$0$2,https=require$$1,http=require$$2,net=require$$3,tls=require$$4,{randomBytes,createHash}=require$$0$1,{URL}=require$$6,PerMessageDeflate=requirePermessageDeflate(),Receiver=requireReceiver(),Sender=requireSender(),{BINARY_TYPES,EMPTY_BUFFER,GUID,kStatusCode,kWebSocket,NOOP}=requireConstants(),{addEventListener,removeEventListener}=requireEventTarget(),{format,parse}=requireExtension(),{toBuffer}=requireBufferUtil(),readyStates=["CONNECTING","OPEN","CLOSING","CLOSED"],protocolVersions=[8,13];class WebSocket extends EventEmitter{constructor(address,protocols,options){super(),this.readyState=WebSocket.CONNECTING,this.protocol="",this._binaryType=BINARY_TYPES[0],this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage="",this._closeTimer=null,this._closeCode=1006,this._extensions={},this._receiver=null,this._sender=null,this._socket=null,null!==address?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,Array.isArray(protocols)?protocols=protocols.join(", "):"object"==typeof protocols&&null!==protocols&&(options=protocols,protocols=void 0),initAsClient(this,address,protocols,options)):this._isServer=!0}get CONNECTING(){return WebSocket.CONNECTING}get CLOSING(){return WebSocket.CLOSING}get CLOSED(){return WebSocket.CLOSED}get OPEN(){return WebSocket.OPEN}get binaryType(){return this._binaryType}set binaryType(type){BINARY_TYPES.includes(type)&&(this._binaryType=type,this._receiver&&(this._receiver._binaryType=type))}get bufferedAmount(){return this._socket?(this._socket.bufferSize||0)+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}setSocket(socket,head,maxPayload){const receiver=new Receiver(this._binaryType,this._extensions,maxPayload);this._sender=new Sender(socket,this._extensions),this._receiver=receiver,this._socket=socket,receiver[kWebSocket]=this,socket[kWebSocket]=this,receiver.on("conclude",receiverOnConclude),receiver.on("drain",receiverOnDrain),receiver.on("error",receiverOnError),receiver.on("message",receiverOnMessage),receiver.on("ping",receiverOnPing),receiver.on("pong",receiverOnPong),socket.setTimeout(0),socket.setNoDelay(),head.length>0&&socket.unshift(head),socket.on("close",socketOnClose),socket.on("data",socketOnData),socket.on("end",socketOnEnd),socket.on("error",socketOnError),this.readyState=WebSocket.OPEN,this.emit("open")}emitClose(){this.readyState=WebSocket.CLOSED,this._socket?(this._extensions[PerMessageDeflate.extensionName]&&this._extensions[PerMessageDeflate.extensionName].cleanup(),this._receiver.removeAllListeners(),this.emit("close",this._closeCode,this._closeMessage)):this.emit("close",this._closeCode,this._closeMessage)}close(code,data){if(this.readyState!==WebSocket.CLOSED){if(this.readyState===WebSocket.CONNECTING){const msg="WebSocket was closed before the connection was established";return abortHandshake(this,this._req,msg)}this.readyState!==WebSocket.CLOSING?(this.readyState=WebSocket.CLOSING,this._sender.close(code,data,!this._isServer,(err=>{err||(this._closeFrameSent=!0,this._closeFrameReceived&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&this._closeFrameReceived&&this._socket.end()}}ping(data,mask,cb){if(this.readyState===WebSocket.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof data?(cb=data,data=mask=void 0):"function"==typeof mask&&(cb=mask,mask=void 0),"number"==typeof data&&(data=data.toString()),this.readyState===WebSocket.OPEN?(void 0===mask&&(mask=!this._isServer),this._sender.ping(data||EMPTY_BUFFER,mask,cb)):sendAfterClose(this,data,cb)}pong(data,mask,cb){if(this.readyState===WebSocket.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof data?(cb=data,data=mask=void 0):"function"==typeof mask&&(cb=mask,mask=void 0),"number"==typeof data&&(data=data.toString()),this.readyState===WebSocket.OPEN?(void 0===mask&&(mask=!this._isServer),this._sender.pong(data||EMPTY_BUFFER,mask,cb)):sendAfterClose(this,data,cb)}send(data,options,cb){if(this.readyState===WebSocket.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof options&&(cb=options,options={}),"number"==typeof data&&(data=data.toString()),this.readyState!==WebSocket.OPEN)return void sendAfterClose(this,data,cb);const opts={binary:"string"!=typeof data,mask:!this._isServer,compress:!0,fin:!0,...options};this._extensions[PerMessageDeflate.extensionName]||(opts.compress=!1),this._sender.send(data||EMPTY_BUFFER,opts,cb)}terminate(){if(this.readyState!==WebSocket.CLOSED){if(this.readyState===WebSocket.CONNECTING){const msg="WebSocket was closed before the connection was established";return abortHandshake(this,this._req,msg)}this._socket&&(this.readyState=WebSocket.CLOSING,this._socket.destroy())}}}function initAsClient(websocket,address,protocols,options){const opts={protocolVersion:protocolVersions[1],maxPayload:104857600,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...options,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,auth:void 0,host:void 0,path:void 0,port:void 0};if(!protocolVersions.includes(opts.protocolVersion))throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`);let parsedUrl;address instanceof URL?(parsedUrl=address,websocket.url=address.href):(parsedUrl=new URL(address),websocket.url=address);const isUnixSocket="ws+unix:"===parsedUrl.protocol;if(!(parsedUrl.host||isUnixSocket&&parsedUrl.pathname))throw new Error(`Invalid URL: ${websocket.url}`);const isSecure="wss:"===parsedUrl.protocol||"https:"===parsedUrl.protocol,defaultPort=isSecure?443:80,key=randomBytes(16).toString("base64"),get=isSecure?https.get:http.get;let perMessageDeflate;if(opts.createConnection=isSecure?tlsConnect:netConnect,opts.defaultPort=opts.defaultPort||defaultPort,opts.port=parsedUrl.port||defaultPort,opts.host=parsedUrl.hostname.startsWith("[")?parsedUrl.hostname.slice(1,-1):parsedUrl.hostname,opts.headers={"Sec-WebSocket-Version":opts.protocolVersion,"Sec-WebSocket-Key":key,Connection:"Upgrade",Upgrade:"websocket",...opts.headers},opts.path=parsedUrl.pathname+parsedUrl.search,opts.timeout=opts.handshakeTimeout,opts.perMessageDeflate&&(perMessageDeflate=new PerMessageDeflate(!0!==opts.perMessageDeflate?opts.perMessageDeflate:{},!1,opts.maxPayload),opts.headers["Sec-WebSocket-Extensions"]=format({[PerMessageDeflate.extensionName]:perMessageDeflate.offer()})),protocols&&(opts.headers["Sec-WebSocket-Protocol"]=protocols),opts.origin&&(opts.protocolVersion<13?opts.headers["Sec-WebSocket-Origin"]=opts.origin:opts.headers.Origin=opts.origin),(parsedUrl.username||parsedUrl.password)&&(opts.auth=`${parsedUrl.username}:${parsedUrl.password}`),isUnixSocket){const parts=opts.path.split(":");opts.socketPath=parts[0],opts.path=parts[1]}let req=websocket._req=get(opts);opts.timeout&&req.on("timeout",(()=>{abortHandshake(websocket,req,"Opening handshake has timed out")})),req.on("error",(err=>{websocket._req.aborted||(req=websocket._req=null,websocket.readyState=WebSocket.CLOSING,websocket.emit("error",err),websocket.emitClose())})),req.on("response",(res=>{const location=res.headers.location,statusCode=res.statusCode;if(location&&opts.followRedirects&&statusCode>=300&&statusCode<400){if(++websocket._redirects>opts.maxRedirects)return void abortHandshake(websocket,req,"Maximum redirects exceeded");req.abort();const addr=new URL(location,address);initAsClient(websocket,addr,protocols,options)}else websocket.emit("unexpected-response",req,res)||abortHandshake(websocket,req,`Unexpected server response: ${res.statusCode}`)})),req.on("upgrade",((res,socket,head)=>{if(websocket.emit("upgrade",res),websocket.readyState!==WebSocket.CONNECTING)return;req=websocket._req=null;const digest=createHash("sha1").update(key+GUID).digest("base64");if(res.headers["sec-websocket-accept"]!==digest)return void abortHandshake(websocket,socket,"Invalid Sec-WebSocket-Accept header");const serverProt=res.headers["sec-websocket-protocol"],protList=(protocols||"").split(/, */);let protError;if(!protocols&&serverProt?protError="Server sent a subprotocol but none was requested":protocols&&!serverProt?protError="Server sent no subprotocol":serverProt&&!protList.includes(serverProt)&&(protError="Server sent an invalid subprotocol"),protError)abortHandshake(websocket,socket,protError);else{if(serverProt&&(websocket.protocol=serverProt),perMessageDeflate)try{const extensions=parse(res.headers["sec-websocket-extensions"]);extensions[PerMessageDeflate.extensionName]&&(perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]),websocket._extensions[PerMessageDeflate.extensionName]=perMessageDeflate)}catch(err){return void abortHandshake(websocket,socket,"Invalid Sec-WebSocket-Extensions header")}websocket.setSocket(socket,head,opts.maxPayload)}}))}function netConnect(options){return options.path=options.socketPath,net.connect(options)}function tlsConnect(options){return options.path=void 0,options.servername||""===options.servername||(options.servername=options.host),tls.connect(options)}function abortHandshake(websocket,stream,message){websocket.readyState=WebSocket.CLOSING;const err=new Error(message);Error.captureStackTrace(err,abortHandshake),stream.setHeader?(stream.abort(),stream.once("abort",websocket.emitClose.bind(websocket)),websocket.emit("error",err)):(stream.destroy(err),stream.once("error",websocket.emit.bind(websocket,"error")),stream.once("close",websocket.emitClose.bind(websocket)))}function sendAfterClose(websocket,data,cb){if(data){const length=toBuffer(data).length;websocket._socket?websocket._sender._bufferedBytes+=length:websocket._bufferedAmount+=length}if(cb){cb(new Error(`WebSocket is not open: readyState ${websocket.readyState} (${readyStates[websocket.readyState]})`))}}function receiverOnConclude(code,reason){const websocket=this[kWebSocket];websocket._socket.removeListener("data",socketOnData),websocket._socket.resume(),websocket._closeFrameReceived=!0,websocket._closeMessage=reason,websocket._closeCode=code,1005===code?websocket.close():websocket.close(code,reason)}function receiverOnDrain(){this[kWebSocket]._socket.resume()}function receiverOnError(err){const websocket=this[kWebSocket];websocket._socket.removeListener("data",socketOnData),websocket.readyState=WebSocket.CLOSING,websocket._closeCode=err[kStatusCode],websocket.emit("error",err),websocket._socket.destroy()}function receiverOnFinish(){this[kWebSocket].emitClose()}function receiverOnMessage(data){this[kWebSocket].emit("message",data)}function receiverOnPing(data){const websocket=this[kWebSocket];websocket.pong(data,!websocket._isServer,NOOP),websocket.emit("ping",data)}function receiverOnPong(data){this[kWebSocket].emit("pong",data)}function socketOnClose(){const websocket=this[kWebSocket];this.removeListener("close",socketOnClose),this.removeListener("end",socketOnEnd),websocket.readyState=WebSocket.CLOSING,websocket._socket.read(),websocket._receiver.end(),this.removeListener("data",socketOnData),this[kWebSocket]=void 0,clearTimeout(websocket._closeTimer),websocket._receiver._writableState.finished||websocket._receiver._writableState.errorEmitted?websocket.emitClose():(websocket._receiver.on("error",receiverOnFinish),websocket._receiver.on("finish",receiverOnFinish))}function socketOnData(chunk){this[kWebSocket]._receiver.write(chunk)||this.pause()}function socketOnEnd(){const websocket=this[kWebSocket];websocket.readyState=WebSocket.CLOSING,websocket._receiver.end(),this.end()}function socketOnError(){const websocket=this[kWebSocket];this.removeListener("error",socketOnError),this.on("error",NOOP),websocket&&(websocket.readyState=WebSocket.CLOSING,this.destroy())}return readyStates.forEach(((readyState,i)=>{WebSocket[readyState]=i})),["open","error","close","message"].forEach((method=>{Object.defineProperty(WebSocket.prototype,`on${method}`,{get(){const listeners=this.listeners(method);for(let i=0;i<listeners.length;i++)if(listeners[i]._listener)return listeners[i]._listener},set(listener){const listeners=this.listeners(method);for(let i=0;i<listeners.length;i++)listeners[i]._listener&&this.removeListener(method,listeners[i]);this.addEventListener(method,listener)}})})),WebSocket.prototype.addEventListener=addEventListener,WebSocket.prototype.removeEventListener=removeEventListener,websocket=WebSocket}function requireWebSocket(){if(hasRequiredWebSocket)return WebSocket_1;hasRequiredWebSocket=1;var WebSocket=requireWebsocket();return WebSocket_1=class SafeWebSocketClient extends WebSocket{constructor(url,protocols){super(url,protocols,{perMessageDeflate:!1})}}}var sha1={exports:{}},hasRequiredSha1;
/*
* [js-sha1]{@link https://github.com/emn178/js-sha1}
*
* @version 0.6.0
* @author Chen, Yi-Cyuan [[email protected]]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*/function requireSha1(){return hasRequiredSha1||(hasRequiredSha1=1,function(module){(function(){var root="object"==typeof window?window:{},NODE_JS=!root.JS_SHA1_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS&&(root=commonjsGlobal);var COMMON_JS=!root.JS_SHA1_NO_COMMON_JS&&module.exports,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[],createOutputMethod=function(outputType){return function(message){return new Sha1(!0).update(message)[outputType]()}},createMethod=function(){var method=createOutputMethod("hex");NODE_JS&&(method=nodeWrap(method)),method.create=function(){return new Sha1},method.update=function(message){return method.create().update(message)};for(var i=0;i<OUTPUT_TYPES.length;++i){var type=OUTPUT_TYPES[i];method[type]=createOutputMethod(type)}return method},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(message){if("string"==typeof message)return crypto.createHash("sha1").update(message,"utf8").digest("hex");if(message.constructor===ArrayBuffer)message=new Uint8Array(message);else if(void 0===message.length)return method(message);return crypto.createHash("sha1").update(new Buffer(message)).digest("hex")};return nodeMethod};function Sha1(sharedMemory){sharedMemory?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Sha1.prototype.update=function(message){if(!this.finalized){var notString="string"!=typeof message;notString&&message.constructor===root.ArrayBuffer&&(message=new Uint8Array(message));for(var code,i,index=0,length=message.length||0,blocks=this.blocks;index<length;){if(this.hashed&&(this.hashed=!1,blocks[0]=this.block,blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0),notString)for(i=this.start;index<length&&i<64;++index)blocks[i>>2]|=message[index]<<SHIFT[3&i++];else for(i=this.start;index<length&&i<64;++index)(code=message.charCodeAt(index))<128?blocks[i>>2]|=code<<SHIFT[3&i++]:code<2048?(blocks[i>>2]|=(192|code>>6)<<SHIFT[3&i++],blocks[i>>2]|=(128|63&code)<<SHIFT[3&i++]):code<55296||code>=57344?(blocks[i>>2]|=(224|code>>12)<<SHIFT[3&i++],blocks[i>>2]|=(128|code>>6&63)<<SHIFT[3&i++],blocks[i>>2]|=(128|63&code)<<SHIFT[3&i++]):(code=65536+((1023&code)<<10|1023&message.charCodeAt(++index)),blocks[i>>2]|=(240|code>>18)<<SHIFT[3&i++],blocks[i>>2]|=(128|code>>12&63)<<SHIFT[3&i++],blocks[i>>2]|=(128|code>>6&63)<<SHIFT[3&i++],blocks[i>>2]|=(128|63&code)<<SHIFT[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=blocks[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha1.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var blocks=this.blocks,i=this.lastByteIndex;blocks[16]=this.block,blocks[i>>2]|=EXTRA[3&i],this.block=blocks[16],i>=56&&(this.hashed||this.hash(),blocks[0]=this.block,blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0),blocks[14]=this.hBytes<<3|this.bytes>>>29,blocks[15]=this.bytes<<3,this.hash()}},Sha1.prototype.hash=function(){var j,t,a=this.h0,b=this.h1,c=this.h2,d=this.h3,e=this.h4,blocks=this.blocks;for(j=16;j<80;++j)t=blocks[j-3]^blocks[j-8]^blocks[j-14]^blocks[j-16],blocks[j]=t<<1|t>>>31;for(j=0;j<20;j+=5)a=(t=(b=(t=(c=(t=(d=(t=(e=(t=a<<5|a>>>27)+(b&c|~b&d)+e+1518500249+blocks[j]<<0)<<5|e>>>27)+(a&(b=b<<30|b>>>2)|~a&c)+d+1518500249+blocks[j+1]<<0)<<5|d>>>27)+(e&(a=a<<30|a>>>2)|~e&b)+c+1518500249+blocks[j+2]<<0)<<5|c>>>27)+(d&(e=e<<30|e>>>2)|~d&a)+b+1518500249+blocks[j+3]<<0)<<5|b>>>27)+(c&(d=d<<30|d>>>2)|~c&e)+a+1518500249+blocks[j+4]<<0,c=c<<30|c>>>2;for(;j<40;j+=5)a=(t=(b=(t=(c=(t=(d=(t=(e=(t=a<<5|a>>>27)+(b^c^d)+e+1859775393+blocks[j]<<0)<<5|e>>>27)+(a^(b=b<<30|b>>>2)^c)+d+1859775393+blocks[j+1]<<0)<<5|d>>>27)+(e^(a=a<<30|a>>>2)^b)+c+1859775393+blocks[j+2]<<0)<<5|c>>>27)+(d^(e=e<<30|e>>>2)^a)+b+1859775393+blocks[j+3]<<0)<<5|b>>>27)+(c^(d=d<<30|d>>>2)^e)+a+1859775393+blocks[j+4]<<0,c=c<<30|c>>>2;for(;j<60;j+=5)a=(t=(b=(t=(c=(t=(d=(t=(e=(t=a<<5|a>>>27)+(b&c|b&d|c&d)+e-1894007588+blocks[j]<<0)<<5|e>>>27)+(a&(b=b<<30|b>>>2)|a&c|b&c)+d-1894007588+blocks[j+1]<<0)<<5|d>>>27)+(e&(a=a<<30|a>>>2)|e&b|a&b)+c-1894007588+blocks[j+2]<<0)<<5|c>>>27)+(d&(e=e<<30|e>>>2)|d&a|e&a)+b-1894007588+blocks[j+3]<<0)<<5|b>>>27)+(c&(d=d<<30|d>>>2)|c&e|d&e)+a-1894007588+blocks[j+4]<<0,c=c<<30|c>>>2;for(;j<80;j+=5)a=(t=(b=(t=(c=(t=(d=(t=(e=(t=a<<5|a>>>27)+(b^c^d)+e-899497514+blocks[j]<<0)<<5|e>>>27)+(a^(b=b<<30|b>>>2)^c)+d-899497514+blocks[j+1]<<0)<<5|d>>>27)+(e^(a=a<<30|a>>>2)^b)+c-899497514+blocks[j+2]<<0)<<5|c>>>27)+(d^(e=e<<30|e>>>2)^a)+b-899497514+blocks[j+3]<<0)<<5|b>>>27)+(c^(d=d<<30|d>>>2)^e)+a-899497514+blocks[j+4]<<0,c=c<<30|c>>>2;this.h0=this.h0+a<<0,this.h1=this.h1+b<<0,this.h2=this.h2+c<<0,this.h3=this.h3+d<<0,this.h4=this.h4+e<<0},Sha1.prototype.hex=function(){this.finalize();var h0=this.h0,h1=this.h1,h2=this.h2,h3=this.h3,h4=this.h4;return HEX_CHARS[h0>>28&15]+HEX_CHARS[h0>>24&15]+HEX_CHARS[h0>>20&15]+HEX_CHARS[h0>>16&15]+HEX_CHARS[h0>>12&15]+HEX_CHARS[h0>>8&15]+HEX_CHARS[h0>>4&15]+HEX_CHARS[15&h0]+HEX_CHARS[h1>>28&15]+HEX_CHARS[h1>>24&15]+HEX_CHARS[h1>>20&15]+HEX_CHARS[h1>>16&15]+HEX_CHARS[h1>>12&15]+HEX_CHARS[h1>>8&15]+HEX_CHARS[h1>>4&15]+HEX_CHARS[15&h1]+HEX_CHARS[h2>>28&15]+HEX_CHARS[h2>>24&15]+HEX_CHARS[h2>>20&15]+HEX_CHARS[h2>>16&15]+HEX_CHARS[h2>>12&15]+HEX_CHARS[h2>>8&15]+HEX_CHARS[h2>>4&15]+HEX_CHARS[15&h2]+HEX_CHARS[h3>>28&15]+HEX_CHARS[h3>>24&15]+HEX_CHARS[h3>>20&15]+HEX_CHARS[h3>>16&15]+HEX_CHARS[h3>>12&15]+HEX_CHARS[h3>>8&15]+HEX_CHARS[h3>>4&15]+HEX_CHARS[15&h3]+HEX_CHARS[h4>>28&15]+HEX_CHARS[h4>>24&15]+HEX_CHARS[h4>>20&15]+HEX_CHARS[h4>>16&15]+HEX_CHARS[h4>>12&15]+HEX_CHARS[h4>>8&15]+HEX_CHARS[h4>>4&15]+HEX_CHARS[15&h4]},Sha1.prototype.toString=Sha1.prototype.hex,Sha1.prototype.digest=function(){this.finalize();var h0=this.h0,h1=this.h1,h2=this.h2,h3=this.h3,h4=this.h4;return[h0>>24&255,h0>>16&255,h0>>8&255,255&h0,h1>>24&255,h1>>16&255,h1>>8&255,255&h1,h2>>24&255,h2>>16&255,h2>>8&255,255&h2,h3>>24&255,h3>>16&255,h3>>8&255,255&h3,h4>>24&255,h4>>16&255,h4>>8&255,255&h4]},Sha1.prototype.array=Sha1.prototype.digest,Sha1.prototype.arrayBuffer=function(){this.finalize();var buffer=new ArrayBuffer(20),dataView=new DataView(buffer);return dataView.setUint32(0,this.h0),dataView.setUint32(4,this.h1),dataView.setUint32(8,this.h2),dataView.setUint32(12,this.h3),dataView.setUint32(16,this.h4),buffer};var exports=createMethod();COMMON_JS?module.exports=exports:root.sha1=exports})()}(sha1)),sha1.exports}var globals={},hasRequiredGlobals;function requireGlobals(){if(hasRequiredGlobals)return globals;if(hasRequiredGlobals=1,self.Squeak||(self.Squeak={}),!Squeak.Settings){var settings;try{if((settings=self.localStorage)["squeak-foo:"]="bar","bar"!==settings["squeak-foo:"])throw Error();delete settings["squeak-foo:"]}catch(e){settings={}}Squeak.Settings=settings}return Object.extend||(Object.extend=function(obj){for(var i=1;i<arguments.length;i++)if("object"==typeof arguments[i])for(var name in arguments[i])obj[name]=arguments[i][name]}),Function.prototype.subclass||(Function.prototype.subclass=function(classPath){var subclass=function(){if(this.initialize){var result=this.initialize.apply(this,arguments);if(void 0!==result)return result}return this},protoclass=function(){};protoclass.prototype=this.prototype,subclass.prototype=new protoclass;for(var i=1;i<arguments.length;i++)Object.extend(subclass.prototype,arguments[i]);var path=classPath.split("."),className=path.pop();return path.reduce((function(namespace,path){return namespace[path]||(namespace[path]={}),namespace[path]}),self)[className]=subclass,subclass}),globals}var vm={},hasRequiredVm;function requireVm(){return hasRequiredVm||(hasRequiredVm=1,Object.extend(Squeak,"version",{vmVersion:"SqueakJS 1.2.3",vmDate:"2024-09-28",vmBuild:"cp-202501-10",vmPath:"unknown",vmFile:"vm.js",vmMakerVersion:"[VMMakerJS-bf.17 VMMaker-bf.353]",vmInterpreterVersion:"JSInterpreter VMMaker.js-codefrau.1",platformName:"JS",platformSubtype:"unknown",osVersion:"unknown",windowSystem:"unknown"},"object header",{HeaderTypeMask:3,HeaderTypeSizeAndClass:0,HeaderTypeClass:1,HeaderTypeFree:2,HeaderTypeShort:3},"special objects",{splOb_NilObject:0,splOb_FalseObject:1,splOb_TrueObject:2,splOb_SchedulerAssociation:3,splOb_ClassBitmap:4,splOb_ClassInteger:5,splOb_ClassString:6,splOb_ClassArray:7,splOb_SmalltalkDictionary:8,splOb_ClassFloat:9,splOb_ClassMethodContext:10,splOb_ClassBlockContext:11,splOb_ClassPoint:12,splOb_ClassLargePositiveInteger:13,splOb_TheDisplay:14,splOb_ClassMessage:15,splOb_ClassCompiledMethod:16,splOb_TheLowSpaceSemaphore:17,splOb_ClassSemaphore:18,splOb_ClassCharacter:19,splOb_SelectorDoesNotUnderstand:20,splOb_SelectorCannotReturn:21,splOb_ProcessSignalingLowSpace:22,splOb_SpecialSelectors:23,splOb_CharacterTable:24,splOb_SelectorMustBeBoolean:25,splOb_ClassByteArray:26,splOb_ClassProcess:27,splOb_CompactClasses:28,splOb_TheTimerSemaphore:29,splOb_TheInterruptSemaphore:30,splOb_FloatProto:31,splOb_SelectorCannotInterpret:34,splOb_MethodContextProto:35,splOb_ClassBlockClosure:36,splOb_ClassFullBlockClosure:37,splOb_ExternalObjectsArray:38,splOb_ClassPseudoContext:39,splOb_ClassTranslatedMethod:40,splOb_TheFinalizationSemaphore:41,splOb_ClassLargeNegativeInteger:42,splOb_ClassExternalAddress:43,splOb_ClassExternalStructure:44,splOb_ClassExternalData:45,splOb_ClassExternalFunction:46,splOb_ClassExternalLibrary:47,splOb_SelectorAboutToReturn:48,splOb_SelectorRunWithIn:49,splOb_SelectorAttemptToAssign:50,splOb_PrimErrTableIndex:51,splOb_ClassAlien:52,splOb_InvokeCallbackSelector:53,splOb_ClassUnsafeAlien:54,splOb_ClassWeakFinalizer:55},"known classes",{AdditionalMethodState_selector:1,Class_superclass:0,Class_mdict:1,Class_format:2,Class_instVars:null,Class_name:6,ClassBinding_value:1,Context_sender:0,Context_instructionPointer:1,Context_stackPointer:2,Context_method:3,Context_closure:4,Context_receiver:5,Context_tempFrameStart:6,Context_smallFrameSize:16,Context_largeFrameSize:56,BlockContext_caller:0,BlockContext_argumentCount:3,BlockContext_initialIP:4,BlockContext_home:5,Closure_outerContext:0,Closure_startpc:1,Closure_numArgs:2,Closure_firstCopiedValue:3,ClosureFull_method:1,ClosureFull_receiver:3,ClosureFull_firstCopiedValue:4,Stream_array:0,Stream_position:1,Stream_limit:2,ProcSched_processLists:0,ProcSched_activeProcess:1,Link_nextLink:0,LinkedList_firstLink:0,LinkedList_lastLink:1,Semaphore_excessSignals:2,Mutex_owner:2,Proc_suspendedContext:1,Proc_priority:2,Proc_myList:3,Proc_name:4,Assn_key:0,Assn_value:1,MethodDict_array:1,MethodDict_selectorStart:2,Message_selector:0,Message_arguments:1,Message_lookupClass:2,Point_x:0,Point_y:1,LargeInteger_bytes:0,LargeInteger_neg:1,WeakFinalizationList_first:0,WeakFinalizerItem_list:0,WeakFinalizerItem_next:1},"constants",{MinSmallInt:-1073741824,MaxSmallInt:1073741823,NonSmallInt:-1342177280,MillisecondClockMask:536870911},"error codes",{PrimNoErr:0,PrimErrGenericFailure:1,PrimErrBadReceiver:2,PrimErrBadArgument:3,PrimErrBadIndex:4,PrimErrBadNumArgs:5,PrimErrInappropriate:6,PrimErrUnsupported:7,PrimErrNoModification:8,PrimErrNoMemory:9,PrimErrNoCMemory:10,PrimErrNotFound:11,PrimErrBadMethod:12,PrimErrNamedInternal:13,PrimErrObjectMayMove:14,PrimErrLimitExceeded:15,PrimErrObjectIsPinned:16,PrimErrWritePastObject:17},"modules",{externalModules:Squeak.externalModules||{},registerExternalModule:function(name,module){this.externalModules[name]=module}},"time",{Epoch:Date.UTC(1901,0,1)+6e4*(new Date).getTimezoneOffset(),EpochUTC:Date.UTC(1901,0,1),totalSeconds:function(){return Math.floor((Date.now()-Squeak.Epoch)/1e3)}},"utils",{bytesAsString:function(bytes){for(var chars=[],i=0;i<bytes.length;)chars.push(String.fromCharCode.apply(null,bytes.subarray(i,i+=16348)));return chars.join("")},word64FromUint32:function(hi,lo){return hi<2097152?4294967296*hi+lo:hi>4292870144?4294967296*(hi>>0)+lo:[hi,lo]}})),vm}var vm_object={},hasRequiredVm_object;function requireVm_object(){return hasRequiredVm_object||(hasRequiredVm_object=1,Object.subclass("Squeak.Object","initialization",{initInstanceOf:function(aClass,indexableSize,hash,nilObj){this.sqClass=aClass,this.hash=hash;var instSpec=aClass.pointers[Squeak.Class_format],instSize=(instSpec>>1&63)+(instSpec>>10&192)-1;this._format=instSpec>>7&15,this._format<8?6!=this._format?instSize+indexableSize>0&&(this.pointers=this.fillArray(instSize+indexableSize,nilObj)):indexableSize>0&&(aClass.isFloatClass?(this.isFloat=!0,this.float=0):this.words=new Uint32Array(indexableSize)):indexableSize>0&&(this.bytes=new Uint8Array(indexableSize))},initAsClone:function(original,hash){this.sqClass=original.sqClass,this.hash=hash,this._format=original._format,original.isFloat?(this.isFloat=original.isFloat,this.float=original.float):(original.pointers&&(this.pointers=original.pointers.slice(0)),original.words&&(this.words=new Uint32Array(original.words)),original.bytes&&(this.bytes=new Uint8Array(original.bytes)))},initFromImage:function(oop,cls,fmt,hsh){this.oop=oop,this.sqClass=cls,this._format=fmt,this.hash=hsh},classNameFromImage:function(oopMap,rawBits){var name=oopMap[rawBits[this.oop][Squeak.Class_name]];if(name&&name._format>=8&&name._format<12){var bits=rawBits[name.oop],bytes=name.decodeBytes(bits.length,bits,0,3&name._format);return Squeak.bytesAsString(bytes)}return"Class"},renameFromImage:function(oopMap,rawBits,ccArray){var classObj=this.sqClass<32?oopMap[ccArray[this.sqClass-1]]:oopMap[this.sqClass];if(!classObj)return this;var instProto=classObj.instProto||classObj.classInstProto(classObj.classNameFromImage(oopMap,rawBits));if(!instProto)return this;var renamedObj=new instProto;return renamedObj.oop=this.oop,renamedObj.sqClass=this.sqClass,renamedObj._format=this._format,renamedObj.hash=this.hash,renamedObj},installFromImage:function(oopMap,rawBits,ccArray,floatClass,littleEndian,nativeFloats){var ccInt=this.sqClass;this.sqClass=ccInt>0&&ccInt<32?oopMap[ccArray[ccInt-1]]:oopMap[ccInt];var bits=rawBits[this.oop],nWords=bits.length;if(this._format<5){if(nWords>0){var oops=bits;this.pointers=this.decodePointers(nWords,oops,oopMap)}}else if(this._format>=12){var numLits=this.decodeWords(1,bits,littleEndian)[0]>>10&255;oops=this.decodeWords(numLits+1,bits,littleEndian);this.pointers=this.decodePointers(numLits+1,oops,oopMap),this.bytes=this.decodeBytes(nWords-(numLits+1),bits,numLits+1,3&this._format)}else this._format>=8?nWords>0&&(this.bytes=this.decodeBytes(nWords,bits,0,3&this._format)):this.sqClass==floatClass?(this.isFloat=!0,this.float=this.decodeFloat(bits,littleEndian,nativeFloats)):nWords>0&&(this.words=this.decodeWords(nWords,bits,littleEndian));this.mark=!1},decodePointers:function(nWords,theBits,oopMap){for(var ptrs=new Array(nWords),i=0;i<nWords;i++){var oop=theBits[i];ptrs[i]=1==(1&oop)?oop>>1:oopMap[oop]||42424242}return ptrs},decodeWords:function(nWords,theBits,littleEndian){for(var data=new DataView(theBits.buffer,theBits.byteOffset),words=new Uint32Array(nWords),i=0;i<nWords;i++)words[i]=data.getUint32(4*i,littleEndian);return words},decodeBytes:function(nWords,theBits,wordOffset,fmtLowBits){var nBytes=4*nWords-fmtLowBits,wordsAsBytes=new Uint8Array(theBits.buffer,theBits.byteOffset+4*wordOffset,nBytes),bytes=new Uint8Array(nBytes);return bytes.set(wordsAsBytes),bytes},decodeFloat:function(theBits,littleEndian,nativeFloats){var data=new DataView(theBits.buffer,theBits.byteOffset);if(!littleEndian)return data.getFloat64(0,!1);if(nativeFloats)return data.getFloat64(0,!0);var buffer=new ArrayBuffer(8),swapped=new DataView(buffer);return swapped.setUint32(0,data.getUint32(4)),swapped.setUint32(4,data.getUint32(0)),swapped.getFloat64(0,!0)},fillArray:function(length,filler){var array=new Array(length);return array.fill(filler),array}},"testing",{isWords:function(){return 6===this._format},isBytes:function(){var fmt=this._format;return fmt>=8&&fmt<=11},isWordsOrBytes:function(){var fmt=this._format;return 6==fmt||fmt>=8&&fmt<=11},isPointers:function(){return this._format<=4},isWeak:function(){return 4===this._format},isMethod:function(){return this._format>=12},sameFormats:function(a,b){return a<8?a===b:(12&a)==(12&b)},sameFormatAs:function(obj){return this.sameFormats(this._format,obj._format)}},"printing",{toString:function(){return this.sqInstName()},bytesAsString:function(){return this.bytes?Squeak.bytesAsString(this.bytes):""},bytesAsNumberString:function(negative){if(!this.bytes)return"";for(var hex="0123456789ABCDEF",digits=[],value=0,i=this.bytes.length-1;i>=0;i--)digits.push(hex[this.bytes[i]>>4]),digits.push(hex[15&this.bytes[i]]),value=256*value+this.bytes[i];var sign=negative?"-":"",approx=value>9007199254740991?"≈":"";return sign+"16r"+digits.join("")+" ("+approx+sign+value+"L)"},assnKeyAsString:function(){return this.pointers[Squeak.Assn_key].bytesAsString()},slotNameAt:function(index){var instSize=this.instSize();return index<=instSize?this.sqClass.allInstVarNames()[index-1]||"ivar"+(index-1):(index-instSize).toString()},sqInstName:function(){if(this.isNil)return"nil";if(this.isTrue)return"true";if(this.isFalse)return"false";if(this.isFloat){var str=this.float.toString();return/\./.test(str)||(str+=".0"),str}var className=this.sqClass.className();if(/ /.test(className))return"the "+className;switch(className){case"String":case"ByteString":return"'"+this.bytesAsString()+"'";case"Symbol":case"ByteSymbol":return"#"+this.bytesAsString();case"Point":return this.pointers.join("@");case"Rectangle":return this.pointers.join(" corner: ");case"Association":case"ReadOnlyVariableBinding":return this.pointers.join("->");case"LargePositiveInteger":return this.bytesAsNumberString(!1);case"LargeNegativeInteger":return this.bytesAsNumberString(!0);case"Character":var unicode=this.pointers?this.pointers[0]:this.hash;return"$"+String.fromCharCode(unicode)+" ("+unicode.toString()+")";case"CompiledMethod":return this.methodAsString();case"CompiledBlock":return"[] in "+this.blockOuterCode().sqInstName()}return/^[aeiou]/i.test(className)?"an"+className:"a"+className}},"accessing",{pointersSize:function(){return this.pointers?this.pointers.length:0},bytesSize:function(){return this.bytes?this.bytes.length:0},wordsSize:function(){return this.isFloat?2:this.words?this.words.length:0},instSize:function(){var fmt=this._format;return fmt>4||2===fmt?0:fmt<2?this.pointersSize():this.sqClass.classInstSize()},indexableSize:function(primHandler){var fmt=this._format;return fmt<2?-1:3===fmt&&primHandler.vm.isContext(this)&&!primHandler.allowAccessBeyondSP?this.pointers[Squeak.Context_stackPointer]:fmt<6?this.pointersSize()-this.instSize():fmt<8?this.wordsSize():fmt<12?this.bytesSize():this.bytesSize()+4*this.pointersSize()},floatData:function(){var buffer=new ArrayBuffer(8),data=new DataView(buffer);return data.setFloat64(0,this.float,!1),data},wordsAsFloat32Array:function(){return this.float32Array||this.words&&(this.float32Array=new Float32Array(this.words.buffer))},wordsAsFloat64Array:function(){return this.float64Array||this.words&&(this.float64Array=new Float64Array(this.words.buffer))},wordsAsInt32Array:function(){return this.int32Array||this.words&&(this.int32Array=new Int32Array(this.words.buffer))},wordsAsInt16Array:function(){return this.int16Array||this.words&&(this.int16Array=new Int16Array(this.words.buffer))},wordsAsUint16Array:function(){return this.uint16Array||this.words&&(this.uint16Array=new Uint16Array(this.words.buffer))},wordsAsUint8Array:function(){return this.uint8Array||this.words&&(this.uint8Array=new Uint8Array(this.words.buffer))},wordsOrBytes:function(){return this.words?this.words:this.uint32Array?this.uint32Array:this.bytes?this.uint32Array=new Uint32Array(this.bytes.buffer,0,this.bytes.length>>>2):null},setAddr:function(addr){var words=this.snapshotSize();return this.oop=addr+4*words.header,addr+4*(words.header+words.body)},snapshotSize:function(){var nWords=this.isFloat?2:this.words?this.words.length:this.pointers?this.pointers.length:0;return this.bytes&&(nWords+=this.bytes.length+3>>>2),{header:++nWords>63?2:this.sqClass.isCompact?0:1,body:nWords}},addr:function(){return this.oop-4*this.snapshotSize().header},totalBytes:function(){var words=this.snapshotSize();return 4*(words.header+words.body)},writeTo:function(data,pos,image){this.bytes&&(this._format|=3&-this.bytes.length);var beforePos=pos,size=this.snapshotSize(),formatAndHash=(15&this._format)<<8|(4095&this.hash)<<17;switch(size.header){case 2:data.setUint32(pos,size.body<<2|Squeak.HeaderTypeSizeAndClass),pos+=4,data.setUint32(pos,this.sqClass.oop|Squeak.HeaderTypeSizeAndClass),pos+=4,data.setUint32(pos,formatAndHash|Squeak.HeaderTypeSizeAndClass),pos+=4;break;case 1:data.setUint32(pos,this.sqClass.oop|Squeak.HeaderTypeClass),pos+=4,data.setUint32(pos,formatAndHash|size.body<<2|Squeak.HeaderTypeClass),pos+=4;break;case 0:var classIndex=image.compactClasses.indexOf(this.sqClass)+1;data.setUint32(pos,formatAndHash|classIndex<<12|size.body<<2|Squeak.HeaderTypeShort),pos+=4}if(this.isFloat)data.setFloat64(pos,this.float),pos+=8;else if(this.words)for(var i=0;i<this.words.length;i++)data.setUint32(pos,this.words[i]),pos+=4;else if(this.pointers)for(i=0;i<this.pointers.length;i++)data.setUint32(pos,image.objectToOop(this.pointers[i])),pos+=4;if(this.bytes){for(i=0;i<this.bytes.length;i++)data.setUint8(pos++,this.bytes[i]);pos+=3&-this.bytes.length}if(pos!==beforePos+this.totalBytes())throw Error("written size does not match");return pos}},"as class",{classInstFormat:function(){return this.pointers[Squeak.Class_format]>>7&15},classInstSize:function(){var spec=this.pointers[Squeak.Class_format];return(spec>>10&192)+(spec>>1&63)-1},classInstIsBytes:function(){var fmt=this.classInstFormat();return fmt>=8&&fmt<=11},classInstIsPointers:function(){return this.classInstFormat()<=4},instVarNames:function(){for(var index=3;index<=4;index++){var varNames=this.pointers[index].pointers;if(varNames&&varNames.length&&varNames[0].bytes)return varNames.map((function(each){return each.bytesAsString()}))}return[]},allInstVarNames:function(){var superclass=this.superclass();return superclass.isNil?this.instVarNames():superclass.allInstVarNames().concat(this.instVarNames())},superclass:function(){return this.pointers[0]},className:function(){if(!this.pointers)return"_NOTACLASS_";for(var nameIdx=6;nameIdx<=7;nameIdx++){if((name=this.pointers[nameIdx])&&name.bytes)return name.bytesAsString()}for(var clsIndex=3;clsIndex<=6;clsIndex++){var cls=this.pointers[clsIndex];if(cls&&cls.pointers)for(nameIdx=6;nameIdx<=7;nameIdx++){var name;if((name=cls.pointers[nameIdx])&&name.bytes)return name.bytesAsString()+" class"}}return"_SOMECLASS_"},defaultInst:function(){return Squeak.Object},classInstProto:function(className){if(this.instProto)return this.instProto;var proto=this.defaultInst();try{className||(className=this.className());var safeName=className.replace(/[^A-Za-z0-9]/g,"_");safeName="UndefinedObject"===safeName?"nil":"True"===safeName?"true_":"False"===safeName?"false_":(/^[AEIOU]/.test(safeName)?"an":"a")+safeName,(proto=new Function("return function "+safeName+"() {};")()).prototype=this.defaultInst().prototype}catch(e){}return Object.defineProperty(this,"instProto",{value:proto}),proto}},"as method",{methodSignFlag:function(){return!1},methodNumLits:function(){return this.pointers[0]>>9&255},methodNumArgs:function(){return this.pointers[0]>>24&15},methodPrimitiveIndex:function(){var primBits=805306879&this.pointers[0];return primBits>511?(511&primBits)+(primBits>>19):primBits},methodClassForSuper:function(){return this.pointers[this.methodNumLits()].pointers[Squeak.Assn_value]},methodNeedsLargeFrame:function(){return(131072&this.pointers[0])>0},methodAddPointers:function(headerAndLits){this.pointers=headerAndLits},methodTempCount:function(){return this.pointers[0]>>18&63},methodGetLiteral:function(zeroBasedIndex){return this.pointers[1+zeroBasedIndex]},methodGetSelector:function(zeroBasedIndex){return this.pointers[1+zeroBasedIndex]},methodAsString:function(){return"aCompiledMethod"}},"as context",{contextHome:function(){return this.contextIsBlock()?this.pointers[Squeak.BlockContext_home]:this},contextIsBlock:function(){return"number"==typeof this.pointers[Squeak.BlockContext_argumentCount]},contextMethod:function(){return this.contextHome().pointers[Squeak.Context_method]},contextSender:function(){return this.pointers[Squeak.Context_sender]},contextSizeWithStack:function(vm){if(vm&&vm.activeContext===this)return vm.sp+1;var sp=this.pointers[Squeak.Context_stackPointer];return Squeak.Context_tempFrameStart+("number"==typeof sp?sp:0)}})),vm_object}var vm_object_spur={},hasRequiredVm_object_spur;function requireVm_object_spur(){return hasRequiredVm_object_spur||(hasRequiredVm_object_spur=1,Squeak.Object.subclass("Squeak.ObjectSpur","initialization",{initInstanceOf:function(aClass,indexableSize,hash,nilObj){this.sqClass=aClass,this.hash=hash;var instSpec=aClass.pointers[Squeak.Class_format],instSize=65535&instSpec,format=instSpec>>16&31;this._format=format,format<12?format<10?instSize+indexableSize>0&&(this.pointers=this.fillArray(instSize+indexableSize,nilObj)):indexableSize>0&&(aClass.isFloatClass?(this.isFloat=!0,this.float=0):this.words=new Uint32Array(indexableSize)):indexableSize>0&&(this.bytes=new Uint8Array(indexableSize))},installFromImage:function(oopMap,rawBits,classTable,floatClass,littleEndian,getCharacter,is64Bit){var classID=this.sqClass;if(classID<32)throw Error("Invalid class ID: "+classID);if(this.sqClass=classTable[classID],!this.sqClass)throw Error("Class ID not in class table: "+classID);var bits=rawBits[this.oop],nWords=bits.length;switch(this._format){case 0:case 1:case 2:case 3:case 4:case 5:if(nWords>0){var oops=bits;this.pointers=this.decodePointers(nWords,oops,oopMap,getCharacter,is64Bit)}break;case 11:nWords--,this._format=10;case 10:this.sqClass===floatClass?(this.isFloat=!0,this.float=this.decodeFloat(bits,littleEndian,!0)):nWords>0&&(this.words=this.decodeWords(nWords,bits,littleEndian));break;case 12:case 13:throw Error("16 bit arrays not supported yet");case 20:case 21:case 22:case 23:nWords--,this._format-=4;case 16:case 17:case 18:case 19:nWords>0&&(this.bytes=this.decodeBytes(nWords,bits,0,3&this._format));break;case 28:case 29:case 30:case 31:nWords--,this._format-=4;case 24:case 25:case 26:case 27:var intHeader=this.decodeWords(1,bits,littleEndian)[0]>>(is64Bit?3:1),numLits=32767&intHeader,ptrWords=(oops=is64Bit?this.decodeWords64(numLits+1,bits,littleEndian):this.decodeWords(numLits+1,bits,littleEndian),is64Bit?2*(numLits+1):numLits+1);this.pointers=this.decodePointers(numLits+1,oops,oopMap,getCharacter,is64Bit),this.bytes=this.decodeBytes(nWords-ptrWords,bits,ptrWords,3&this._format),is64Bit&&(this.pointers[0]=2147483648&bits[1]|intHeader);break;default:throw Error("Unknown object format: "+this._format)}this.mark=!1},decodeWords64:function(nWords,theBits,littleEndian){for(var words=new Array(nWords),i=0;i<nWords;i++){var lo=theBits[2*i],hi=theBits[2*i+1];words[i]=Squeak.word64FromUint32(hi,lo)}return words},decodePointers:function(nWords,theBits,oopMap,getCharacter,is64Bit){for(var ptrs=new Array(nWords),i=0;i<nWords;i++){var oop=theBits[i];if("number"!=typeof oop)if(4==(7&oop[1]))ptrs[i]=this.decodeSmallFloat(oop[0],oop[1],is64Bit);else{if(1!=(7&oop[1]))throw 2==(7&oop[1])?Error("Large Immediate Characters not implemented yet"):Error("Large OOPs not implemented yet");ptrs[i]=is64Bit.makeLargeFromSmall(oop[0],oop[1])}else if(1==(1&oop))ptrs[i]=is64Bit?(oop>=0?oop<=8589934591:oop>=-8589934592)?oop/4>>1:is64Bit.makeLargeFromSmall((oop-(oop>>>0))/4294967296>>>0,oop>>>0):oop>>1;else if(2==(3&oop)){if(oop<0||oop>8589934591)throw Error("Large Immediate Characters not implemented yet");ptrs[i]=getCharacter(oop>>>(is64Bit?3:2))}else if(is64Bit&&4==(7&oop))ptrs[i]=this.decodeSmallFloat((oop-(oop>>>0))/4294967296>>>0,oop>>>0,is64Bit);else if(ptrs[i]=oopMap[oop]||42424242,42424242===ptrs[i])debugger}return ptrs},decodeSmallFloat:function(hi,lo,is64Bit){var newHi=0,newLo=0,sign=(8&lo)<<28;return 0==(hi|4294967280&lo)?newHi=sign:(newHi=939524096+(hi>>>4)|sign,newLo=lo>>>4|(15&hi)<<28),is64Bit.makeFloat(new Uint32Array([newLo,newHi]))},overhead64:function(bits){var overhead=0,words32=0,words64=0;if(this._format<=5)overhead=-2&bits.length;else if(this._format>=24){var oddOops=1==(1&(overhead=(bits[0]>>3&32767)+1)),oddBytes=this._format>=28;oddOops&&(overhead+=oddBytes?1:-1),words64=bits.length/2,words32=bits.length-overhead}else words64=(words32=bits.length)/2;return{bytes:4*overhead,sizeHeader:words32>=255&&words64<255}},initInstanceOfChar:function(charClass,unicode){this.oop=unicode<<2|2,this.sqClass=charClass,this.hash=unicode,this._format=7,this.mark=!0},initInstanceOfFloat:function(floatClass,bits){this.sqClass=floatClass,this.hash=0,this._format=10,this.isFloat=!0,this.float=this.decodeFloat(bits,!0,!0)},initInstanceOfLargeInt:function(largeIntClass,size){this.sqClass=largeIntClass,this.hash=0,this._format=16,this.bytes=new Uint8Array(size)},classNameFromImage:function(oopMap,rawBits){var name=oopMap[rawBits[this.oop][Squeak.Class_name]];if(name&&name._format>=16&&name._format<24){var bits=rawBits[name.oop],bytes=name.decodeBytes(bits.length,bits,0,7&name._format);return Squeak.bytesAsString(bytes)}return"Class"},renameFromImage:function(oopMap,rawBits,classTable){var classObj=classTable[this.sqClass];if(!classObj)return this;var instProto=classObj.instProto||classObj.classInstProto(classObj.classNameFromImage(oopMap,rawBits));if(!instProto)return this;var renamedObj=new instProto;return renamedObj.oop=this.oop,renamedObj.sqClass=this.sqClass,renamedObj._format=this._format,renamedObj.hash=this.hash,renamedObj}},"accessing",{instSize:function(){return this._format<2?this.pointersSize():this.sqClass.classInstSize()},indexableSize:function(primHandler){var fmt=this._format;return fmt<2?-1:3===fmt&&primHandler.vm.isContext(this)?this.pointers[Squeak.Context_stackPointer]:fmt<6?this.pointersSize()-this.instSize():fmt<12?this.wordsSize():fmt<16?this.shortsSize():fmt<24?this.bytesSize():4*this.pointersSize()+this.bytesSize()},snapshotSize:function(){var nWords=this.isFloat?2:this.words?this.words.length:this.pointers?this.pointers.length:0;this.bytes&&(nWords+=this.bytes.length+3>>>2);var extraHeader=nWords>=255?2:0;return nWords+=1&nWords,(nWords+=2)<4&&(nWords=4),{header:extraHeader,body:nWords}},writeTo:function(data,pos,littleEndian,objToOop){var nWords=this.isFloat?2:this.words?this.words.length:this.pointers?this.pointers.length:0;this.bytes&&(nWords+=this.bytes.length+3>>>2,this._format|=3&-this.bytes.length);var beforePos=pos,formatAndClass=this._format<<24|4194303&this.sqClass.hash,sizeAndHash=nWords<<24|4194303&this.hash;if(nWords>=255&&(data.setUint32(pos,nWords,littleEndian),pos+=4,sizeAndHash=255<<24|4194303&this.hash,data.setUint32(pos,sizeAndHash,littleEndian),pos+=4),data.setUint32(pos,formatAndClass,littleEndian),pos+=4,data.setUint32(pos,sizeAndHash,littleEndian),pos+=4,this.isFloat)data.setFloat64(pos,this.float,littleEndian),pos+=8;else if(this.words)for(var i=0;i<this.words.length;i++)data.setUint32(pos,this.words[i],littleEndian),pos+=4;else if(this.pointers){var startIndex=0;if(this._format>=24){var mask=this.methodSignFlag()?2147483648:0,taggedHeader=this.pointers[0]<<1|1|mask;data.setUint32(pos,taggedHeader,littleEndian),pos+=4,startIndex=1}for(i=startIndex;i<this.pointers.length;i++)data.setUint32(pos,objToOop(this.pointers[i]),littleEndian),pos+=4}if(this.bytes){for(i=0;i<this.bytes.length;i++)data.setUint8(pos++,this.bytes[i]);pos+=3&-this.bytes.length}if((pos+=0===nWords?8:4*(1&nWords))!==beforePos+this.totalBytes())throw Error("written size does not match");return pos}},"testing",{isBytes:function(){var fmt=this._format;return fmt>=16&&fmt<=23},isPointers:function(){return this._format<=6},isWords:function(){return 10===this._format},isWordsOrBytes:function(){var fmt=this._format;return 10===fmt||fmt>=16&&fmt<=23},isWeak:function(){return 4===this._format},isMethod:function(){return this._format>=24},sameFormats:function(a,b){return a<16?a===b:(248&a)==(248&b)}},"as class",{defaultInst:function(){return Squeak.ObjectSpur},classInstFormat:function(){return this.pointers[Squeak.Class_format]>>16&31},classInstSize:function(){return 65535&this.pointers[Squeak.Class_format]},classInstIsBytes:function(){var fmt=this.classInstFormat();return fmt>=16&&fmt<=23},classInstIsPointers:function(){return this.classInstFormat()<=6},classByteSizeOfInstance:function(nElements){var format=this.classInstFormat(),nWords=this.classInstSize();return nWords+=format<9?nElements:format>=16?(nElements+3)/4|0:format>=12?(nElements+1)/2|0:format>=10?nElements:2*nElements,nWords+=1&nWords,(nWords+=nWords>=255?4:2)<4&&(nWords=4),4*nWords}},"as compiled block",{blockOuterCode:function(){return this.pointers[this.pointers.length-1]}},"as method",{methodSignFlag:function(){return this.pointers[0]<0},methodNumLits:function(){return 32767&this.pointers[0]},methodPrimitiveIndex:function(){return 0==(65536&this.pointers[0])?0:this.bytes[1]+256*this.bytes[2]},methodAsString:function(){var cls=this.pointers[this.pointers.length-1].pointers[Squeak.ClassBinding_value],selector=this.pointers[this.pointers.length-2];return selector.pointers&&(selector=selector.pointers[Squeak.AdditionalMethodState_selector]),cls.className()+">>"+selector.bytesAsString()}})),vm_object_spur}var vm_image={},hasRequiredVm_image;function requireVm_image(){return hasRequiredVm_image||(hasRequiredVm_image=1,Object.subclass("Squeak.Image","about",{about:function(){}},"initializing",{initialize:function(name){this.headRoom=1e8,this.totalMemory=0,this.headerFlags=0,this.name=name,this.gcCount=0,this.gcMilliseconds=0,this.pgcCount=0,this.pgcMilliseconds=0,this.gcTenured=0,this.allocationCount=0,this.oldSpaceCount=0,this.youngSpaceCount=0,this.newSpaceCount=0,this.hasNewInstances={}},readFromBuffer:function(arraybuffer,thenDo,progressDo){console.log("squeak: reading "+this.name+" ("+arraybuffer.byteLength+" bytes)"),this.startupTime=Date.now();for(var data=new DataView(arraybuffer),littleEndian=!1,pos=0,readWord32=function(){var int=data.getUint32(pos,littleEndian);return pos+=4,int},readWord=readWord32,wordSize=4,readBits=function(nWords,isPointers){if(isPointers){for(var oops=[];oops.length<nWords;)oops.push(readWord());return oops}var bits=new Uint32Array(arraybuffer,pos,nWords*wordSize/4);return pos+=nWords*wordSize,bits},baseVersions=[6501,6502,6504,68e3,68002,68004],version=0,fileHeaderSize=0;littleEndian=!littleEndian,pos=fileHeaderSize,version=readWord(),!(baseVersions.indexOf(72174&version)>=0);)if(littleEndian||(fileHeaderSize+=512),fileHeaderSize>512)throw Error("bad image version");this.version=version;var nativeFloats=0!=(1&version);this.hasClosures=!([6501,6502,68e3].indexOf(version)>=0),this.isSpur=0!=(16&version);var is64Bit=version>=68e3;if(is64Bit&&!this.isSpur)throw Error("64 bit non-spur images not supported yet");is64Bit&&(readWord=function(){var lo=data.getUint32(pos,!0),hi=data.getUint32(pos+4,!0);return pos+=8,Squeak.word64FromUint32(hi,lo)},wordSize=8),this.is64Bit=is64Bit,console.log(`squeak: Image Spur: ${this.isSpur} is64Bit: ${is64Bit} hasClosures: ${this.hasClosures} version: ${version}`);var imageHeaderSize=readWord32(),objectMemorySize=readWord(),oldBaseAddr=readWord(),specialObjectsOopInt=readWord(),lastHash=readWord32();is64Bit&&readWord32();var savedWindowSize=readWord();this.headerFlags=readWord(),this.savedHeaderWords=[lastHash,savedWindowSize,this.headerFlags];for(var i=0;i<4;i++)this.savedHeaderWords.push(readWord32());var prevObj,firstSegSize=readWord(),oopMap={},rawBits={},headerSize=fileHeaderSize+imageHeaderSize;if(pos=headerSize,this.isSpur){this.oldSpaceBytes=firstSegSize-16;for(var segmentEnd=pos+firstSegSize,addressOffset=0,classPages=null,skippedBytes=0,oopAdjust={};pos<segmentEnd;){for(;pos<segmentEnd-16;){var objPos=pos,formatAndClass=readWord32(),sizeAndHash=readWord32(),size=sizeAndHash>>>24;255===size&&(size=formatAndClass,formatAndClass=readWord32(),sizeAndHash=readWord32());oop=addressOffset+pos-8-headerSize;var classID=4194303&formatAndClass;hash=4194303&sizeAndHash,bits=readBits(size,(format=formatAndClass>>>24&31)<10&&classID>0);if(pos+=is64Bit?8*(size<1?1-size:0):4*(size<2?2-size:1&size),classID>=32){if((object=new Squeak.ObjectSpur).initFromImage(oop,classID,format,hash),prevObj&&(prevObj.nextObject=object),this.oldSpaceCount++,prevObj=object,oopMap[oldBaseAddr+oop]=object,rawBits[oop]=bits,oopAdjust[oop]=skippedBytes,is64Bit){var overhead=object.overhead64(bits);skippedBytes+=overhead.bytes,overhead.sizeHeader&&(oopAdjust[oop]-=8,skippedBytes-=8)}}else skippedBytes+=pos-objPos,16!==classID||classPages||(classPages=bits),classID&&(oopMap[oldBaseAddr+oop]=bits)}if(pos!==segmentEnd-16)throw Error("invalid segment");var deltaWords=readWord32(),deltaWordsHi=readWord32(),segmentBytes=readWord32();if(readWord32(),0!==segmentBytes){var deltaBytes=4278190080&deltaWordsHi?4*(16777215&deltaWords):0;segmentEnd+=segmentBytes,addressOffset+=deltaBytes,skippedBytes+=16+deltaBytes,this.oldSpaceBytes+=deltaBytes+segmentBytes}}this.oldSpaceBytes-=skippedBytes,this.firstOldObject=oopMap[oldBaseAddr],this.lastOldObject=object,this.lastOldObject.nextObject=null}else{for(;pos<headerSize+objectMemorySize;){var nWords=0,classInt=0,header=readWord();switch(header&Squeak.HeaderTypeMask){case Squeak.HeaderTypeSizeAndClass:nWords=header>>>2,classInt=readWord(),header=readWord();break;case Squeak.HeaderTypeClass:classInt=header-Squeak.HeaderTypeClass,nWords=(header=readWord())>>>2&63;break;case Squeak.HeaderTypeShort:nWords=header>>>2&63,classInt=header>>>12&31;break;case Squeak.HeaderTypeFree:throw Error("Unexpected free block")}nWords--;var format,object,oop=pos-4-headerSize,hash=header>>>17&4095,bits=readBits(nWords,(format=header>>>8&15)<5);(object=new Squeak.Object).initFromImage(oop,classInt,format,hash),classInt<32&&(object.hash|=268435456),prevObj&&(prevObj.nextObject=object),this.oldSpaceCount++,prevObj=object,oopMap[oldBaseAddr+oop]=object,rawBits[oop]=bits}this.firstOldObject=oopMap[oldBaseAddr+4],this.lastOldObject=object,this.lastOldObject.nextObject=null,this.oldSpaceBytes=objectMemorySize}this.totalMemory=this.oldSpaceBytes+this.headRoom,this.totalMemory=1e6*Math.ceil(this.totalMemory/1e6);var _splObs=oopMap[specialObjectsOopInt],cc=this.isSpur?this.spurClassTable(oopMap,rawBits,classPages,_splObs):rawBits[oopMap[rawBits[_splObs.oop][Squeak.splOb_CompactClasses]].oop],renamedObj=null;for(object=this.firstOldObject,prevObj=null;object;)prevObj=renamedObj,renamedObj=object.renameFromImage(oopMap,rawBits,cc),prevObj?prevObj.nextObject=renamedObj:this.firstOldObject=renamedObj,oopMap[oldBaseAddr+object.oop]=renamedObj,object=object.nextObject;this.lastOldObject=renamedObj,this.lastOldObject.nextObject=null;var splObs=oopMap[specialObjectsOopInt],compactClasses=rawBits[oopMap[rawBits[splObs.oop][Squeak.splOb_CompactClasses]].oop],floatClass=oopMap[rawBits[splObs.oop][Squeak.splOb_ClassFloat]];this.isSpur&&(this.initImmediateClasses(oopMap,rawBits,splObs),compactClasses=this.spurClassTable(oopMap,rawBits,classPages,splObs),nativeFloats=this.getCharacter.bind(this),this.initSpurOverrides());var obj=this.firstOldObject,done=0;floatClass.hash=34;var mapSomeObjects=function(){if(obj){for(var stop=done+(this.oldSpaceCount/20|0);obj&&done<stop;)obj.installFromImage(oopMap,rawBits,compactClasses,floatClass,littleEndian,nativeFloats,is64Bit&&{makeFloat:function(bits){return this.instantiateFloat(bits)}.bind(this),makeLargeFromSmall:function(hi,lo){return this.instantiateLargeFromSmall(hi,lo)}.bind(this)}),obj=obj.nextObject,done++;return progressDo&&progressDo(done/this.oldSpaceCount),!0}return this.specialObjectsArray=splObs,this.decorateKnownObjects(),this.isSpur?(this.fixSkippedOops(oopAdjust),is64Bit&&this.fixPCs(),this.ensureFullBlockClosureClass(this.specialObjectsArray,compactClasses)):(this.fixCompiledMethods(),this.fixCompactOops()),!1}.bind(this);if(progressDo)self.setTimeout((function mapSomeObjectsAsync(){mapSomeObjects()?self.setTimeout(mapSomeObjectsAsync,0):thenDo&&thenDo()}),0);else{for(;mapSomeObjects(););thenDo&&thenDo()}},decorateKnownObjects:function(){var splObjs=this.specialObjectsArray.pointers;if(splObjs[Squeak.splOb_NilObject].isNil=!0,splObjs[Squeak.splOb_TrueObject].isTrue=!0,splObjs[Squeak.splOb_FalseObject].isFalse=!0,splObjs[Squeak.splOb_ClassFloat].isFloatClass=!0,!this.isSpur){this.compactClasses=this.specialObjectsArray.pointers[Squeak.splOb_CompactClasses].pointers;for(var i=0;i<this.compactClasses.length;i++)this.compactClasses[i].isNil||(this.compactClasses[i].isCompact=!0)}Number.prototype.sqInstName||Object.defineProperty(Number.prototype,"sqInstName",{enumerable:!1,value:function(){return this.toString()}})},fixCompactOops:function(){if(!this.isSpur){for(var obj=this.firstOldObject,adjust=0;obj;){var hadCompactHeader=obj.hash>268435455;if(hadCompactHeader!==!!obj.sqClass.isCompact){var isCompact=0===obj.snapshotSize().header;hadCompactHeader!==isCompact&&(adjust+=isCompact?-4:4)}obj.hash&=268435455,obj.oop+=adjust,obj=obj.nextObject}this.oldSpaceBytes+=adjust}},fixCompiledMethods:function(){if(!(this.version>=6502))for(var obj=this.firstOldObject,compiledMethodClass=this.specialObjectsArray.pointers[Squeak.splOb_ClassCompiledMethod];obj;)obj.isMethod()&&(obj.sqClass=compiledMethodClass),obj=obj.nextObject},fixSkippedOops:function(oopAdjust){for(var obj=this.firstOldObject;obj;)obj.oop-=oopAdjust[obj.oop],obj=obj.nextObject;if((obj=this.lastOldObject).addr()+obj.totalBytes()!==this.oldSpaceBytes)throw Error("image size doesn't match object sizes")},fixPCs:function(){for(var clsMethodContext=this.specialObjectsArray.pointers[Squeak.splOb_ClassMethodContext],pc=Squeak.Context_instructionPointer,method=Squeak.Context_method,clsBlockClosure=this.specialObjectsArray.pointers[Squeak.splOb_ClassBlockClosure],startpc=Squeak.Closure_startpc,outerContext=Squeak.Closure_outerContext,obj=this.firstOldObject;obj;)obj.sqClass===clsMethodContext?obj.pointers[pc]-=4*obj.pointers[method].pointers.length:obj.sqClass===clsBlockClosure&&(obj.pointers[startpc]-=4*obj.pointers[outerContext].pointers[method].pointers.length),obj=obj.nextObject},ensureFullBlockClosureClass:function(splObs,compactClasses){splObs.pointers[Squeak.splOb_ClassFullBlockClosure].isNil&&compactClasses[38]&&(splObs.pointers[Squeak.splOb_ClassFullBlockClosure]=compactClasses[38])}},"garbage collection - full",{fullGC:function(reason){this.vm.addMessage("fullGC: "+reason);var start=Date.now(),previousNew=this.newSpaceCount,previousOld=this.oldSpaceCount,newObjects=this.markReachableObjects();this.removeUnmarkedOldObjects(),this.appendToOldObjects(newObjects),this.finalizeWeakReferences(),this.allocationCount+=this.newSpaceCount,this.newSpaceCount=0,this.youngSpaceCount=0,this.hasNewInstances={},this.gcCount++,this.gcMilliseconds+=Date.now()-start;var delta=previousOld-this.oldSpaceCount,survivingNew=newObjects.length,survivingOld=this.oldSpaceCount-survivingNew,gcedNew=previousNew-survivingNew,gcedOld=previousOld-survivingOld;return console.log("Full GC ("+reason+"): "+(Date.now()-start)+" ms; before: "+previousOld.toLocaleString()+" old objects; allocated "+previousNew.toLocaleString()+" new; surviving "+survivingOld.toLocaleString()+" old; tenuring "+survivingNew.toLocaleString()+" new; gc'ed "+gcedOld.toLocaleString()+" old and "+gcedNew.toLocaleString()+" new; total now: "+this.oldSpaceCount.toLocaleString()+" ("+(delta>0?"+":"")+delta.toLocaleString()+", "+this.oldSpaceBytes.toLocaleString()+" bytes)"),newObjects.length>0?newObjects[0]:null},gcRoots:function(){return this.vm.storeContextRegisters(),[this.specialObjectsArray,this.vm.activeContext]},markReachableObjects:function(){var todo=this.gcRoots(),newObjects=[];for(this.weakObjects=[];todo.length>0;){var object=todo.pop();if(!object.mark){object.oop<0&&newObjects.push(object),object.mark=!0,object.sqClass.mark||todo.push(object.sqClass);var body=object.pointers;if(body){var n=body.length;if(object.isWeak()&&(n=object.sqClass.classInstSize(),this.weakObjects.push(object)),this.vm.isContext(object))for(var i=n=object.contextSizeWithStack();i<body.length;i++)body[i]=this.vm.nilObj;for(i=0;i<n;i++)"object"!=typeof body[i]||body[i].mark||todo.push(body[i])}}}return this.isSpur?newObjects:newObjects.sort((function(a,b){return b.oop-a.oop}))},removeUnmarkedOldObjects:function(){var removedCount=0,removedBytes=0,obj=this.firstOldObject;for(obj.mark=!1;;){var next=obj.nextObject;if(!next)return this.lastOldObject=obj,this.lastOldObject.nextObject=null,this.oldSpaceBytes-=removedBytes,void(this.oldSpaceCount-=removedCount);if(next.dirty&&(next.dirty=!1),next.mark)(obj=next).mark=!1,obj.oop-=removedBytes;else{var corpse=next;obj.nextObject=corpse.nextObject,corpse.oop=-++this.newSpaceCount,removedBytes+=corpse.totalBytes(),removedCount++}}},appendToOldObjects:function(newObjects){for(var oldObj=this.lastOldObject,i=0;i<newObjects.length;i++){var newObj=newObjects[i];newObj.mark=!1,this.oldSpaceBytes=newObj.setAddr(this.oldSpaceBytes),oldObj.nextObject=newObj,oldObj=newObj}oldObj.nextObject=null,this.lastOldObject=oldObj,this.lastOldObject.nextObject=null,this.oldSpaceCount+=newObjects.length,this.gcTenured+=newObjects.length,this.vm.signalLowSpaceIfNecessary(this.bytesLeft())},tenureIfYoung:function(object){object.oop<0&&this.appendToOldObjects([object])},finalizeWeakReferences:function(){var weakObjects=this.weakObjects;this.weakObjects=null;for(var o=0;o<weakObjects.length;o++){for(var weakObj=weakObjects[o],pointers=weakObj.pointers,firstWeak=weakObj.sqClass.classInstSize(),finalized=!1,i=firstWeak;i<pointers.length;i++)pointers[i].oop<0&&(pointers[i]=this.vm.nilObj,finalized=!0);if(finalized&&(this.vm.pendingFinalizationSignals++,firstWeak>=2)){var list=weakObj.pointers[Squeak.WeakFinalizerItem_list];if(list.sqClass==this.vm.specialObjects[Squeak.splOb_ClassWeakFinalizer]){var items=list.pointers[Squeak.WeakFinalizationList_first];weakObj.pointers[Squeak.WeakFinalizerItem_next]=items,list.pointers[Squeak.WeakFinalizationList_first]=weakObj}}}this.vm.pendingFinalizationSignals>0&&this.vm.forceInterruptCheck()}},"garbage collection - partial",{partialGC:function(reason){this.vm.addMessage("partialGC: "+reason);var start=Date.now(),previous=this.newSpaceCount,young=this.findYoungObjects();return this.appendToYoungSpace(young),this.finalizeWeakReferences(),this.cleanupYoungSpace(young),this.allocationCount+=this.newSpaceCount-young.length,this.youngSpaceCount=young.length,this.newSpaceCount=this.youngSpaceCount,this.pgcCount++,this.pgcMilliseconds+=Date.now()-start,console.log("Partial GC ("+reason+"): "+(Date.now()-start)+" ms, found "+this.youngRootsCount.toLocaleString()+" roots in "+this.oldSpaceCount.toLocaleString()+" old, kept "+this.youngSpaceCount.toLocaleString()+" young ("+(previous-this.youngSpaceCount).toLocaleString()+" gc'ed)"),young[0]},youngRoots:function(){for(var roots=this.gcRoots().filter((function(obj){return obj.oop<0})),object=this.firstOldObject;object;){if(object.dirty){for(var body=object.pointers,dirty=!1,i=0;i<body.length;i++){var child=body[i];"object"==typeof child&&child.oop<0&&(roots.push(child),dirty=!0)}dirty||(object.dirty=!1)}object=object.nextObject}return roots},findYoungObjects:function(){var todo=this.youngRoots(),newObjects=[];for(this.youngRootsCount=todo.length,this.weakObjects=[];todo.length>0;){var object=todo.pop();if(!object.mark){newObjects.push(object),object.mark=!0,object.sqClass.oop<0&&todo.push(object.sqClass);var body=object.pointers;if(body){var n=body.length;if(object.isWeak()&&(n=object.sqClass.classInstSize(),this.weakObjects.push(object)),this.vm.isContext(object))for(var i=n=object.contextSizeWithStack();i<body.length;i++)body[i]=this.vm.nilObj;for(i=0;i<n;i++){var child=body[i];"object"==typeof child&&child.oop<0&&todo.push(child)}}}}return this.isSpur?newObjects:newObjects.sort((function(a,b){return b.oop-a.oop}))},appendToYoungSpace:function(objects){for(var tempOop=this.lastOldObject.oop+1,i=0;i<objects.length;i++){var obj=objects[i];this.hasNewInstances[obj.oop]&&(delete this.hasNewInstances[obj.oop],this.hasNewInstances[tempOop]=!0),obj.oop=tempOop,obj.nextObject=objects[i+1],tempOop++}},cleanupYoungSpace:function(objects){for(var obj=objects[0],youngOop=-1;obj;)this.hasNewInstances[obj.oop]&&(delete this.hasNewInstances[obj.oop],this.hasNewInstances[youngOop]=!0),obj.oop=youngOop,obj.mark=!1,obj=obj.nextObject,youngOop--}},"creating",{registerObject:function(obj){return obj.oop=-++this.newSpaceCount,this.lastHash=13849+27181*this.lastHash&4294967295,4095&this.lastHash},registerObjectSpur:function(obj){return obj.oop=-++this.newSpaceCount,0},instantiateClass:function(aClass,indexableSize,filler){var newObject=new(aClass.classInstProto()),hash=this.registerObject(newObject);return newObject.initInstanceOf(aClass,indexableSize,hash,filler),this.hasNewInstances[aClass.oop]=!0,newObject},clone:function(object){var newObject=new(object.sqClass.classInstProto()),hash=this.registerObject(newObject);return newObject.initAsClone(object,hash),this.hasNewInstances[newObject.sqClass.oop]=!0,newObject}},"operations",{bulkBecome:function(fromArray,toArray,twoWay,copyHash){if(!fromArray)return!toArray;var n=fromArray.length;if(n!==toArray.length)return!1;var firstYoungObject=null;this.newSpaceCount>0?firstYoungObject=this.partialGC("become"):this.vm.storeContextRegisters();for(var mutations={},i=0;i<n;i++){if(!(obj=fromArray[i]).sqClass)return!1;if(mutations[obj.oop])return!1;mutations[obj.oop]=toArray[i]}if(twoWay)for(i=0;i<n;i++){if(!(obj=toArray[i]).sqClass)return!1;if(mutations[obj.oop])return!1;mutations[obj.oop]=fromArray[i]}if(copyHash)for(i=0;i<n;i++){if(!toArray[i].sqClass)return!1;var fromHash=fromArray[i].hash;if(fromArray[i].hash=toArray[i].hash,toArray[i].hash=fromHash,this.isSpur&&this.classTable[fromHash]===fromArray[i]&&(this.classTable[fromHash]=toArray[i]),twoWay&&this.isSpur&&this.classTable[toArray[i].hash]===toArray[i]){var fromClass=fromArray[i],fromClassName=fromClass.className?fromClass.className():fromClass.sqClass.className(),toClass=toArray[i],toClassName=toClass.className?toClass.className():toClass.sqClass.className();console.warn("Unexpected two way class become",fromClassName,toClassName),this.classTable[toArray[i].hash]=fromArray[i]}}this.lastOldObject.nextObject=firstYoungObject;for(var obj=this.firstOldObject;obj;){var mut=mutations[obj.sqClass.oop];mut&&(obj.sqClass=mut,mut.oop<0&&(obj.dirty=!0));var body=obj.pointers;if(body)for(var j=0;j<body.length;j++)(mut=mutations[body[j].oop])&&(body[j]=mut,mut.oop<0&&(obj.dirty=!0));obj=obj.nextObject}return this.lastOldObject.nextObject=null,this.vm.flushMethodCacheAfterBecome(mutations),!0},objectAfter:function(obj){return obj.nextObject||this.nextObjectWithGC("nextObject",obj)},someInstanceOf:function(clsObj){for(var obj=this.firstOldObject;obj;){if(obj.sqClass===clsObj)return obj;obj=obj.nextObject||this.nextObjectWithGCFor(obj,clsObj)}return null},nextInstanceAfter:function(obj){for(var clsObj=obj.sqClass;;){if(!(obj=obj.nextObject||this.nextObjectWithGCFor(obj,clsObj)))return null;if(obj.sqClass===clsObj)return obj}},nextObjectWithGC:function(reason,obj){var limit=obj.oop>0?0:this.youngSpaceCount;return this.newSpaceCount<=limit?null:(obj.oop<0&&this.fullGC(reason),this.partialGC(reason))},nextObjectWithGCFor:function(obj,clsObj){return this.hasNewInstances[clsObj.oop]?this.nextObjectWithGC("instance of "+clsObj.className(),obj):null},allInstancesOf:function(clsObj){for(var obj=this.firstOldObject,result=[];obj;)obj.sqClass===clsObj&&result.push(obj),obj=obj.nextObject||this.nextObjectWithGCFor(obj,clsObj);return result},writeToBuffer:function(){var data=new DataView(new ArrayBuffer(64+this.oldSpaceBytes)),pos=0,writeWord=function(word){data.setUint32(pos,word),pos+=4};for(writeWord(this.formatVersion()),writeWord(64),writeWord(this.oldSpaceBytes),writeWord(this.firstOldObject.addr()),writeWord(this.objectToOop(this.specialObjectsArray)),writeWord(this.lastHash),writeWord(52429400);pos<64;)writeWord(0);for(var obj=this.firstOldObject,n=0;obj;)pos=obj.writeTo(data,pos,this),obj=obj.nextObject,n++;if(pos!==data.byteLength)throw Error("wrong image size");if(n!==this.oldSpaceCount)throw Error("wrong object count");return data.buffer},objectToOop:function(obj){if("number"==typeof obj)return obj<<1|1;if(obj.oop<0)throw Error("temporary oop");return obj.oop},bytesLeft:function(){return this.totalMemory-this.oldSpaceBytes},formatVersion:function(){return this.isSpur?6521:this.hasClosures?6504:6502},segmentVersion:function(){var dnuFirstWord=this.isSpur?"seod":"does";return this.formatVersion()|dnuFirstWord.charCodeAt(0)<<24},storeImageSegment:function(segmentWordArray,outPointerArray,arrayOfRoots){var segment=new DataView(segmentWordArray.words.buffer),pos=0,outPointers=outPointerArray.pointers,outPos=0;segment.setUint32(pos,this.segmentVersion()),pos+=4,this.fullGC("storeImageSegment"),arrayOfRoots.mark=!0;for(var i=0;i<arrayOfRoots.pointers.length;i++)"object"==typeof arrayOfRoots.pointers[i]&&(arrayOfRoots.pointers[i].mark=!0);this.markReachableObjects(),arrayOfRoots.mark=!1;for(i=0;i<arrayOfRoots.pointers.length;i++)"object"==typeof arrayOfRoots.pointers[i]&&(arrayOfRoots.pointers[i].mark=!1);var segmentOops={},todo=[];function addToSegment(object){var oop=segmentOops[object.oop];if(!oop){if(object.mark){if(outPos>=outPointers.length)return 0;oop=2147483652+4*outPos,outPointers[outPos++]=object}else{if(pos+object.totalBytes()>segment.byteLength)return 0;oop=pos+4*(object.snapshotSize().header+1),pos=object.writeTo(segment,pos,this),todo.push(object)}segmentOops[object.oop]=oop}return oop}function cleanUp(){for(var obj=this.firstOldObject;obj;)obj.mark=!1,obj=obj.nextObject;return this.weakObjects=null,!1}for(addToSegment=addToSegment.bind(this),cleanUp=cleanUp.bind(this),addToSegment(arrayOfRoots);todo.length>0;){var obj=todo.shift(),oop=segmentOops[obj.oop],headerSize=obj.snapshotSize().header,objBody=obj.pointers;if(headerSize>0){var classOop=addToSegment(obj.sqClass);if(!classOop)return cleanUp();var headerType=1===headerSize?Squeak.HeaderTypeClass:Squeak.HeaderTypeSizeAndClass;segment.setUint32(oop-8,classOop|headerType)}if(objBody)for(i=0;i<objBody.length;i++){var child=objBody[i];if("object"==typeof child){var childOop=addToSegment(child);if(!childOop)return cleanUp();segment.setUint32(oop+4*i,childOop)}}}obj=segmentWordArray.oop<outPointerArray.oop?segmentWordArray:outPointerArray;for(var removedBytes=0;obj;)obj.oop-=removedBytes,obj===segmentWordArray?(removedBytes+=4*obj.words.length-pos,obj.words=new Uint32Array(obj.words.buffer.slice(0,pos))):obj===outPointerArray&&(removedBytes+=4*(obj.pointers.length-outPos),obj.pointers.length=outPos),obj=obj.nextObject;return this.oldSpaceBytes-=removedBytes,cleanUp(),!0},loadImageSegment:function(segmentWordArray,outPointerArray){if(1===segmentWordArray.words.length)return segmentWordArray.nextObject;var segment=new DataView(segmentWordArray.words.buffer),littleEndian=!1,pos=0,readWord=function(){var word=segment.getUint32(pos,littleEndian);return pos+=4,word},readBits=function(nWords,format){if(format<5){for(var oops=[];oops.length<nWords;)oops.push(readWord());return oops}var bits=new Uint32Array(segment.buffer,pos,nWords);return pos+=4*nWords,bits},version=readWord();if(!0&version&&(littleEndian=!0,pos=0,!0&(version=readWord())))return console.error("image segment format not supported"),null;this.tenureIfYoung(segmentWordArray);for(var prevObj=segmentWordArray,endMarker=prevObj.nextObject,oopOffset=segmentWordArray.oop,oopMap={},rawBits={};pos<segment.byteLength;){var nWords=0,classInt=0,header=readWord();switch(header&Squeak.HeaderTypeMask){case Squeak.HeaderTypeSizeAndClass:nWords=header>>>2,classInt=readWord(),header=readWord();break;case Squeak.HeaderTypeClass:classInt=header-Squeak.HeaderTypeClass,nWords=(header=readWord())>>>2&63;break;case Squeak.HeaderTypeShort:nWords=header>>>2&63,classInt=header>>>12&31;break;case Squeak.HeaderTypeFree:throw Error("Unexpected free block")}nWords--;var oop=pos,format=header>>>8&15,hash=header>>>17&4095,bits=readBits(nWords,format),object=new Squeak.Object;object.initFromImage(oop+oopOffset,classInt,format,hash),prevObj.nextObject=object,this.oldSpaceCount++,prevObj=object,oopMap[oop]=object,rawBits[oop+oopOffset]=bits}object.nextObject=endMarker;for(var i=0;i<outPointerArray.pointers.length;i++)oopMap[2147483652+4*i]=outPointerArray.pointers[i];var compactClasses=this.specialObjectsArray.pointers[Squeak.splOb_CompactClasses].pointers,fakeClsOop=0,compactClassOops=compactClasses.map((function(cls){return oopMap[--fakeClsOop]=cls,fakeClsOop}));segmentWordArray.words=new Uint32Array([segmentWordArray.words[0]]),delete segmentWordArray.uint8Array;var roots=segmentWordArray.nextObject,floatClass=this.specialObjectsArray.pointers[Squeak.splOb_ClassFloat],obj=roots;do{obj.installFromImage(oopMap,rawBits,compactClassOops,floatClass,littleEndian,false),obj=obj.nextObject}while(obj!==endMarker);return roots}},"spur support",{initSpurOverrides:function(){this.registerObject=this.registerObjectSpur,this.writeToBuffer=this.writeToBufferSpur,this.storeImageSegment=this.storeImageSegmentSpur,this.loadImageSegment=this.loadImageSegmentSpur},spurClassTable:function(oopMap,rawBits,classPages,splObjs){for(var classes={},nil=this.firstOldObject,p=0;p<4096;p++){var page=oopMap[classPages[p]];if(page.oop&&(page=rawBits[page.oop]),1024===page.length)for(var i=0;i<1024;i++){var entry=oopMap[page[i]];if(!entry)throw Error("Invalid class table entry (oop "+page[i]+")");if(entry!==nil)classes[classIndex=1024*p+i]=entry}}for(var key in Squeak)if(/^splOb_Class/.test(key)){var classIndex,knownClass=oopMap[rawBits[splObjs.oop][Squeak[key]]];if(knownClass!==nil)(classIndex=knownClass.hash)>0&&classIndex<1024&&(classes[classIndex]=knownClass)}return classes[3]=classes[1],this.classTable=classes,this.classTableIndex=1024,classes},enterIntoClassTable:function(newClass){for(var index=this.classTableIndex,table=this.classTable;index<=4194303;){if(!table[index])return table[index]=newClass,newClass.hash=index,this.classTableIndex=index,index;index++}return console.error("class table full?"),null},initImmediateClasses:function(oopMap,rawBits,splObs){var special=rawBits[splObs.oop];this.characterClass=oopMap[special[Squeak.splOb_ClassCharacter]],this.floatClass=oopMap[special[Squeak.splOb_ClassFloat]],this.largePosIntClass=oopMap[special[Squeak.splOb_ClassLargePositiveInteger]],this.largeNegIntClass=oopMap[special[Squeak.splOb_ClassLargeNegativeInteger]],this.characterClass.classInstProto("Character"),this.floatClass.classInstProto("Float"),this.largePosIntClass.classInstProto("LargePositiveInteger"),this.largeNegIntClass.classInstProto("LargeNegativeInteger"),this.characterTable={}},getCharacter:function(unicode){var char=this.characterTable[unicode];return char||((char=new this.characterClass.instProto).initInstanceOfChar(this.characterClass,unicode),this.characterTable[unicode]=char),char},instantiateFloat:function(bits){var float=new this.floatClass.instProto;return this.registerObjectSpur(float),this.hasNewInstances[this.floatClass.oop]=!0,float.initInstanceOfFloat(this.floatClass,bits),float},instantiateLargeFromSmall:function(hi,lo){lo=hi<<29|lo>>>3;var negative=(hi>>=3)<0;negative&&(hi=-hi,0!==(lo=-lo)&&hi--);var size=0===hi?4:hi<=255?5:hi<=65535?6:hi<=16777215?7:8,largeIntClass=negative?this.largeNegIntClass:this.largePosIntClass,largeInt=new largeIntClass.instProto;this.registerObjectSpur(largeInt),this.hasNewInstances[largeIntClass.oop]=!0,largeInt.initInstanceOfLargeInt(largeIntClass,size);for(var bytes=largeInt.bytes,i=0;i<4;i++)bytes[i]=255&lo,lo>>=8;for(i=4;i<size;i++)bytes[i]=255&hi,hi>>=8;return largeInt},ensureClassesInTable:function(){for(var obj=this.firstOldObject,maxIndex=1024;obj;){var cls=obj.sqClass;if(0===cls.hash&&this.enterIntoClassTable(cls),cls.hash>maxIndex&&(maxIndex=cls.hash),this.classTable[cls.hash]!==cls)throw Error("Class not in class table");obj=obj.nextObject}return 1+(maxIndex>>10)},classTableBytes:function(numPages){return 4*(4108+1028*numPages)},writeFreeLists:function(data,pos,littleEndian,oopOffset){return data.setUint32(pos,167772178,littleEndian),pos+=4,data.setUint32(pos,536870912,littleEndian),pos+=4,pos+=128},writeClassTable:function(data,pos,littleEndian,objToOop,numPages){data.setUint32(pos,4104,littleEndian),pos+=4,data.setUint32(pos,4278190080,littleEndian),pos+=4,data.setUint32(pos,33554448,littleEndian),pos+=4,data.setUint32(pos,4278190080,littleEndian),pos+=4;for(var p=0;p<numPages;p++)data.setUint32(pos,16624+4112*p,littleEndian),pos+=4;pos+=4*(4104-numPages);var classID=0;for(p=0;p<numPages;p++){data.setUint32(pos,1024,littleEndian),pos+=4,data.setUint32(pos,4278190080,littleEndian),pos+=4,data.setUint32(pos,33554448,littleEndian),pos+=4,data.setUint32(pos,4278190080,littleEndian),pos+=4;for(var i=0;i<1024;i++){var classObj=this.classTable[classID];if(classObj&&classObj.pointers){if(!classObj.hash)throw Error("class without id");(classObj.hash!==classID&&classID>=32||classObj.oop<0)&&(console.warn("freeing class index "+classID+" "+classObj.className()),classObj=null,delete this.classTable[classID])}classObj&&data.setUint32(pos,objToOop(classObj),littleEndian),pos+=4,classID++}}return pos},writeToBufferSpur:function(){var numPages=this.ensureClassesInTable(),hiddenSize=136+this.classTableBytes(numPages),data=new DataView(new ArrayBuffer(64+hiddenSize+this.oldSpaceBytes+16)),start=Date.now(),pos=0;function writeWord(word){data.setUint32(pos,word,true),pos+=4}function objToOop(obj){if("number"==typeof obj)return obj<<1|1;if(7===obj._format){if(obj.hash!==obj.oop>>2||2!=(3&obj.oop))throw Error("Bad immediate char");return obj.oop}if(obj.oop<0)throw Error("temporary oop");return obj.oop<48?obj.oop:obj.oop+hiddenSize}for(writeWord(this.formatVersion()),writeWord(64),writeWord(hiddenSize+this.oldSpaceBytes+16),writeWord(this.firstOldObject.addr()),writeWord(objToOop(this.specialObjectsArray)),this.savedHeaderWords.forEach(writeWord),writeWord(hiddenSize+this.oldSpaceBytes+16);pos<64;)writeWord(0);var obj=this.firstOldObject,n=0;for(pos=obj.writeTo(data,pos,true,objToOop),obj=obj.nextObject,n++,pos=obj.writeTo(data,pos,true,objToOop),obj=obj.nextObject,n++,pos=obj.writeTo(data,pos,true,objToOop),obj=obj.nextObject,n++,pos=this.writeFreeLists(data,pos,true,objToOop),pos=this.writeClassTable(data,pos,true,objToOop,numPages);obj;)pos=obj.writeTo(data,pos,true,objToOop),obj=obj.nextObject,n++;if(writeWord(1241513987),writeWord(8388608),writeWord(0),writeWord(0),pos!==data.byteLength)throw Error("wrong image size");if(n!==this.oldSpaceCount)throw Error("wrong object count");var time=Date.now()-start;return console.log("Wrote "+n+" objects in "+time+" ms, image size "+pos+" bytes"),data.buffer},storeImageSegmentSpur:function(segmentWordArray,outPointerArray,arrayOfRoots){return this.vm.warnOnce("not implemented for Spur yet: primitive 98 (primitiveStoreImageSegment)"),!1},loadImageSegmentSpur:function(segmentWordArray,outPointerArray){return this.vm.warnOnce("not implemented for Spur yet: primitive 99 (primitiveLoadImageSegment)"),null}})),vm_image}var vm_interpreter={},hasRequiredVm_interpreter;function requireVm_interpreter(){return hasRequiredVm_interpreter||(hasRequiredVm_interpreter=1,Object.subclass("Squeak.Interpreter","initialization",{initialize:function(image,display,options){console.log("squeak: initializing interpreter "+Squeak.vmVersion+" ("+Squeak.vmDate+")"),this.Squeak=Squeak,this.image=image,this.image.vm=this,this.options=options||{},this.primHandler=new Squeak.Primitives(this,display),this.loadImageState(),this.initVMState(),this.loadInitialContext(),this.hackImage(),this.initCompiler(),console.log("squeak: ready")},loadImageState:function(){this.specialObjects=this.image.specialObjectsArray.pointers,this.specialSelectors=this.specialObjects[Squeak.splOb_SpecialSelectors].pointers,this.nilObj=this.specialObjects[Squeak.splOb_NilObject],this.falseObj=this.specialObjects[Squeak.splOb_FalseObject],this.trueObj=this.specialObjects[Squeak.splOb_TrueObject],this.hasClosures=this.image.hasClosures,this.getGlobals=this.globalsGetter(),this.hasClosures||this.findMethod("UnixFileDirectory class>>pathNameDelimiter")||(this.primHandler.emulateMac=!0),6501==this.image.version&&(this.primHandler.reverseDisplay=!0)},initVMState:function(){this.byteCodeCount=0,this.sendCount=0,this.interruptCheckCounter=0,this.interruptCheckCounterFeedBackReset=1e3,this.interruptChecksEveryNms=3,this.lowSpaceThreshold=1e6,this.signalLowSpace=!1,this.nextPollTick=0,this.nextWakeupTick=0,this.lastTick=0,this.interruptKeycode=2094,this.interruptPending=!1,this.pendingFinalizationSignals=0,this.freeContexts=this.nilObj,this.freeLargeContexts=this.nilObj,this.reclaimableContextCount=0,this.nRecycledContexts=0,this.nAllocatedContexts=0,this.methodCacheSize=1024,this.methodCacheMask=this.methodCacheSize-1,this.methodCacheRandomish=0,this.methodCache=[];for(var i=0;i<this.methodCacheSize;i++)this.methodCache[i]={lkupClass:null,selector:null,method:null,primIndex:0,argCount:0,mClass:null};this.breakOutOfInterpreter=!1,this.breakOutTick=0,this.breakOnMethod=null,this.breakOnNewMethod=!1,this.breakOnMessageNotUnderstood=!1,this.breakOnContextChanged=!1,this.breakOnContextReturned=null,this.messages={},this.startupTime=Date.now()},loadInitialContext:function(){var proc=this.specialObjects[Squeak.splOb_SchedulerAssociation].pointers[Squeak.Assn_value].pointers[Squeak.ProcSched_activeProcess];this.activeContext=proc.pointers[Squeak.Proc_suspendedContext],this.activeContext.dirty=!0,this.fetchContextRegisters(this.activeContext),this.reclaimableContextCount=0},globalsGetter:function(){var smalltalk=this.specialObjects[Squeak.splOb_SmalltalkDictionary],smalltalkClass=smalltalk.sqClass.className();if("Association"===smalltalkClass&&(smalltalkClass=(smalltalk=smalltalk.pointers[1]).sqClass.className()),"SystemDictionary"===smalltalkClass)return function(){return smalltalk.pointers[1].pointers};if("SmalltalkImage"===smalltalkClass){var globals=smalltalk.pointers[0],globalsClass=globals.sqClass.className();if("SystemDictionary"===globalsClass)return function(){return globals.pointers[1].pointers};if("Environment"===globalsClass)return function(){return globals.pointers[2].pointers[1].pointers}}return console.warn("cannot find global dict"),function(){return[]}},initCompiler:function(){if(!Squeak.Compiler)return console.warn("Squeak.Compiler not loaded, using interpreter only");try{if(42!==new Function("return 42")())return console.warn("function constructor not working, disabling JIT")}catch(e){return console.warn("disabling JIT: "+e)}var kObjPerSec=this.image.oldSpaceCount/(this.startupTime-this.image.startupTime);if(kObjPerSec<10)return console.warn("Slow machine detected (loaded "+(1e3*kObjPerSec|0)+" objects/sec), using interpreter only");try{console.log("squeak: initializing JIT compiler");var compiler=new Squeak.Compiler(this);compiler.compile&&(this.compiler=compiler)}catch(e){console.warn("Compiler: "+e)}this.compiler||console.warn("SqueakJS will be running in interpreter mode only (slow)")},hackImage:function(){this.method.methodSignFlag(),[].forEach((function(each){try{var m=each.enabled&&this.findMethod(each.method);if(m){var prim=each.primitive,byte=each.bytecode,lit=each.literal,hacked=!0;prim?m.pointers[0]|=prim:byte&&m.bytes[byte.pc]===byte.old?m.bytes[byte.pc]=byte.hack:byte&&m.bytes[byte.pc]===byte.hack?hacked=!1:lit&&m.pointers[lit.index].pointers[1]===lit.old?m.pointers[lit.index].pointers[1]=lit.hack:lit&&m.pointers[lit.index].pointers[1]===lit.hack?hacked=!1:(hacked=!1,console.warn("Not hacking "+each.method)),hacked&&console.warn("Hacking "+each.method)}}catch(error){console.error("Failed to hack "+each.method+" with error "+error)}}),this)}},"interpreting",{interpretOne:function(singleStep){if(!this.method.compiled){if(this.method.methodSignFlag())return this.interpretOneSistaWithExtensions(singleStep,0,0);var b,b2,Squeak=this.Squeak;switch(this.byteCodeCount++,b=this.nextByte()){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:return void this.push(this.receiver.pointers[15&b]);case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:return void this.push(this.homeContext.pointers[Squeak.Context_tempFrameStart+(15&b)]);case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 58:case 59:case 60:case 61:case 62:case 63:return void this.push(this.method.methodGetLiteral(31&b));case 64:case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 91:case 92:case 93:case 94:case 95:return void this.push(this.method.methodGetLiteral(31&b).pointers[Squeak.Assn_value]);case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:return this.receiver.dirty=!0,void(this.receiver.pointers[7&b]=this.pop());case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:return void(this.homeContext.pointers[Squeak.Context_tempFrameStart+(7&b)]=this.pop());case 112:return void this.push(this.receiver);case 113:return void this.push(this.trueObj);case 114:return void this.push(this.falseObj);case 115:return void this.push(this.nilObj);case 116:return void this.push(-1);case 117:return void this.push(0);case 118:return void this.push(1);case 119:return void this.push(2);case 120:return void this.doReturn(this.receiver);case 121:return void this.doReturn(this.trueObj);case 122:return void this.doReturn(this.falseObj);case 123:return void this.doReturn(this.nilObj);case 124:return void this.doReturn(this.pop());case 125:return void this.doReturn(this.pop(),this.activeContext.pointers[Squeak.BlockContext_caller]);case 126:case 127:return void this.nono();case 128:return void this.extendedPush(this.nextByte());case 129:return void this.extendedStore(this.nextByte());case 130:return void this.extendedStorePop(this.nextByte());case 131:return b2=this.nextByte(),void this.send(this.method.methodGetSelector(31&b2),b2>>5,!1);case 132:return void this.doubleExtendedDoAnything(this.nextByte());case 133:return b2=this.nextByte(),void this.send(this.method.methodGetSelector(31&b2),b2>>5,!0);case 134:return b2=this.nextByte(),void this.send(this.method.methodGetSelector(63&b2),b2>>6,!1);case 135:return void this.pop();case 136:return void this.push(this.top());case 137:return void this.push(this.exportThisContext());case 138:return void this.pushNewArray(this.nextByte());case 139:return void this.callPrimBytecode(129);case 140:return b2=this.nextByte(),void this.push(this.homeContext.pointers[Squeak.Context_tempFrameStart+this.nextByte()].pointers[b2]);case 141:return b2=this.nextByte(),(vec=this.homeContext.pointers[Squeak.Context_tempFrameStart+this.nextByte()]).pointers[b2]=this.top(),void(vec.dirty=!0);case 142:var vec;return b2=this.nextByte(),(vec=this.homeContext.pointers[Squeak.Context_tempFrameStart+this.nextByte()]).pointers[b2]=this.pop(),void(vec.dirty=!0);case 143:return void this.pushClosureCopy();case 144:case 145:case 146:case 147:case 148:case 149:case 150:case 151:return void(this.pc+=1+(7&b));case 152:case 153:case 154:case 155:case 156:case 157:case 158:case 159:return void this.jumpIfFalse(1+(7&b));case 160:case 161:case 162:case 163:case 164:case 165:case 166:case 167:return b2=this.nextByte(),this.pc+=256*((7&b)-4)+b2,void((7&b)<4&&this.interruptCheckCounter--<=0&&this.checkForInterrupts());case 168:case 169:case 170:case 171:return void this.jumpIfTrue(256*(3&b)+this.nextByte());case 172:case 173:case 174:case 175:return void this.jumpIfFalse(256*(3&b)+this.nextByte());case 176:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)+this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 177:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)-this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 178:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)<this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 179:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)>this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 180:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)<=this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 181:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)>=this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 182:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)===this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 183:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)!==this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 184:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)*this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 185:return this.success=!0,void(this.pop2AndPushIntResult(this.quickDivide(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&b));case 186:return this.success=!0,void(this.pop2AndPushIntResult(this.mod(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&b));case 187:return this.success=!0,void(this.primHandler.primitiveMakePoint(1,!0)||this.sendSpecial(15&b));case 188:return this.success=!0,void(this.pop2AndPushIntResult(this.safeShift(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&b));case 189:return this.success=!0,void(this.pop2AndPushIntResult(this.div(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&b));case 190:return this.success=!0,void(this.pop2AndPushIntResult(this.stackInteger(1)&this.stackInteger(0))||this.sendSpecial(15&b));case 191:return this.success=!0,void(this.pop2AndPushIntResult(this.stackInteger(1)|this.stackInteger(0))||this.sendSpecial(15&b));case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:case 200:case 201:case 202:case 203:case 204:case 205:case 206:case 207:return void(this.primHandler.quickSendOther(this.receiver,15&b)||this.sendSpecial(16+(15&b)));case 208:case 209:case 210:case 211:case 212:case 213:case 214:case 215:case 216:case 217:case 218:case 219:case 220:case 221:case 222:case 223:return void this.send(this.method.methodGetSelector(15&b),0,!1);case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:return void this.send(this.method.methodGetSelector(15&b),1,!1);case 240:case 241:case 242:case 243:case 244:case 245:case 246:case 247:case 248:case 249:case 250:case 251:case 252:case 253:case 254:case 255:return void this.send(this.method.methodGetSelector(15&b),2,!1)}throw Error("not a bytecode: "+b)}if(singleStep){if(!this.compiler.enableSingleStepping(this.method))return this.method.compiled=null,this.interpretOne(singleStep);this.breakNow()}this.method.compiled(this)},interpretOneSistaWithExtensions:function(singleStep,extA,extB){var b,b2,Squeak=this.Squeak;switch(this.byteCodeCount++,b=this.nextByte()){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:return void this.push(this.receiver.pointers[15&b]);case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:return void this.push(this.method.methodGetLiteral(15&b).pointers[Squeak.Assn_value]);case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 58:case 59:case 60:case 61:case 62:case 63:return void this.push(this.method.methodGetLiteral(31&b));case 64:case 65:case 66:case 67:case 68:case 69:case 70:case 71:return void this.push(this.homeContext.pointers[Squeak.Context_tempFrameStart+(7&b)]);case 72:case 73:case 74:case 75:return void this.push(this.homeContext.pointers[Squeak.Context_tempFrameStart+(3&b)+8]);case 76:return void this.push(this.receiver);case 77:return void this.push(this.trueObj);case 78:return void this.push(this.falseObj);case 79:return void this.push(this.nilObj);case 80:return void this.push(0);case 81:return void this.push(1);case 82:return 0==extB?void this.push(this.exportThisContext()):void this.nono();case 83:return void this.push(this.top());case 84:case 85:case 86:case 87:case 217:case 218:case 219:case 220:case 221:case 222:case 223:case 230:case 236:case 246:case 247:case 254:case 255:return void this.nono();case 88:return void this.doReturn(this.receiver);case 89:return void this.doReturn(this.trueObj);case 90:return void this.doReturn(this.falseObj);case 91:return void this.doReturn(this.nilObj);case 92:return void this.doReturn(this.pop());case 93:return void this.doReturn(this.nilObj,this.activeContext.pointers[Squeak.BlockContext_caller]);case 94:return 0==extA?void this.doReturn(this.pop(),this.activeContext.pointers[Squeak.BlockContext_caller]):void this.nono();case 95:return;case 96:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)+this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 97:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)-this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 98:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)<this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 99:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)>this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 100:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)<=this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 101:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)>=this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 102:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)===this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 103:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)!==this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 104:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)*this.stackIntOrFloat(0))||this.sendSpecial(15&b));case 105:return this.success=!0,void(this.pop2AndPushIntResult(this.quickDivide(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&b));case 106:return this.success=!0,void(this.pop2AndPushIntResult(this.mod(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&b));case 107:return this.success=!0,void(this.primHandler.primitiveMakePoint(1,!0)||this.sendSpecial(15&b));case 108:return this.success=!0,void(this.pop2AndPushIntResult(this.safeShift(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&b));case 109:return this.success=!0,void(this.pop2AndPushIntResult(this.div(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&b));case 110:return this.success=!0,void(this.pop2AndPushIntResult(this.stackInteger(1)&this.stackInteger(0))||this.sendSpecial(15&b));case 111:return this.success=!0,void(this.pop2AndPushIntResult(this.stackInteger(1)|this.stackInteger(0))||this.sendSpecial(15&b));case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:case 123:case 124:case 125:case 126:case 127:return void(this.primHandler.quickSendOther(this.receiver,15&b)||this.sendSpecial(16+(15&b)));case 128:case 129:case 130:case 131:case 132:case 133:case 134:case 135:case 136:case 137:case 138:case 139:case 140:case 141:case 142:case 143:return void this.send(this.method.methodGetSelector(15&b),0,!1);case 144:case 145:case 146:case 147:case 148:case 149:case 150:case 151:case 152:case 153:case 154:case 155:case 156:case 157:case 158:case 159:return void this.send(this.method.methodGetSelector(15&b),1,!1);case 160:case 161:case 162:case 163:case 164:case 165:case 166:case 167:case 168:case 169:case 170:case 171:case 172:case 173:case 174:case 175:return void this.send(this.method.methodGetSelector(15&b),2,!1);case 176:case 177:case 178:case 179:case 180:case 181:case 182:case 183:return void(this.pc+=1+(7&b));case 184:case 185:case 186:case 187:case 188:case 189:case 190:case 191:return void this.jumpIfTrue(1+(7&b));case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:return void this.jumpIfFalse(1+(7&b));case 200:case 201:case 202:case 203:case 204:case 205:case 206:case 207:return this.receiver.dirty=!0,void(this.receiver.pointers[7&b]=this.pop());case 208:case 209:case 210:case 211:case 212:case 213:case 214:case 215:return void(this.homeContext.pointers[Squeak.Context_tempFrameStart+(7&b)]=this.pop());case 216:return void this.pop();case 224:return b2=this.nextByte(),void this.interpretOneSistaWithExtensions(singleStep,(extA<<8)+b2,extB);case 225:return b2=this.nextByte(),void this.interpretOneSistaWithExtensions(singleStep,extA,(extB<<8)+(b2<128?b2:b2-256));case 226:return b2=this.nextByte(),void this.push(this.receiver.pointers[b2+(extA<<8)]);case 227:return b2=this.nextByte(),void this.push(this.method.methodGetLiteral(b2+(extA<<8)).pointers[Squeak.Assn_value]);case 228:return b2=this.nextByte(),void this.push(this.method.methodGetLiteral(b2+(extA<<8)));case 229:return b2=this.nextByte(),void this.push(this.homeContext.pointers[Squeak.Context_tempFrameStart+b2]);case 231:return void this.pushNewArray(this.nextByte());case 232:return b2=this.nextByte(),void this.push(b2+(extB<<8));case 233:return b2=this.nextByte(),void this.push(this.image.getCharacter(b2+(extB<<8)));case 234:return b2=this.nextByte(),void this.send(this.method.methodGetSelector((b2>>3)+(extA<<5)),(7&b2)+(extB<<3),!1);case 235:b2=this.nextByte();var literal=this.method.methodGetSelector((b2>>3)+(extA<<5));return extB>=64?void this.sendSuperDirected(literal,(7&b2)+((63&extB)<<3)):void this.send(literal,(7&b2)+(extB<<3),!0);case 237:var offset=this.nextByte()+(extB<<8);return this.pc+=offset,void(offset<0&&this.interruptCheckCounter--<=0&&this.checkForInterrupts());case 238:return void this.jumpIfTrue(this.nextByte()+(extB<<8));case 239:return void this.jumpIfFalse(this.nextByte()+(extB<<8));case 240:return this.receiver.dirty=!0,void(this.receiver.pointers[this.nextByte()+(extA<<8)]=this.pop());case 241:return(assoc=this.method.methodGetLiteral(this.nextByte()+(extA<<8))).dirty=!0,void(assoc.pointers[Squeak.Assn_value]=this.pop());case 242:return void(this.homeContext.pointers[Squeak.Context_tempFrameStart+this.nextByte()]=this.pop());case 243:return this.receiver.dirty=!0,void(this.receiver.pointers[this.nextByte()+(extA<<8)]=this.top());case 244:var assoc;return(assoc=this.method.methodGetLiteral(this.nextByte()+(extA<<8))).dirty=!0,void(assoc.pointers[Squeak.Assn_value]=this.top());case 245:return void(this.homeContext.pointers[Squeak.Context_tempFrameStart+this.nextByte()]=this.top());case 248:return void this.callPrimBytecode(245);case 249:return void this.pushFullClosure(extA);case 250:return void this.pushClosureCopyExtended(extA,extB);case 251:return b2=this.nextByte(),void this.push(this.homeContext.pointers[Squeak.Context_tempFrameStart+this.nextByte()].pointers[b2]);case 252:return b2=this.nextByte(),(vec=this.homeContext.pointers[Squeak.Context_tempFrameStart+this.nextByte()]).pointers[b2]=this.top(),void(vec.dirty=!0);case 253:var vec;return b2=this.nextByte(),(vec=this.homeContext.pointers[Squeak.Context_tempFrameStart+this.nextByte()]).pointers[b2]=this.pop(),void(vec.dirty=!0)}throw Error("not a bytecode: "+b)},interpret:function(forMilliseconds,thenDo){if(this.frozen)return"frozen";for(this.isIdle=!1,this.breakOutOfInterpreter=!1,this.breakAfter(forMilliseconds||500);!1===this.breakOutOfInterpreter;)this.method.compiled?this.method.compiled(this):this.interpretOne();if("function"==typeof this.breakOutOfInterpreter)return this.breakOutOfInterpreter(thenDo);var result="break"==this.breakOutOfInterpreter?"break":this.isIdle?this.nextWakeupTick?Math.max(1,this.nextWakeupTick-this.primHandler.millisecondClockValue()):"sleep":0;return thenDo&&thenDo(result),result},goIdle:function(){var hadTimer=0!==this.nextWakeupTick;this.forceInterruptCheck(),this.checkForInterrupts();var hasTimer=0!==this.nextWakeupTick;this.isIdle=hasTimer||!hadTimer,this.breakOut()},freeze:function(frozenDo){var continueFunc;this.frozen=!0,this.breakOutOfInterpreter=function(thenDo){if(!thenDo)throw Error("need function to restart interpreter");return continueFunc=thenDo,"frozen"}.bind(this);var unfreeze=function(){if(this.frozen=!1,!continueFunc)throw Error("no continue function");continueFunc(0)}.bind(this);return frozenDo&&self.setTimeout((function(){frozenDo(unfreeze)}),0),unfreeze},breakOut:function(){this.breakOutOfInterpreter=this.breakOutOfInterpreter||!0},nextByte:function(){return this.method.bytes[this.pc++]},nono:function(){throw Error("Oh No!")},forceInterruptCheck:function(){this.interruptCheckCounter=-1e3},checkForInterrupts:function(){var now=this.primHandler.millisecondClockValue();(now<this.lastTick&&(this.nextPollTick=now+(this.nextPollTick-this.lastTick),this.breakOutTick=now+(this.breakOutTick-this.lastTick),0!==this.nextWakeupTick&&(this.nextWakeupTick=now+(this.nextWakeupTick-this.lastTick))),this.interruptCheckCounter>-100&&(now-this.lastTick<this.interruptChecksEveryNms?this.interruptCheckCounterFeedBackReset+=10:this.interruptCheckCounterFeedBackReset<=1e3?this.interruptCheckCounterFeedBackReset=1e3:this.interruptCheckCounterFeedBackReset-=12),this.interruptCheckCounter=this.interruptCheckCounterFeedBackReset,this.lastTick=now,this.signalLowSpace)&&(this.signalLowSpace=!1,(sema=this.specialObjects[Squeak.splOb_TheLowSpaceSemaphore]).isNil||this.primHandler.synchronousSignal(sema));this.interruptPending&&(this.interruptPending=!1,(sema=this.specialObjects[Squeak.splOb_TheInterruptSemaphore]).isNil||this.primHandler.synchronousSignal(sema));0!==this.nextWakeupTick&&now>=this.nextWakeupTick&&(this.nextWakeupTick=0,(sema=this.specialObjects[Squeak.splOb_TheTimerSemaphore]).isNil||this.primHandler.synchronousSignal(sema));if(this.pendingFinalizationSignals>0){var sema=this.specialObjects[Squeak.splOb_TheFinalizationSemaphore];this.pendingFinalizationSignals=0,sema.isNil||this.primHandler.synchronousSignal(sema)}this.primHandler.semaphoresToSignal.length>0&&this.primHandler.signalExternalSemaphores(),this.method.compiled||this.compileIfPossible(this.method),now>=this.breakOutTick&&this.breakOut()},extendedPush:function(nextByte){var lobits=63&nextByte;switch(nextByte>>6){case 0:this.push(this.receiver.pointers[lobits]);break;case 1:this.push(this.homeContext.pointers[Squeak.Context_tempFrameStart+lobits]);break;case 2:this.push(this.method.methodGetLiteral(lobits));break;case 3:this.push(this.method.methodGetLiteral(lobits).pointers[Squeak.Assn_value])}},extendedStore:function(nextByte){var lobits=63&nextByte;switch(nextByte>>6){case 0:this.receiver.dirty=!0,this.receiver.pointers[lobits]=this.top();break;case 1:this.homeContext.pointers[Squeak.Context_tempFrameStart+lobits]=this.top();break;case 2:this.nono();break;case 3:var assoc=this.method.methodGetLiteral(lobits);assoc.dirty=!0,assoc.pointers[Squeak.Assn_value]=this.top()}},extendedStorePop:function(nextByte){var lobits=63&nextByte;switch(nextByte>>6){case 0:this.receiver.dirty=!0,this.receiver.pointers[lobits]=this.pop();break;case 1:this.homeContext.pointers[Squeak.Context_tempFrameStart+lobits]=this.pop();break;case 2:this.nono();break;case 3:var assoc=this.method.methodGetLiteral(lobits);assoc.dirty=!0,assoc.pointers[Squeak.Assn_value]=this.pop()}},doubleExtendedDoAnything:function(byte2){var byte3=this.nextByte();switch(byte2>>5){case 0:this.send(this.method.methodGetSelector(byte3),31&byte2,!1);break;case 1:this.send(this.method.methodGetSelector(byte3),31&byte2,!0);break;case 2:this.push(this.receiver.pointers[byte3]);break;case 3:this.push(this.method.methodGetLiteral(byte3));break;case 4:this.push(this.method.methodGetLiteral(byte3).pointers[Squeak.Assn_value]);break;case 5:this.receiver.dirty=!0,this.receiver.pointers[byte3]=this.top();break;case 6:this.receiver.dirty=!0,this.receiver.pointers[byte3]=this.pop();break;case 7:var assoc=this.method.methodGetLiteral(byte3);assoc.dirty=!0,assoc.pointers[Squeak.Assn_value]=this.top()}},jumpIfTrue:function(delta){var top=this.pop();top.isTrue?this.pc+=delta:top.isFalse||(this.push(top),this.send(this.specialObjects[Squeak.splOb_SelectorMustBeBoolean],0,!1))},jumpIfFalse:function(delta){var top=this.pop();top.isFalse?this.pc+=delta:top.isTrue||(this.push(top),this.send(this.specialObjects[Squeak.splOb_SelectorMustBeBoolean],0,!1))},sendSpecial:function(lobits){this.send(this.specialSelectors[2*lobits],this.specialSelectors[2*lobits+1],!1)},callPrimBytecode:function(extendedStoreBytecode){this.pc+=2,this.primFailCode&&(this.method.bytes[this.pc]===extendedStoreBytecode&&this.stackTopPut(this.getErrorObjectFromPrimFailCode()),this.primFailCode=0)},getErrorObjectFromPrimFailCode:function(){var primErrTable=this.specialObjects[Squeak.splOb_PrimErrTableIndex];if(primErrTable&&primErrTable.pointers){var errorObject=primErrTable.pointers[this.primFailCode-1];if(errorObject)return errorObject}return this.primFailCode}},"closures",{pushNewArray:function(nextByte){var popValues=nextByte>127,count=127&nextByte,array=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassArray],count);if(popValues){for(var i=0;i<count;i++)array.pointers[i]=this.stackValue(count-i-1);this.popN(count)}this.push(array)},pushClosureCopy:function(){var numArgsNumCopied=this.nextByte(),numArgs=15&numArgsNumCopied,numCopied=numArgsNumCopied>>4,blockSize=256*this.nextByte()+this.nextByte(),initialPC=this.encodeSqueakPC(this.pc,this.method),closure=this.newClosure(numArgs,initialPC,numCopied);if(closure.pointers[Squeak.Closure_outerContext]=this.activeContext,this.reclaimableContextCount=0,numCopied>0){for(var i=0;i<numCopied;i++)closure.pointers[Squeak.Closure_firstCopiedValue+i]=this.stackValue(numCopied-i-1);this.popN(numCopied)}this.pc+=blockSize,this.push(closure)},pushClosureCopyExtended:function(extA,extB){var byteA=this.nextByte(),byteB=this.nextByte(),numArgs=(7&byteA)+8*this.mod(extA,16),numCopied=(byteA>>3&7)+8*this.div(extA,16),blockSize=byteB+(extB<<8),initialPC=this.encodeSqueakPC(this.pc,this.method),closure=this.newClosure(numArgs,initialPC,numCopied);if(closure.pointers[Squeak.Closure_outerContext]=this.activeContext,this.reclaimableContextCount=0,numCopied>0){for(var i=0;i<numCopied;i++)closure.pointers[Squeak.Closure_firstCopiedValue+i]=this.stackValue(numCopied-i-1);this.popN(numCopied)}this.pc+=blockSize,this.push(closure)},pushFullClosure:function(extA){var context,byteA=this.nextByte(),byteB=this.nextByte(),literalIndex=byteA+(extA<<8),numCopied=63&byteB;context=1==(byteB>>6&1)?this.vm.nilObj:this.activeContext;var compiledBlock=this.method.methodGetLiteral(literalIndex),closure=this.newFullClosure(context,numCopied,compiledBlock);if(1==(byteB>>7&1))throw Error("on-stack receiver not yet supported");if(closure.pointers[Squeak.ClosureFull_receiver]=this.receiver,this.reclaimableContextCount=0,numCopied>0){for(var i=0;i<numCopied;i++)closure.pointers[Squeak.ClosureFull_firstCopiedValue+i]=this.stackValue(numCopied-i-1);this.popN(numCopied)}this.push(closure)},newClosure:function(numArgs,initialPC,numCopied){var closure=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassBlockClosure],numCopied);return closure.pointers[Squeak.Closure_startpc]=initialPC,closure.pointers[Squeak.Closure_numArgs]=numArgs,closure},newFullClosure:function(context,numCopied,compiledBlock){var closure=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassFullBlockClosure],numCopied);return closure.pointers[Squeak.Closure_outerContext]=context,closure.pointers[Squeak.ClosureFull_method]=compiledBlock,closure.pointers[Squeak.Closure_numArgs]=compiledBlock.methodNumArgs(),closure}},"sending",{send:function(selector,argCount,doSuper){var lookupClass,newRcvr=this.stackValue(argCount);lookupClass=doSuper?(lookupClass=this.method.methodClassForSuper()).pointers[Squeak.Class_superclass]:this.getClass(newRcvr);var entry=this.findSelectorInClass(selector,argCount,lookupClass);entry.primIndex&&(this.verifyAtSelector=selector,this.verifyAtClass=lookupClass),this.executeNewMethod(newRcvr,entry.method,entry.argCount,entry.primIndex,entry.mClass,selector)},sendSuperDirected:function(selector,argCount){var lookupClass=this.pop().pointers[Squeak.Class_superclass],newRcvr=this.stackValue(argCount),entry=this.findSelectorInClass(selector,argCount,lookupClass);entry.primIndex&&(this.verifyAtSelector=selector,this.verifyAtClass=lookupClass),this.executeNewMethod(newRcvr,entry.method,entry.argCount,entry.primIndex,entry.mClass,selector)},sendAsPrimitiveFailure:function(rcvr,method,argCount){this.executeNewMethod(rcvr,method,argCount,0)},findSelectorInClass:function(selector,trueArgCount,startingClass,argCount=trueArgCount){this.currentSelector=selector;var cacheEntry=this.findMethodCacheEntry(selector,startingClass);if(cacheEntry.method)return cacheEntry;for(var mDict,currentClass=startingClass;!currentClass.isNil;){if((mDict=currentClass.pointers[Squeak.Class_mdict]).isNil){var cantInterpSel=this.specialObjects[Squeak.splOb_SelectorCannotInterpret],cantInterpMsg=this.createActualMessage(selector,trueArgCount,startingClass);return this.popNandPush(argCount+1,cantInterpMsg),this.findSelectorInClass(cantInterpSel,1,currentClass.superclass())}var newMethod=this.lookupSelectorInDict(mDict,selector);if(!newMethod.isNil)return cacheEntry.method=newMethod,newMethod.isMethod()?(cacheEntry.primIndex=newMethod.methodPrimitiveIndex(),cacheEntry.argCount=newMethod.methodNumArgs()):(cacheEntry.primIndex=576,cacheEntry.argCount=trueArgCount),cacheEntry.mClass=currentClass,cacheEntry;currentClass=currentClass.superclass()}var dnuSel=this.specialObjects[Squeak.splOb_SelectorDoesNotUnderstand];if(selector===dnuSel)throw Error("Recursive not understood error encountered");var dnuMsg=this.createActualMessage(selector,trueArgCount,startingClass);if(this.breakOnMessageNotUnderstood){var receiver=this.stackValue(argCount);this.breakNow("Message not understood: "+receiver+" "+startingClass.className()+">>"+selector.bytesAsString())}return this.popNandPush(argCount,dnuMsg),this.findSelectorInClass(dnuSel,1,startingClass)},lookupSelectorInDict:function(mDict,messageSelector){for(var dictSize=mDict.pointersSize(),index=(dictSize-Squeak.MethodDict_selectorStart-1&messageSelector.hash)+Squeak.MethodDict_selectorStart,hasWrapped=!1;;){var nextSelector=mDict.pointers[index];if(nextSelector===messageSelector)return mDict.pointers[Squeak.MethodDict_array].pointers[index-Squeak.MethodDict_selectorStart];if(nextSelector.isNil)return this.nilObj;if(++index===dictSize){if(hasWrapped)return this.nilObj;index=Squeak.MethodDict_selectorStart,hasWrapped=!0}}},executeNewMethod:function(newRcvr,newMethod,argumentCount,primitiveIndex,optClass,optSel){if(this.sendCount++,newMethod===this.breakOnMethod&&this.breakNow("executing method "+this.printMethod(newMethod,optClass,optSel)),this.logSends){for(var indent=" ",ctx=this.activeContext;!ctx.isNil;)indent+="| ",ctx=ctx.pointers[Squeak.Context_sender];var args=this.activeContext.pointers.slice(this.sp+1-argumentCount,this.sp+1);console.log(this.sendCount+indent+this.printMethod(newMethod,optClass,optSel,args))}if(this.breakOnContextChanged&&(this.breakOnContextChanged=!1,this.breakNow()),!(primitiveIndex>0&&this.tryPrimitive(primitiveIndex,argumentCount,newMethod))){var newContext=this.allocateOrRecycleContext(newMethod.methodNeedsLargeFrame()),tempCount=newMethod.methodTempCount(),newSP=Squeak.Context_tempFrameStart+tempCount-1;if(newContext.pointers[Squeak.Context_method]=newMethod,newContext.pointers[Squeak.BlockContext_initialIP]=this.nilObj,newContext.pointers[Squeak.Context_sender]=this.activeContext,this.arrayCopy(this.activeContext.pointers,this.sp-argumentCount,newContext.pointers,Squeak.Context_tempFrameStart-1,argumentCount+1),this.arrayFill(newContext.pointers,Squeak.Context_tempFrameStart+argumentCount,Squeak.Context_tempFrameStart+tempCount,this.nilObj),this.popN(argumentCount+1),this.reclaimableContextCount++,this.storeContextRegisters(),this.activeContext=newContext,this.activeContext.dirty=!0,this.homeContext=newContext,this.method=newMethod,this.pc=0,this.sp=newSP,this.receiver=newContext.pointers[Squeak.Context_receiver],this.receiver!==newRcvr)throw Error("receivers don't match");newMethod.compiled||this.compileIfPossible(newMethod,optClass,optSel),this.interruptCheckCounter--<=0&&this.checkForInterrupts()}},compileIfPossible(newMethod,optClass,optSel){!newMethod.compiled&&this.compiler&&this.compiler.compile(newMethod,optClass,optSel)},doReturn:function(returnValue,targetContext){if(!targetContext){var ctx=this.homeContext;if(this.hasClosures)for(var closure;!(closure=ctx.pointers[Squeak.Context_closure]).isNil;)ctx=closure.pointers[Squeak.Closure_outerContext];targetContext=ctx.pointers[Squeak.Context_sender]}if(targetContext.isNil||targetContext.pointers[Squeak.Context_instructionPointer].isNil)return this.cannotReturn(returnValue);for(var nextContext,thisContext=this.activeContext.pointers[Squeak.Context_sender];thisContext!==targetContext;){if(thisContext.isNil)return this.cannotReturn(returnValue);if(this.isUnwindMarked(thisContext))return this.aboutToReturnThrough(returnValue,thisContext);thisContext=thisContext.pointers[Squeak.Context_sender]}for(thisContext=this.activeContext;thisContext!==targetContext;)this.breakOnContextReturned===thisContext&&(this.breakOnContextReturned=null,this.breakNow()),nextContext=thisContext.pointers[Squeak.Context_sender],thisContext.pointers[Squeak.Context_sender]=this.nilObj,thisContext.pointers[Squeak.Context_instructionPointer]=this.nilObj,this.reclaimableContextCount>0&&(this.reclaimableContextCount--,this.recycleIfPossible(thisContext)),thisContext=nextContext;this.activeContext=thisContext,this.activeContext.dirty=!0,this.fetchContextRegisters(this.activeContext),this.push(returnValue),this.breakOnContextChanged&&(this.breakOnContextChanged=!1,this.breakNow())},aboutToReturnThrough:function(resultObj,aContext){this.push(this.exportThisContext()),this.push(resultObj),this.push(aContext);var aboutToReturnSel=this.specialObjects[Squeak.splOb_SelectorAboutToReturn];this.send(aboutToReturnSel,2)},cannotReturn:function(resultObj){this.push(this.exportThisContext()),this.push(resultObj);var cannotReturnSel=this.specialObjects[Squeak.splOb_SelectorCannotReturn];this.send(cannotReturnSel,1)},tryPrimitive:function(primIndex,argCount,newMethod){if(primIndex>255&&primIndex<520){if(primIndex>=264)return this.popNandPush(1,this.top().pointers[primIndex-264]),!0;switch(primIndex){case 256:return!0;case 257:return this.popNandPush(1,this.trueObj),!0;case 258:return this.popNandPush(1,this.falseObj),!0;case 259:return this.popNandPush(1,this.nilObj),!0}return this.popNandPush(1,primIndex-261),!0}var sp=this.sp,context=this.activeContext,success=this.primHandler.doPrimitive(primIndex,argCount,newMethod);return success&&this.sp!==sp-argCount&&context===this.activeContext&&117!==primIndex&&118!==primIndex&&218!==primIndex&&!this.frozen&&this.warnOnce("stack unbalanced after primitive "+primIndex,"error"),success},createActualMessage:function(selector,argCount,cls){var message=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassMessage],0),argArray=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassArray],argCount);return this.arrayCopy(this.activeContext.pointers,this.sp-argCount+1,argArray.pointers,0,argCount),message.pointers[Squeak.Message_selector]=selector,message.pointers[Squeak.Message_arguments]=argArray,message.pointers.length>Squeak.Message_lookupClass&&(message.pointers[Squeak.Message_lookupClass]=cls),message},primitivePerform:function(argCount){var selector=this.stackValue(argCount-1),rcvr=this.stackValue(argCount),trueArgCount=argCount-1,entry=this.findSelectorInClass(selector,trueArgCount,this.getClass(rcvr),argCount);if(entry.selector===selector){if(entry.argCount!==trueArgCount)return!1;var stack=this.activeContext.pointers,selectorIndex=this.sp-trueArgCount;this.arrayCopy(stack,selectorIndex+1,stack,selectorIndex,trueArgCount),this.sp--}else rcvr=this.stackValue(entry.argCount);return this.executeNewMethod(rcvr,entry.method,entry.argCount,entry.primIndex,entry.mClass,selector),!0},primitivePerformWithArgs:function(argCount,supered){var rcvrPos=supered?3:2,rcvr=this.stackValue(rcvrPos),selector=this.stackValue(rcvrPos-1),args=this.stackValue(rcvrPos-2);if(args.sqClass!==this.specialObjects[Squeak.splOb_ClassArray])return!1;var lookupClass=supered?this.top():this.getClass(rcvr);if(supered)for(var cls=this.getClass(rcvr);cls!==lookupClass;)if((cls=cls.pointers[Squeak.Class_superclass]).isNil)return!1;var trueArgCount=args.pointersSize(),entry=this.findSelectorInClass(selector,trueArgCount,lookupClass,argCount);if(entry.selector===selector){if(entry.argCount!==trueArgCount)return!1;var stack=this.activeContext.pointers,selectorIndex=this.sp-(argCount-1);stack[selectorIndex-1]=rcvr,this.arrayCopy(args.pointers,0,stack,selectorIndex,trueArgCount),this.sp+=trueArgCount-argCount}else rcvr=this.stackValue(entry.argCount);return this.executeNewMethod(rcvr,entry.method,entry.argCount,entry.primIndex,entry.mClass,selector),!0},primitiveInvokeObjectAsMethod:function(argCount,method){for(var orgArgs=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassArray],argCount),i=0;i<argCount;i++)orgArgs.pointers[argCount-i-1]=this.pop();var orgReceiver=this.pop(),orgSelector=this.currentSelector,runWithIn=this.specialObjects[Squeak.splOb_SelectorRunWithIn];return this.push(method),this.push(orgSelector),this.push(orgArgs),this.push(orgReceiver),this.send(runWithIn,3,!1),!0},findMethodCacheEntry:function(selector,lkupClass){var entry;this.methodCacheRandomish=this.methodCacheRandomish+1&3;for(var firstProbe=(selector.hash^lkupClass.hash)&this.methodCacheMask,probe=firstProbe,i=0;i<4;i++){if((entry=this.methodCache[probe]).selector===selector&&entry.lkupClass===lkupClass)return entry;i===this.methodCacheRandomish&&(firstProbe=probe),probe=probe+selector.hash&this.methodCacheMask}return(entry=this.methodCache[firstProbe]).lkupClass=lkupClass,entry.selector=selector,entry.method=null,entry},flushMethodCache:function(){for(var i=0;i<this.methodCacheSize;i++)this.methodCache[i].selector=null,this.methodCache[i].method=null;return!0},flushMethodCacheForSelector:function(selector){for(var i=0;i<this.methodCacheSize;i++)this.methodCache[i].selector===selector&&(this.methodCache[i].selector=null,this.methodCache[i].method=null);return!0},flushMethodCacheForMethod:function(method){for(var i=0;i<this.methodCacheSize;i++)this.methodCache[i].method===method&&(this.methodCache[i].selector=null,this.methodCache[i].method=null);return!0},flushMethodCacheAfterBecome:function(mutations){this.flushMethodCache()}},"contexts",{isUnwindMarked:function(ctx){return!!this.isMethodContext(ctx)&&198==ctx.pointers[Squeak.Context_method].methodPrimitiveIndex()},newActiveContext:function(newContext){this.storeContextRegisters(),this.activeContext=newContext,this.activeContext.dirty=!0,this.fetchContextRegisters(newContext),this.breakOnContextChanged&&(this.breakOnContextChanged=!1,this.breakNow())},exportThisContext:function(){return this.storeContextRegisters(),this.reclaimableContextCount=0,this.activeContext},fetchContextRegisters:function(ctxt){var meth=ctxt.pointers[Squeak.Context_method];this.isSmallInt(meth)?(this.homeContext=ctxt.pointers[Squeak.BlockContext_home],meth=this.homeContext.pointers[Squeak.Context_method]):this.homeContext=ctxt,this.receiver=this.homeContext.pointers[Squeak.Context_receiver],this.method=meth,this.pc=this.decodeSqueakPC(ctxt.pointers[Squeak.Context_instructionPointer],meth),this.sp=this.decodeSqueakSP(ctxt.pointers[Squeak.Context_stackPointer])},storeContextRegisters:function(){this.activeContext.pointers[Squeak.Context_instructionPointer]=this.encodeSqueakPC(this.pc,this.method),this.activeContext.pointers[Squeak.Context_stackPointer]=this.encodeSqueakSP(this.sp)},encodeSqueakPC:function(intPC,method){return intPC+4*method.pointers.length+1},decodeSqueakPC:function(squeakPC,method){return squeakPC-4*method.pointers.length-1},encodeSqueakSP:function(intSP){return intSP-(Squeak.Context_tempFrameStart-1)},decodeSqueakSP:function(squeakSP){return squeakSP+(Squeak.Context_tempFrameStart-1)},recycleIfPossible:function(ctxt){if(this.isMethodContext(ctxt))if(ctxt.pointersSize()===Squeak.Context_tempFrameStart+Squeak.Context_smallFrameSize)ctxt.pointers[0]=this.freeContexts,this.freeContexts=ctxt;else{if(ctxt.pointersSize()!==Squeak.Context_tempFrameStart+Squeak.Context_largeFrameSize)return;ctxt.pointers[0]=this.freeLargeContexts,this.freeLargeContexts=ctxt}},allocateOrRecycleContext:function(needsLarge){var freebie;return needsLarge?this.freeLargeContexts.isNil?(this.nAllocatedContexts++,this.instantiateClass(this.specialObjects[Squeak.splOb_ClassMethodContext],Squeak.Context_largeFrameSize)):(freebie=this.freeLargeContexts,this.freeLargeContexts=freebie.pointers[0],this.nRecycledContexts++,freebie):this.freeContexts.isNil?(this.nAllocatedContexts++,this.instantiateClass(this.specialObjects[Squeak.splOb_ClassMethodContext],Squeak.Context_smallFrameSize)):(freebie=this.freeContexts,this.freeContexts=freebie.pointers[0],this.nRecycledContexts++,freebie)}},"stack access",{pop:function(){return this.activeContext.pointers[this.sp--]},popN:function(nToPop){this.sp-=nToPop},push:function(object){this.activeContext.pointers[++this.sp]=object},popNandPush:function(nToPop,object){this.activeContext.pointers[this.sp-=nToPop-1]=object},top:function(){return this.activeContext.pointers[this.sp]},stackTopPut:function(object){this.activeContext.pointers[this.sp]=object},stackValue:function(depthIntoStack){return this.activeContext.pointers[this.sp-depthIntoStack]},stackInteger:function(depthIntoStack){return this.checkSmallInt(this.stackValue(depthIntoStack))},stackIntOrFloat:function(depthIntoStack){var num=this.stackValue(depthIntoStack);if("number"==typeof num)return num;if(void 0===num)return this.success=!1,0;if(num.isFloat)return this.resultIsFloat=!0,num.float;var bytes=num.bytes;if(bytes&&4==bytes.length){for(var value=0,i=3;i>=0;i--)value=256*value+bytes[i];if(num.sqClass===this.specialObjects[Squeak.splOb_ClassLargePositiveInteger])return value;if(num.sqClass===this.specialObjects[Squeak.splOb_ClassLargeNegativeInteger])return-value}return this.success=!1,0},pop2AndPushIntResult:function(intResult){return!(!this.success||!this.canBeSmallInt(intResult))&&(this.popNandPush(2,intResult),!0)},pop2AndPushNumResult:function(numResult){if(this.success){if(this.resultIsFloat)return this.popNandPush(2,this.primHandler.makeFloat(numResult)),!0;if(numResult>=Squeak.MinSmallInt&&numResult<=Squeak.MaxSmallInt)return this.popNandPush(2,numResult),!0;if(numResult>=-4294967295&&numResult<=4294967295){var negative=numResult<0,unsigned=negative?-numResult:numResult,lgIntClass=negative?Squeak.splOb_ClassLargeNegativeInteger:Squeak.splOb_ClassLargePositiveInteger,lgIntObj=this.instantiateClass(this.specialObjects[lgIntClass],4),bytes=lgIntObj.bytes;return bytes[0]=255&unsigned,bytes[1]=unsigned>>8&255,bytes[2]=unsigned>>16&255,bytes[3]=unsigned>>24&255,this.popNandPush(2,lgIntObj),!0}}return!1},pop2AndPushBoolResult:function(boolResult){return!!this.success&&(this.popNandPush(2,boolResult?this.trueObj:this.falseObj),!0)}},"numbers",{getClass:function(obj){return this.isSmallInt(obj)?this.specialObjects[Squeak.splOb_ClassInteger]:obj.sqClass},canBeSmallInt:function(anInt){return anInt>=Squeak.MinSmallInt&&anInt<=Squeak.MaxSmallInt},isSmallInt:function(object){return"number"==typeof object},checkSmallInt:function(maybeSmallInt){return"number"==typeof maybeSmallInt?maybeSmallInt:(this.success=!1,1)},quickDivide:function(rcvr,arg){if(0===arg)return Squeak.NonSmallInt;var result=rcvr/arg|0;return result*arg===rcvr?result:Squeak.NonSmallInt},div:function(rcvr,arg){return 0===arg?Squeak.NonSmallInt:Math.floor(rcvr/arg)},mod:function(rcvr,arg){return 0===arg?Squeak.NonSmallInt:rcvr-Math.floor(rcvr/arg)*arg},safeShift:function(smallInt,shiftCount){if(shiftCount<0)return shiftCount<-31?smallInt<0?-1:0:smallInt>>-shiftCount;if(shiftCount>31)return 0===smallInt?0:Squeak.NonSmallInt;var shifted=smallInt<<shiftCount;return shifted>>shiftCount!==smallInt?Squeak.NonSmallInt:shifted}},"utils",{isContext:function(obj){return obj.sqClass===this.specialObjects[Squeak.splOb_ClassMethodContext]||obj.sqClass===this.specialObjects[Squeak.splOb_ClassBlockContext]},isMethodContext:function(obj){return obj.sqClass===this.specialObjects[Squeak.splOb_ClassMethodContext]},instantiateClass:function(aClass,indexableSize){return this.image.instantiateClass(aClass,indexableSize,this.nilObj)},arrayFill:function(array,fromIndex,toIndex,value){for(var i=fromIndex;i<toIndex;i++)array[i]=value},arrayCopy:function(src,srcPos,dest,destPos,length){if(src===dest&&srcPos<destPos)for(var i=length-1;i>=0;i--)dest[destPos+i]=src[srcPos+i];else for(i=0;i<length;i++)dest[destPos+i]=src[srcPos+i]},signalLowSpaceIfNecessary:function(bytesLeft){if(bytesLeft<this.lowSpaceThreshold&&this.lowSpaceThreshold>0){var increase=prompt&&prompt("Out of memory, "+Math.ceil(this.image.totalMemory/1e6)+" MB used.\nEnter additional MB, or 0 to signal low space in image","0");if(increase){var bytes=1e6*parseInt(increase,10);this.image.totalMemory+=bytes,this.signalLowSpaceIfNecessary(this.image.bytesLeft())}else{console.warn("squeak: low memory ("+bytesLeft+"/"+this.image.totalMemory+" bytes left), signaling low space"),this.signalLowSpace=!0,this.lowSpaceThreshold=0,this.specialObjects[Squeak.splOb_ProcessSignalingLowSpace].isNil&&(this.specialObjects[Squeak.splOb_ProcessSignalingLowSpace]=this.primHandler.activeProcess()),this.forceInterruptCheck()}}}},"debugging",{addMessage:function(message){return this.messages[message]?++this.messages[message]:this.messages[message]=1},warnOnce:function(message,what){if(1==this.addMessage(message))return console[what||"warn"](message),!0},printMethod:function(aMethod,optContext,optSel,optArgs){if(aMethod.sqClass!=this.specialObjects[Squeak.splOb_ClassCompiledMethod])return this.printMethod(aMethod.blockOuterCode(),optContext,optSel,optArgs);var found;if(optSel){var printed=optContext.className()+">>",selector=optSel.bytesAsString();if(optArgs&&optArgs.length)for(var parts=selector.replace(/(:[a-zA-Z])/g,": $1").split(" :"),i=0;i<optArgs.length;i++)i>0&&(printed+=" "),printed+=parts[i]+" "+optArgs[i];else printed+=selector;return printed}return aMethod||(aMethod=this.activeContext.contextMethod()),this.allMethodsDo((function(classObj,methodObj,selectorObj){if(methodObj===aMethod)return found=classObj.className()+">>"+selectorObj.bytesAsString()})),found||(optContext?"("+optContext.pointers[Squeak.Context_receiver]+")>>?":"?>>?")},allInstancesOf:function(classObj,callback){"string"==typeof classObj&&(classObj=this.globalNamed(classObj));for(var instances=[],inst=this.image.someInstanceOf(classObj);inst;)callback?callback(inst):instances.push(inst),inst=this.image.nextInstanceAfter(inst);return instances},globalNamed:function(name){return this.allGlobalsDo((function(nameObj,globalObj){if(nameObj.bytesAsString()===name)return globalObj}))},allGlobalsDo:function(callback){for(var globals=this.getGlobals(),i=0;i<globals.length;i++){var assn=globals[i];if(!assn.isNil){var result=callback(assn.pointers[0],assn.pointers[1]);if(result)return result}}},allMethodsDo:function(callback){this.allGlobalsDo((function(globalNameObj,globalObj){if(globalObj.pointers&&globalObj.pointers.length>=9)for(var clsAndMeta=[globalObj,globalObj.sqClass],c=0;c<clsAndMeta.length;c++){var cls=clsAndMeta[c],mdict=cls.pointers[1];if(mdict.pointers&&mdict.pointers[1]){var methods=mdict.pointers[1].pointers;if(methods){var selectors=mdict.pointers;if(methods.length+2===selectors.length)for(var j=0;j<methods.length;j++){var method=methods[j],selector=selectors[2+j];if(method.isMethod&&method.isMethod())if(selector.bytesSize&&selector.bytesSize())if(callback.call(null,cls,method,selector))return!0}}}}}))},printStack:function(ctx,limit,indent){"number"==typeof ctx&&(limit=ctx,ctx=null),ctx||(ctx=this.activeContext),limit||(limit=100);for(var contexts=[],hardLimit=Math.max(limit,1e6);!ctx.isNil&&hardLimit-- >0;)contexts.push(ctx),ctx=ctx.pointers[Squeak.Context_sender];contexts.length>limit+200&&(ctx.isNil||contexts.push("..."),contexts=contexts.slice(0,limit).concat(["..."]).concat(contexts.slice(-200)));var stack=[],i=contexts.length,indents="";for(indent&&this.logSends&&(indents=Array((""+this.sendCount).length+2).join(" "));i-- >0;){if((ctx=contexts[i]).pointers){var block="",method=ctx.pointers[Squeak.Context_method];"number"==typeof method?(method=ctx.pointers[Squeak.BlockContext_home].pointers[Squeak.Context_method],block="[] in "):ctx.pointers[Squeak.Context_closure].isNil||(block="[] in ");var line=block+this.printMethod(method,ctx);indent&&(line=indents+line),stack.push(line+"\n"),indent&&(indents+=indent)}else stack.push("...\n")}return stack.join("")},findMethod:function(classAndMethodString){var found,className=classAndMethodString.split(">>")[0],methodName=classAndMethodString.split(">>")[1];return this.allMethodsDo((function(classObj,methodObj,selectorObj){if(methodName.length==selectorObj.bytesSize()&&methodName==selectorObj.bytesAsString()&&className==classObj.className())return found=methodObj})),found},breakAfter:function(ms){this.breakOutTick=this.primHandler.millisecondClockValue()+ms},breakNow:function(msg){msg&&console.log("Break: "+msg),this.breakOutOfInterpreter="break"},breakOn:function(classAndMethodString){return this.breakOnMethod=classAndMethodString&&this.findMethod(classAndMethodString)},breakOnReturnFromThisContext:function(){this.breakOnContextChanged=!1,this.breakOnContextReturned=this.activeContext},breakOnSendOrReturn:function(){this.breakOnContextChanged=!0,this.breakOnContextReturned=null},printContext:function(ctx,maxWidth){if(!this.isContext(ctx))return"NOT A CONTEXT: "+printObj(ctx);function printObj(obj){var value="number"==typeof obj||"object"==typeof obj?obj.sqInstName():"<"+obj+">";return(value=JSON.stringify(value).slice(1,-1)).length>maxWidth-3&&(value=value.slice(0,maxWidth-3)+"..."),value}maxWidth||(maxWidth=72);for(var isBlock="number"==typeof ctx.pointers[Squeak.BlockContext_argumentCount],closure=ctx.pointers[Squeak.Context_closure],isClosure=!isBlock&&!closure.isNil,homeCtx=isBlock?ctx.pointers[Squeak.BlockContext_home]:ctx,tempCount=isClosure?closure.pointers[Squeak.Closure_numArgs]:homeCtx.pointers[Squeak.Context_method].methodTempCount(),stackBottom=this.decodeSqueakSP(0),stackTop=homeCtx.contextSizeWithStack(this)-1,firstTemp=stackBottom+1,lastTemp=firstTemp+tempCount-1,lastArg=firstTemp+homeCtx.pointers[Squeak.Context_method].methodNumArgs()-1,stack="",i=stackBottom;i<=stackTop;i++){var label="";i===stackBottom?label="=rcvr":(i<=lastTemp&&(label="=tmp"+(i-firstTemp)),i<=lastArg&&(label+="/arg"+(i-firstTemp))),stack+="\nctx["+i+"]"+label+": "+printObj(homeCtx.pointers[i])}if(isBlock){stack+="\n";var nArgs=ctx.pointers[Squeak.BlockContext_argumentCount],firstArg=this.decodeSqueakSP(1),sp=(lastArg=firstArg+nArgs,ctx===this.activeContext?this.sp:ctx.pointers[Squeak.Context_stackPointer]);sp<firstArg&&(stack+="\nblk <stack empty>");for(i=firstArg;i<=sp;i++){label="";i<lastArg&&(label="=arg"+(i-firstArg)),stack+="\nblk["+i+"]"+label+": "+printObj(ctx.pointers[i])}}return stack},printActiveContext:function(maxWidth){return this.printContext(this.activeContext,maxWidth)},printAllProcesses:function(){for(var sched=this.specialObjects[Squeak.splOb_SchedulerAssociation].pointers[Squeak.Assn_value],activeProc=sched.pointers[Squeak.ProcSched_activeProcess],result="Active: "+this.printProcess(activeProc,!0),lists=sched.pointers[Squeak.ProcSched_processLists].pointers,priority=lists.length-1;priority>=0;priority--)for(var process=lists[priority].pointers[Squeak.LinkedList_firstLink];!process.isNil;)result+="\n------------------------------------------",result+="\nRunnable: "+this.printProcess(process),process=process.pointers[Squeak.Link_nextLink];for(var semaClass=this.specialObjects[Squeak.splOb_ClassSemaphore],sema=this.image.someInstanceOf(semaClass),waiting=[];sema;){for(process=sema.pointers[Squeak.LinkedList_firstLink];!process.isNil;)waiting.push(process),process=process.pointers[Squeak.Link_nextLink];sema=this.image.nextInstanceAfter(sema)}waiting.sort((function(a,b){return b.pointers[Squeak.Proc_priority]-a.pointers[Squeak.Proc_priority]}));for(var i=0;i<waiting.length;i++)result+="\n------------------------------------------",result+="\nWaiting: "+this.printProcess(waiting[i]);return result},printProcess:function(process,active,indent){process||(process=this.specialObjects[Squeak.splOb_SchedulerAssociation].pointers[Squeak.Assn_value].pointers[Squeak.ProcSched_activeProcess],active=!0);var context=active?this.activeContext:process.pointers[Squeak.Proc_suspendedContext],priority=process.pointers[Squeak.Proc_priority],stack=this.printStack(context,20,indent),values=indent&&this.logSends?"":this.printContext(context)+"\n";return process.toString()+" at priority "+priority+"\n"+stack+values},printByteCodes:function(aMethod,optionalIndent,optionalHighlight,optionalPC){return aMethod||(aMethod=this.method),new Squeak.InstructionPrinter(aMethod,this).printInstructions(optionalIndent,optionalHighlight,optionalPC)},logStack:function(){console.log(this.printStack()+this.printActiveContext()+"\n\n"+this.printByteCodes(this.method," ","=> ",this.pc),this.activeContext.pointers.slice(0,this.sp+1))},willSendOrReturn:function(){var byte=this.method.bytes[this.pc];if(this.method.methodSignFlag()){if(96<=byte&&byte<=127)selectorObj=this.specialSelectors[2*(byte-96)];else if(128<=byte&&byte<=175)selectorObj=this.method.methodGetSelector(15&byte);else if(234==byte||235==byte)this.method.methodGetSelector(this.method.bytes[this.pc+1]>>3);else if(88<=byte&&byte<=94)return!0}else{if(byte>=120&&byte<=125)return!0;if(byte<131||200==byte)return!1;if(byte>=176)return!0;if(byte<=134){var litIndex;if(132===byte){if(this.method.bytes[this.pc+1]>>5>1)return!1;litIndex=this.method.bytes[this.pc+2]}else litIndex=this.method.bytes[this.pc+1]&(134===byte?63:31);var selectorObj=this.method.methodGetLiteral(litIndex);if("blockCopy:"!==selectorObj.bytesAsString())return!0}}return!1},nextSendSelector:function(){var selectorObj,byte=this.method.bytes[this.pc];if(this.method.methodSignFlag())if(96<=byte&&byte<=127)selectorObj=this.specialSelectors[2*(byte-96)];else if(128<=byte&&byte<=175)selectorObj=this.method.methodGetSelector(15&byte);else{if(234!=byte&&235!=byte)return null;this.method.methodGetSelector(this.method.bytes[this.pc+1]>>3)}else{if(byte<131||200==byte)return null;if(byte>=208)selectorObj=this.method.methodGetLiteral(15&byte);else if(byte>=176)selectorObj=this.specialSelectors[2*(byte-176)];else if(byte<=134){var litIndex;if(132===byte){if(this.method.bytes[this.pc+1]>>5>1)return null;litIndex=this.method.bytes[this.pc+2]}else litIndex=this.method.bytes[this.pc+1]&(134===byte?63:31);selectorObj=this.method.methodGetLiteral(litIndex)}}if(selectorObj){var selector=selectorObj.bytesAsString();if("blockCopy:"!==selector)return selector}}})),vm_interpreter}var vm_interpreter_proxy={},hasRequiredVm_interpreter_proxy;function requireVm_interpreter_proxy(){return hasRequiredVm_interpreter_proxy||(hasRequiredVm_interpreter_proxy=1,Object.subclass("Squeak.InterpreterProxy","initialization",{VM_PROXY_MAJOR:1,VM_PROXY_MINOR:11,initialize:function(vm){this.vm=vm,this.remappableOops=[],Object.defineProperty(this,"successFlag",{get:function(){return vm.primHandler.success},set:function(success){vm.primHandler.success=success}})},majorVersion:function(){return this.VM_PROXY_MAJOR},minorVersion:function(){return this.VM_PROXY_MINOR}},"success",{failed:function(){return!this.successFlag},primitiveFail:function(){this.successFlag=!1},primitiveFailFor:function(reasonCode){this.successFlag=!1},success:function(boolean){boolean||(this.successFlag=!1)}},"stack access",{pop:function(n){this.vm.popN(n)},popthenPush:function(n,obj){this.vm.popNandPush(n,obj)},push:function(obj){this.vm.push(obj)},pushBool:function(bool){this.vm.push(bool?this.vm.trueObj:this.vm.falseObj)},pushInteger:function(int){this.vm.push(int)},pushFloat:function(num){this.vm.push(this.floatObjectOf(num))},stackValue:function(n){return this.vm.stackValue(n)},stackIntegerValue:function(n){var int=this.vm.stackValue(n);return"number"==typeof int?int:(this.successFlag=!1,0)},stackFloatValue:function(n){this.vm.success=!0;var float=this.vm.stackIntOrFloat(n);return this.vm.success?float:(this.successFlag=!1,0)},stackObjectValue:function(n){var obj=this.vm.stackValue(n);return"number"!=typeof obj?obj:(this.successFlag=!1,this.vm.nilObj)},stackBytes:function(n){var oop=this.vm.stackValue(n);return oop.bytes?oop.bytes:("number"!=typeof oop&&oop.isBytes()||(this.successFlag=!1),[])},stackWords:function(n){var oop=this.vm.stackValue(n);return oop.words?oop.words:("number"!=typeof oop&&oop.isWords()||(this.successFlag=!1),[])},stackInt32Array:function(n){var oop=this.vm.stackValue(n);return oop.words?oop.wordsAsInt32Array():("number"!=typeof oop&&oop.isWords()||(this.successFlag=!1),[])},stackInt16Array:function(n){var oop=this.vm.stackValue(n);return oop.words?oop.wordsAsInt16Array():("number"!=typeof oop&&oop.isWords()||(this.successFlag=!1),[])},stackUint16Array:function(n){var oop=this.vm.stackValue(n);return oop.words?oop.wordsAsUint16Array():("number"!=typeof oop&&oop.isWords()||(this.successFlag=!1),[])}},"object access",{isBytes:function(obj){return"number"!=typeof obj&&obj.isBytes()},isWords:function(obj){return"number"!=typeof obj&&obj.isWords()},isWordsOrBytes:function(obj){return"number"!=typeof obj&&obj.isWordsOrBytes()},isPointers:function(obj){return"number"!=typeof obj&&obj.isPointers()},isIntegerValue:function(obj){return"number"==typeof obj&&obj>=-1073741824&&obj<=1073741823},isArray:function(obj){return obj.sqClass===this.vm.specialObjects[Squeak.splOb_ClassArray]},isMemberOf:function(obj,className){var nameBytes=obj.sqClass.pointers[Squeak.Class_name].bytes;if(className.length!==nameBytes.length)return!1;for(var i=0;i<className.length;i++)if(className.charCodeAt(i)!==nameBytes[i])return!1;return!0},booleanValueOf:function(obj){return!!obj.isTrue||(obj.isFalse||(this.successFlag=!1),!1)},positive32BitValueOf:function(obj){return this.vm.primHandler.positive32BitValueOf(obj)},positive32BitIntegerFor:function(int){return this.vm.primHandler.pos32BitIntFor(int)},floatValueOf:function(obj){return obj.isFloat?obj.float:(this.successFlag=!1,0)},floatObjectOf:function(num){return this.vm.primHandler.makeFloat(num)},fetchPointerofObject:function(n,obj){return obj.pointers[n]},fetchBytesofObject:function(n,obj){var oop=obj.pointers[n];return oop.bytes?oop.bytes:oop.words?oop.wordsAsUint8Array():("number"!=typeof oop&&oop.isWordsOrBytes()||(this.successFlag=!1),[])},fetchWordsofObject:function(n,obj){var oop=obj.pointers[n];return oop.words?oop.words:("number"!=typeof oop&&oop.isWords()||(this.successFlag=!1),[])},fetchInt32ArrayofObject:function(n,obj){var oop=obj.pointers[n];return oop.words?oop.wordsAsInt32Array():("number"!=typeof oop&&oop.isWords()||(this.successFlag=!1),[])},fetchInt16ArrayofObject:function(n,obj){var oop=obj.pointers[n];return oop.words?oop.wordsAsInt16Array():("number"!=typeof oop&&oop.isWords()||(this.successFlag=!1),[])},fetchUint16ArrayofObject:function(n,obj){var oop=obj.pointers[n];return oop.words?oop.wordsAsUint16Array():("number"!=typeof oop&&oop.isWords()||(this.successFlag=!1),[])},fetchIntegerofObject:function(n,obj){var int=obj.pointers[n];return"number"==typeof int?int:(this.successFlag=!1,0)},fetchLong32ofObject:function(n,obj){return obj.words[n]},fetchFloatofObject:function(n,obj){return this.floatValueOf(obj.pointers[n])},storeIntegerofObjectwithValue:function(n,obj,value){"number"==typeof value?obj.pointers[n]=value:this.successFlag=!1},storePointerofObjectwithValue:function(n,obj,value){obj.pointers[n]=value},stObjectatput:function(array,index,obj){if(array.sqClass!==this.classArray())throw Error("Array expected");if(index<1||index>array.pointers.length)return this.successFlag=!1;array.pointers[index-1]=obj}},"constant access",{isKindOfInteger:function(obj){return"number"==typeof obj||obj.sqClass==this.classLargeNegativeInteger()||obj.sqClass==this.classLargePositiveInteger()},classArray:function(){return this.vm.specialObjects[Squeak.splOb_ClassArray]},classBitmap:function(){return this.vm.specialObjects[Squeak.splOb_ClassBitmap]},classSmallInteger:function(){return this.vm.specialObjects[Squeak.splOb_ClassInteger]},classLargePositiveInteger:function(){return this.vm.specialObjects[Squeak.splOb_ClassLargePositiveInteger]},classLargeNegativeInteger:function(){return this.vm.specialObjects[Squeak.splOb_ClassLargeNegativeInteger]},classPoint:function(){return this.vm.specialObjects[Squeak.splOb_ClassPoint]},classString:function(){return this.vm.specialObjects[Squeak.splOb_ClassString]},classByteArray:function(){return this.vm.specialObjects[Squeak.splOb_ClassByteArray]},nilObject:function(){return this.vm.nilObj},falseObject:function(){return this.vm.falseObj},trueObject:function(){return this.vm.trueObj}},"vm functions",{clone:function(object){return this.vm.image.clone(object)},instantiateClassindexableSize:function(aClass,indexableSize){return this.vm.instantiateClass(aClass,indexableSize)},methodArgumentCount:function(){return this.argCount},makePointwithxValueyValue:function(x,y){return this.vm.primHandler.makePointWithXandY(x,y)},pushRemappableOop:function(obj){this.remappableOops.push(obj)},popRemappableOop:function(){return this.remappableOops.pop()},showDisplayBitsLeftTopRightBottom:function(form,left,top,right,bottom){if(left<right&&top<bottom){var rect={left,top,right,bottom};this.vm.primHandler.displayDirty(form,rect)}},ioLoadFunctionFrom:function(funcName,pluginName){return this.vm.primHandler.loadFunctionFrom(funcName,pluginName)}})),vm_interpreter_proxy}var vm_instruction_stream={},hasRequiredVm_instruction_stream;function requireVm_instruction_stream(){return hasRequiredVm_instruction_stream||(hasRequiredVm_instruction_stream=1,Object.subclass("Squeak.InstructionStream","initialization",{initialize:function(method,vm){this.vm=vm,this.method=method,this.pc=0,this.specialConstants=[vm.trueObj,vm.falseObj,vm.nilObj,-1,0,1,2]}},"decoding",{interpretNextInstructionFor:function(client){var method=this.method,byte=method.bytes[this.pc++],type=byte/16|0,offset=byte%16;if(0===type)return client.pushReceiverVariable(offset);if(1===type)return client.pushTemporaryVariable(offset);if(2===type)return client.pushConstant(method.methodGetLiteral(offset));if(3===type)return client.pushConstant(method.methodGetLiteral(offset+16));if(4===type)return client.pushLiteralVariable(method.methodGetLiteral(offset));if(5===type)return client.pushLiteralVariable(method.methodGetLiteral(offset+16));if(6===type)return offset<8?client.popIntoReceiverVariable(offset):client.popIntoTemporaryVariable(offset-8);if(7===type){if(0===offset)return client.pushReceiver();if(offset<8)return client.pushConstant(this.specialConstants[offset-1]);if(8===offset)return client.methodReturnReceiver();if(offset<12)return client.methodReturnConstant(this.specialConstants[offset-9]);if(12===offset)return client.methodReturnTop();if(13===offset)return client.blockReturnTop();if(offset>13)throw Error("unusedBytecode")}return 8===type?this.interpretExtension(offset,method,client):9===type?offset<8?client.jump(offset+1):client.jumpIf(!1,offset-8+1):10===type?(byte=this.method.bytes[this.pc++],offset<8?client.jump(256*(offset-4)+byte):client.jumpIf(offset<12,256*(3&offset)+byte)):11===type?client.send(this.vm.specialSelectors[2*offset],this.vm.specialSelectors[2*offset+1],!1):12===type?client.send(this.vm.specialSelectors[2*(offset+16)],this.vm.specialSelectors[2*(offset+16)+1],!1):type>12?client.send(method.methodGetLiteral(offset),type-13,!1):void 0},interpretExtension:function(offset,method,client){if(offset<=6){var byte2=this.method.bytes[this.pc++];if(offset<=2){var type=byte2/64|0,offset2=byte2%64;if(0===offset){if(0===type)return client.pushReceiverVariable(offset2);if(1===type)return client.pushTemporaryVariable(offset2);if(2===type)return client.pushConstant(this.method.methodGetLiteral(offset2));if(3===type)return client.pushLiteralVariable(this.method.methodGetLiteral(offset2))}if(1===offset){if(0===type)return client.storeIntoReceiverVariable(offset2);if(1===type)return client.storeIntoTemporaryVariable(offset2);if(2===type)throw Error("illegalStore");if(3===type)return client.storeIntoLiteralVariable(this.method.methodGetLiteral(offset2))}if(2===offset){if(0===type)return client.popIntoReceiverVariable(offset2);if(1===type)return client.popIntoTemporaryVariable(offset2);if(2===type)throw Error("illegalStore");if(3===type)return client.popIntoLiteralVariable(this.method.methodGetLiteral(offset2))}}if(3===offset)return client.send(this.method.methodGetLiteral(byte2%32),byte2/32|0,!1);if(4===offset){var byte3=this.method.bytes[this.pc++];if(0===(type=byte2/32|0))return client.send(this.method.methodGetLiteral(byte3),byte2%32,!1);if(1===type)return client.send(this.method.methodGetLiteral(byte3),byte2%32,!0);if(2===type)return client.pushReceiverVariable(byte3);if(3===type)return client.pushConstant(this.method.methodGetLiteral(byte3));if(4===type)return client.pushLiteralVariable(this.method.methodGetLiteral(byte3));if(5===type)return client.storeIntoReceiverVariable(byte3);if(6===type)return client.popIntoReceiverVariable(byte3);if(7===type)return client.storeIntoLiteralVariable(this.method.methodGetLiteral(byte3))}if(5===offset)return client.send(this.method.methodGetLiteral(31&byte2),byte2>>5,!0);if(6===offset)return client.send(this.method.methodGetLiteral(63&byte2),byte2>>6,!1)}if(7===offset)return client.doPop();if(8===offset)return client.doDup();if(9===offset)return client.pushActiveContext();byte2=this.method.bytes[this.pc++];if(10===offset)return byte2<128?client.pushNewArray(byte2):client.popIntoNewArray(byte2-128);byte3=this.method.bytes[this.pc++];if(11===offset)return client.callPrimitive(byte2+256*byte3);if(12===offset)return client.pushRemoteTemp(byte2,byte3);if(13===offset)return client.storeIntoRemoteTemp(byte2,byte3);if(14===offset)return client.popIntoRemoteTemp(byte2,byte3);var byte4=this.method.bytes[this.pc++];return client.pushClosureCopy(byte2>>4,15&byte2,256*byte3+byte4)}})),vm_instruction_stream}var vm_instruction_stream_sista={},hasRequiredVm_instruction_stream_sista;function requireVm_instruction_stream_sista(){return hasRequiredVm_instruction_stream_sista||(hasRequiredVm_instruction_stream_sista=1,Squeak.InstructionStream.subclass("Squeak.InstructionStreamSista","decoding",{interpretNextInstructionFor:function(client){return this.interpretNextInstructionExtFor(client,0,0)},interpretNextInstructionExtFor:function(client,extA,extB){this.Squeak;var b=this.method.bytes[this.pc++];switch(b){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:return client.pushReceiverVariable(15&b);case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:return client.pushLiteralVariable(this.method.methodGetLiteral(15&b));case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 58:case 59:case 60:case 61:case 62:case 63:return client.pushConstant(this.method.methodGetLiteral(31&b));case 64:case 65:case 66:case 67:case 68:case 69:case 70:case 71:return client.pushTemporaryVariable(15&b);case 72:case 73:case 74:case 75:return client.pushTemporaryVariable(8+(3&b));case 76:return client.pushReceiver();case 77:return client.pushConstant(this.vm.trueObj);case 78:return client.pushConstant(this.vm.falseObj);case 79:return client.pushConstant(this.vm.nilObj);case 80:return client.pushConstant(0);case 81:return client.pushConstant(1);case 82:return client.pushActiveContext();case 83:return client.doDup();case 88:return client.methodReturnReceiver();case 89:return client.methodReturnConstant(this.vm.trueObj);case 90:return client.methodReturnConstant(this.vm.falseObj);case 91:return client.methodReturnConstant(this.vm.nilObj);case 92:return client.methodReturnTop();case 93:return client.blockReturnConstant(this.vm.nilObj);case 94:if(0===extA)return client.blockReturnTop();break;case 95:return client.nop();case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:case 123:case 124:case 125:case 126:case 127:return client.send(this.vm.specialSelectors[2*(b-96)],this.vm.specialSelectors[2*(b-96)+1],!1);case 128:case 129:case 130:case 131:case 132:case 133:case 134:case 135:case 136:case 137:case 138:case 139:case 140:case 141:case 142:case 143:return client.send(this.method.methodGetLiteral(15&b),0,!1);case 144:case 145:case 146:case 147:case 148:case 149:case 150:case 151:case 152:case 153:case 154:case 155:case 156:case 157:case 158:case 159:return client.send(this.method.methodGetLiteral(15&b),1,!1);case 160:case 161:case 162:case 163:case 164:case 165:case 166:case 167:case 168:case 169:case 170:case 171:case 172:case 173:case 174:case 175:return client.send(this.method.methodGetLiteral(15&b),2,!1);case 176:case 177:case 178:case 179:case 180:case 181:case 182:case 183:return client.jump(1+(7&b));case 184:case 185:case 186:case 187:case 188:case 189:case 190:case 191:return client.jumpIf(!0,1+(7&b));case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:return client.jumpIf(!1,1+(7&b));case 200:case 201:case 202:case 203:case 204:case 205:case 206:case 207:return client.popIntoReceiverVariable(7&b);case 208:case 209:case 210:case 211:case 212:case 213:case 214:case 215:return client.popIntoTemporaryVariable(b-208);case 216:return client.doPop()}var b2=this.method.bytes[this.pc++];switch(b){case 224:return this.interpretNextInstructionExtFor(client,(extA<<8)+b2,extB);case 225:return this.interpretNextInstructionExtFor(client,extA,(extB<<8)+(b2<128?b2:b2-256));case 226:return client.pushReceiverVariable(b2+(extA<<8));case 227:return client.pushLiteralVariable(this.method.methodGetLiteral(b2+(extA<<8)));case 228:return client.pushConstant(this.method.methodGetLiteral(b2+(extA<<8)));case 229:return client.pushTemporaryVariable(b2);case 231:return b2<128?client.pushNewArray(b2):client.popIntoNewArray(b2-128);case 232:return client.pushConstant(b2+(extB<<8));case 233:var unicode=b2+(extB<<8);return client.pushConstant("$"+String.fromCodePoint(unicode)+" ("+unicode+")");case 234:return client.send(this.method.methodGetSelector((b2>>3)+(extA<<5)),(7&b2)+(extB<<3),!1);case 235:var literal=this.method.methodGetSelector((b2>>3)+(extA<<5));return extB>=64?client.sendSuperDirected(literal):client.send(literal,(7&b2)+(extB<<3),!0);case 237:return client.jump(b2+(extB<<8));case 238:return client.jumpIf(!0,b2+(extB<<8));case 239:return client.jumpIf(!1,b2+(extB<<8));case 240:return client.popIntoReceiverVariable(b2+(extA<<8));case 241:return client.popIntoLiteralVariable(this.method.methodGetLiteral(b2+(extA<<8)));case 242:return client.popIntoTemporaryVariable(b2);case 243:return client.storeIntoReceiverVariable(b2+(extA<<8));case 244:return client.storeIntoLiteralVariable(this.method.methodGetLiteral(b2+(extA<<8)));case 245:return client.storeIntoTemporaryVariable(b2)}var b3=this.method.bytes[this.pc++];switch(b){case 248:return client.callPrimitive(b2+(b3<<8));case 249:var literalIndex=b2+(extA<<8),numCopied=63&b3,compiledBlock=this.method.methodGetLiteral(literalIndex);return client.pushFullClosure(literalIndex,numCopied,compiledBlock.methodNumArgs());case 250:var numArgs=(7&b2)+8*this.mod(extA,16),blockSize=(numCopied=(b2>>3&7)+8*this.div(extA,16),b3+(extB<<8));return client.pushClosureCopy(numCopied,numArgs,blockSize);case 251:return client.pushRemoteTemp(b2,b3);case 252:return client.storeIntoRemoteTemp(b2,b3);case 253:return client.popIntoRemoteTemp(b2,b3)}throw Error("Unknown bytecode: "+b)}})),vm_instruction_stream_sista}var vm_instruction_printer={},hasRequiredVm_instruction_printer;function requireVm_instruction_printer(){return hasRequiredVm_instruction_printer||(hasRequiredVm_instruction_printer=1,Object.subclass("Squeak.InstructionPrinter","initialization",{initialize:function(method,vm){this.method=method,this.vm=vm}},"printing",{printInstructions:function(indent,highlight,highlightPC){this.indent=indent,this.highlight=highlight,this.highlightPC=highlightPC,this.innerIndents={},this.result="",this.scanner=this.method.methodSignFlag()?new Squeak.InstructionStreamSista(this.method,this.vm):new Squeak.InstructionStream(this.method,this.vm),this.oldPC=this.scanner.pc,this.endPC=0,this.done=!1;try{for(;!this.done;)this.scanner.interpretNextInstructionFor(this)}catch(ex){this.print("!!! "+ex.message)}return this.result},print:function(instruction){this.oldPC===this.highlightPC?this.highlight&&(this.result+=this.highlight):this.indent&&(this.result+=this.indent),this.result+=this.oldPC;for(var i=0;i<this.innerIndents[this.oldPC];i++)this.result+=" ";this.result+=" <";for(i=this.oldPC;i<this.scanner.pc;i++)i>this.oldPC&&(this.result+=" "),this.result+=(this.method.bytes[i]+256).toString(16).substr(-2).toUpperCase();this.result+="> "+instruction+"\n",this.oldPC=this.scanner.pc}},"decoding",{blockReturnConstant:function(obj){this.print("blockReturn: "+obj.toString()),this.done=this.scanner.pc>this.endPC},blockReturnTop:function(){this.print("blockReturn"),this.done=this.scanner.pc>this.endPC},doDup:function(){this.print("dup")},doPop:function(){this.print("pop")},jump:function(offset){this.print("jumpTo: "+(this.scanner.pc+offset)),this.scanner.pc+offset>this.endPC&&(this.endPC=this.scanner.pc+offset)},jumpIf:function(condition,offset){this.print((condition?"jumpIfTrue: ":"jumpIfFalse: ")+(this.scanner.pc+offset)),this.scanner.pc+offset>this.endPC&&(this.endPC=this.scanner.pc+offset)},methodReturnReceiver:function(){this.print("return: receiver"),this.done=this.scanner.pc>this.endPC},methodReturnTop:function(){this.print("return: topOfStack"),this.done=this.scanner.pc>this.endPC},methodReturnConstant:function(obj){this.print("returnConst: "+obj.toString()),this.done=this.scanner.pc>this.endPC},nop:function(){this.print("nop")},popIntoLiteralVariable:function(anAssociation){this.print("popIntoBinding: "+anAssociation.assnKeyAsString())},popIntoReceiverVariable:function(offset){this.print("popIntoInstVar: "+offset)},popIntoTemporaryVariable:function(offset){this.print("popIntoTemp: "+offset)},pushActiveContext:function(){this.print("push: thisContext")},pushConstant:function(obj){var value=obj.sqInstName?obj.sqInstName():obj.toString();this.print("pushConst: "+value)},pushLiteralVariable:function(anAssociation){this.print("pushBinding: "+anAssociation.assnKeyAsString())},pushReceiver:function(){this.print("push: self")},pushReceiverVariable:function(offset){this.print("pushInstVar: "+offset)},pushTemporaryVariable:function(offset){this.print("pushTemp: "+offset)},send:function(selector,numberArguments,supered){this.print((supered?"superSend: #":"send: #")+(selector.bytesAsString?selector.bytesAsString():selector))},sendSuperDirected:function(selector){this.print("directedSuperSend: #"+(selector.bytesAsString?selector.bytesAsString():selector))},storeIntoLiteralVariable:function(anAssociation){this.print("storeIntoBinding: "+anAssociation.assnKeyAsString())},storeIntoReceiverVariable:function(offset){this.print("storeIntoInstVar: "+offset)},storeIntoTemporaryVariable:function(offset){this.print("storeIntoTemp: "+offset)},pushNewArray:function(size){this.print("push: (Array new: "+size+")")},popIntoNewArray:function(numElements){this.print("pop: "+numElements+" into: (Array new: "+numElements+")")},pushRemoteTemp:function(offset,arrayOffset){this.print("push: "+offset+" ofTemp: "+arrayOffset)},storeIntoRemoteTemp:function(offset,arrayOffset){this.print("storeInto: "+offset+" ofTemp: "+arrayOffset)},popIntoRemoteTemp:function(offset,arrayOffset){this.print("popInto: "+offset+" ofTemp: "+arrayOffset)},pushClosureCopy:function(numCopied,numArgs,blockSize){var from=this.scanner.pc,to=from+blockSize;this.print("closure("+from+"-"+(to-1)+"): "+numCopied+" copied, "+numArgs+" args");for(var i=from;i<to;i++)this.innerIndents[i]=(this.innerIndents[i]||0)+1;to>this.endPC&&(this.endPC=to)},pushFullClosure:function(literalIndex,numCopied,numArgs){this.print("pushFullClosure: (self literalAt: "+(literalIndex+1)+") numCopied: "+numCopied+" numArgs: "+numArgs)},callPrimitive:function(primitiveIndex){this.print("primitive: "+primitiveIndex)}})),vm_instruction_printer}var vm_primitives={},hasRequiredVm_primitives;function requireVm_primitives(){return hasRequiredVm_primitives||(hasRequiredVm_primitives=1,Object.subclass("Squeak.Primitives","initialization",{initialize:function(vm,display){this.vm=vm,this.oldPrims=!this.vm.image.hasClosures,this.allowAccessBeyondSP=this.oldPrims,this.deferDisplayUpdates=!1,this.semaphoresToSignal=[],this.initDisplay(display),this.initAtCache(),this.initModules(),this.initPlugins(),vm.image.isSpur&&(this.charFromInt=this.charFromIntSpur,this.charToInt=this.charToIntSpur,this.identityHash=this.identityHashSpur)},initDisplay:function(display){this.display=display},initModules:function(){this.loadedModules={},this.builtinModules={},this.patchModules={},this.interpreterProxy=new Squeak.InterpreterProxy(this.vm)},initPlugins:function(){}},"dispatch",{quickSendOther:function(rcvr,lobits){switch(this.success=!0,lobits){case 0:return this.popNandPushIfOK(2,this.objectAt(!0,!0,!1));case 1:return this.popNandPushIfOK(3,this.objectAtPut(!0,!0,!1));case 2:return this.popNandPushIfOK(1,this.objectSize(!0));case 6:return this.popNandPushBoolIfOK(2,this.vm.stackValue(1)===this.vm.stackValue(0));case 7:return this.popNandPushIfOK(1,this.vm.getClass(this.vm.top()));case 8:return this.popNandPushIfOK(2,this.doBlockCopy());case 9:return this.primitiveBlockValue(0);case 10:return this.primitiveBlockValue(1)}return!1},doPrimitive:function(index,argCount,primMethod){switch(this.success=!0,index){case 1:return this.popNandPushIntIfOK(argCount+1,this.stackInteger(1)+this.stackInteger(0));case 2:return this.popNandPushIntIfOK(argCount+1,this.stackInteger(1)-this.stackInteger(0));case 3:return this.popNandPushBoolIfOK(argCount+1,this.stackInteger(1)<this.stackInteger(0));case 4:return this.popNandPushBoolIfOK(argCount+1,this.stackInteger(1)>this.stackInteger(0));case 5:return this.popNandPushBoolIfOK(argCount+1,this.stackInteger(1)<=this.stackInteger(0));case 6:return this.popNandPushBoolIfOK(argCount+1,this.stackInteger(1)>=this.stackInteger(0));case 7:return this.popNandPushBoolIfOK(argCount+1,this.stackInteger(1)===this.stackInteger(0));case 8:return this.popNandPushBoolIfOK(argCount+1,this.stackInteger(1)!==this.stackInteger(0));case 9:return this.popNandPushIntIfOK(argCount+1,this.stackInteger(1)*this.stackInteger(0));case 10:return this.popNandPushIntIfOK(argCount+1,this.vm.quickDivide(this.stackInteger(1),this.stackInteger(0)));case 11:return this.popNandPushIntIfOK(argCount+1,this.vm.mod(this.stackInteger(1),this.stackInteger(0)));case 12:return this.popNandPushIntIfOK(argCount+1,this.vm.div(this.stackInteger(1),this.stackInteger(0)));case 13:return this.popNandPushIntIfOK(argCount+1,this.stackInteger(1)/this.stackInteger(0)|0);case 14:return this.popNandPushIfOK(argCount+1,this.doBitAnd());case 15:return this.popNandPushIfOK(argCount+1,this.doBitOr());case 16:return this.popNandPushIfOK(argCount+1,this.doBitXor());case 17:return this.popNandPushIfOK(argCount+1,this.doBitShift());case 18:return this.primitiveMakePoint(argCount,!1);case 19:return!1;case 20:return this.primitiveRemLargeIntegers(argCount);case 21:return this.primitiveAddLargeIntegers(argCount);case 22:return this.primitiveSubtractLargeIntegers(argCount);case 23:return this.primitiveLessThanLargeIntegers(argCount);case 24:return this.primitiveGreaterThanLargeIntegers(argCount);case 25:return this.primitiveLessOrEqualLargeIntegers(argCount);case 26:return this.primitiveGreaterOrEqualLargeIntegers(argCount);case 27:return this.primitiveEqualLargeIntegers(argCount);case 28:return this.primitiveNotEqualLargeIntegers(argCount);case 29:return this.primitiveMultiplyLargeIntegers(argCount);case 30:return this.primitiveDivideLargeIntegers(argCount);case 31:return this.primitiveModLargeIntegers(argCount);case 32:return this.primitiveDivLargeIntegers(argCount);case 33:return this.primitiveQuoLargeIntegers(argCount);case 34:return this.vm.warnOnce("missing primitive: 34 (primitiveBitAndLargeIntegers)"),!1;case 35:return this.vm.warnOnce("missing primitive: 35 (primitiveBitOrLargeIntegers)"),!1;case 36:return this.vm.warnOnce("missing primitive: 36 (primitiveBitXorLargeIntegers)"),!1;case 37:return this.vm.warnOnce("missing primitive: 37 (primitiveBitShiftLargeIntegers)"),!1;case 38:return this.popNandPushIfOK(argCount+1,this.objectAt(!1,!1,!1));case 39:return this.popNandPushIfOK(argCount+1,this.objectAtPut(!1,!1,!1));case 40:return this.popNandPushFloatIfOK(argCount+1,this.stackInteger(0));case 41:return this.popNandPushFloatIfOK(argCount+1,this.stackFloat(1)+this.stackFloat(0));case 42:return this.popNandPushFloatIfOK(argCount+1,this.stackFloat(1)-this.stackFloat(0));case 43:return this.popNandPushBoolIfOK(argCount+1,this.stackFloat(1)<this.stackFloat(0));case 44:return this.popNandPushBoolIfOK(argCount+1,this.stackFloat(1)>this.stackFloat(0));case 45:return this.popNandPushBoolIfOK(argCount+1,this.stackFloat(1)<=this.stackFloat(0));case 46:return this.popNandPushBoolIfOK(argCount+1,this.stackFloat(1)>=this.stackFloat(0));case 47:return this.popNandPushBoolIfOK(argCount+1,this.stackFloat(1)===this.stackFloat(0));case 48:return this.popNandPushBoolIfOK(argCount+1,this.stackFloat(1)!==this.stackFloat(0));case 49:return this.popNandPushFloatIfOK(argCount+1,this.stackFloat(1)*this.stackFloat(0));case 50:return this.popNandPushFloatIfOK(argCount+1,this.safeFDiv(this.stackFloat(1),this.stackFloat(0)));case 51:return this.popNandPushIfOK(argCount+1,this.floatAsSmallInt(this.stackFloat(0)));case 52:return this.popNandPushFloatIfOK(argCount+1,this.floatFractionPart(this.stackFloat(0)));case 53:return this.popNandPushIntIfOK(argCount+1,this.frexp_exponent(this.stackFloat(0))-1);case 54:return this.popNandPushFloatIfOK(argCount+1,this.ldexp(this.stackFloat(1),this.stackFloat(0)));case 55:return this.popNandPushFloatIfOK(argCount+1,Math.sqrt(this.stackFloat(0)));case 56:return this.popNandPushFloatIfOK(argCount+1,Math.sin(this.stackFloat(0)));case 57:return this.popNandPushFloatIfOK(argCount+1,Math.atan(this.stackFloat(0)));case 58:return this.popNandPushFloatIfOK(argCount+1,Math.log(this.stackFloat(0)));case 59:return this.popNandPushFloatIfOK(argCount+1,Math.exp(this.stackFloat(0)));case 60:return this.popNandPushIfOK(argCount+1,this.objectAt(!1,!1,!1));case 61:return this.popNandPushIfOK(argCount+1,this.objectAtPut(!1,!1,!1));case 62:return this.popNandPushIfOK(argCount+1,this.objectSize(!1));case 63:return this.popNandPushIfOK(argCount+1,this.objectAt(!1,!0,!1));case 64:return this.popNandPushIfOK(argCount+1,this.objectAtPut(!1,!0,!1));case 65:return this.vm.warnOnce("missing primitive: 65 (primitiveNext)"),!1;case 66:return this.vm.warnOnce("missing primitive: 66 (primitiveNextPut)"),!1;case 67:return this.vm.warnOnce("missing primitive: 67 (primitiveAtEnd)"),!1;case 68:return this.popNandPushIfOK(argCount+1,this.objectAt(!1,!1,!0));case 69:return this.popNandPushIfOK(argCount+1,this.objectAtPut(!1,!1,!0));case 70:return this.popNandPushIfOK(argCount+1,this.instantiateClass(this.stackNonInteger(0),0));case 71:return this.popNandPushIfOK(argCount+1,this.instantiateClass(this.stackNonInteger(1),this.stackPos32BitInt(0)));case 72:return this.primitiveArrayBecome(argCount,!1,!0);case 73:return this.popNandPushIfOK(argCount+1,this.objectAt(!1,!1,!0));case 74:return this.popNandPushIfOK(argCount+1,this.objectAtPut(!1,!1,!0));case 75:return this.popNandPushIfOK(argCount+1,this.identityHash(this.stackNonInteger(0)));case 76:return this.primitiveStoreStackp(argCount);case 77:return this.popNandPushIfOK(argCount+1,this.someInstanceOf(this.stackNonInteger(0)));case 78:return this.popNandPushIfOK(argCount+1,this.nextInstanceAfter(this.stackNonInteger(0)));case 79:return this.primitiveNewMethod(argCount);case 80:return this.popNandPushIfOK(argCount+1,this.doBlockCopy());case 81:return this.primitiveBlockValue(argCount);case 82:return this.primitiveBlockValueWithArgs(argCount);case 83:return this.vm.primitivePerform(argCount);case 84:return this.vm.primitivePerformWithArgs(argCount,!1);case 85:return this.primitiveSignal();case 86:return this.primitiveWait();case 87:return this.primitiveResume();case 88:return this.primitiveSuspend();case 89:return this.vm.flushMethodCache();case 90:return this.primitiveMousePoint(argCount);case 91:return this.primitiveTestDisplayDepth(argCount);case 92:return this.vm.warnOnce("missing primitive: 92 (primitiveSetDisplayMode)"),!1;case 93:return this.primitiveInputSemaphore(argCount);case 94:return this.primitiveGetNextEvent(argCount);case 95:return this.primitiveInputWord(argCount);case 96:return this.namedPrimitive("BitBltPlugin","primitiveCopyBits",argCount);case 97:return this.primitiveSnapshot(argCount);case 98:return this.primitiveStoreImageSegment(argCount);case 99:return this.primitiveLoadImageSegment(argCount);case 100:return this.vm.primitivePerformWithArgs(argCount,!0);case 101:return this.primitiveBeCursor(argCount);case 102:return this.primitiveBeDisplay(argCount);case 103:return this.primitiveScanCharacters(argCount);case 104:return this.vm.warnOnce("missing primitive: 104 (primitiveDrawLoop)"),!1;case 105:return this.popNandPushIfOK(argCount+1,this.doStringReplace());case 106:return this.primitiveScreenSize(argCount);case 107:return this.primitiveMouseButtons(argCount);case 108:return this.primitiveKeyboardNext(argCount);case 109:return this.primitiveKeyboardPeek(argCount);case 110:return this.popNandPushBoolIfOK(argCount+1,this.vm.stackValue(1)===this.vm.stackValue(0));case 111:return this.popNandPushIfOK(argCount+1,this.vm.getClass(this.vm.top()));case 112:return this.popNandPushIfOK(argCount+1,this.vm.image.bytesLeft());case 113:return this.primitiveQuit(argCount);case 114:return this.primitiveExitToDebugger(argCount);case 115:return this.primitiveChangeClass(argCount);case 116:return this.vm.flushMethodCacheForMethod(this.vm.top());case 117:return this.doNamedPrimitive(argCount,primMethod);case 118:return this.primitiveDoPrimitiveWithArgs(argCount);case 119:return this.vm.flushMethodCacheForSelector(this.vm.top());case 120:return this.primitiveCalloutToFFI(argCount,primMethod);case 121:return this.primitiveImageName(argCount);case 122:return this.primitiveReverseDisplay(argCount);case 123:return this.vm.warnOnce("missing primitive: 123 (primitiveValueUninterruptably)"),!1;case 124:return this.popNandPushIfOK(argCount+1,this.registerSemaphore(Squeak.splOb_TheLowSpaceSemaphore));case 125:return this.popNandPushIfOK(argCount+1,this.setLowSpaceThreshold());case 126:return this.primitiveDeferDisplayUpdates(argCount);case 127:return this.primitiveShowDisplayRect(argCount);case 128:return this.primitiveArrayBecome(argCount,!0,!0);case 129:return this.popNandPushIfOK(argCount+1,this.vm.image.specialObjectsArray);case 130:return this.primitiveFullGC(argCount);case 131:return this.primitivePartialGC(argCount);case 132:return this.popNandPushBoolIfOK(argCount+1,this.pointsTo(this.stackNonInteger(1),this.vm.top()));case 133:return this.popNIfOK(argCount);case 134:return this.popNandPushIfOK(argCount+1,this.registerSemaphore(Squeak.splOb_TheInterruptSemaphore));case 135:return this.popNandPushIfOK(argCount+1,this.millisecondClockValue());case 136:return this.primitiveSignalAtMilliseconds(argCount);case 137:return this.popNandPushIfOK(argCount+1,this.secondClock());case 138:return this.popNandPushIfOK(argCount+1,this.someObject());case 139:return this.popNandPushIfOK(argCount+1,this.nextObject(this.vm.top()));case 140:return this.primitiveBeep(argCount);case 141:return this.primitiveClipboardText(argCount);case 142:return this.popNandPushIfOK(argCount+1,this.makeStString(this.filenameToSqueak(Squeak.vmPath)));case 143:case 144:return this.primitiveShortAtAndPut(argCount);case 145:return this.primitiveConstantFill(argCount);case 146:return this.namedPrimitive("JoystickTabletPlugin","primitiveReadJoystick",argCount);case 147:return this.namedPrimitive("BitBltPlugin","primitiveWarpBits",argCount);case 148:return this.popNandPushIfOK(argCount+1,this.vm.image.clone(this.vm.top()));case 149:return this.primitiveGetAttribute(argCount);case 150:if(this.oldPrims)return this.primitiveFileAtEnd(argCount);case 151:if(this.oldPrims)return this.primitiveFileClose(argCount);case 152:if(this.oldPrims)return this.primitiveFileGetPosition(argCount);case 153:if(this.oldPrims)return this.primitiveFileOpen(argCount);case 154:if(this.oldPrims)return this.primitiveFileRead(argCount);case 155:if(this.oldPrims)return this.primitiveFileSetPosition(argCount);case 156:if(this.oldPrims)return this.primitiveFileDelete(argCount);case 157:if(this.oldPrims)return this.primitiveFileSize(argCount);break;case 158:return this.oldPrims?this.primitiveFileWrite(argCount):(this.vm.warnOnce("missing primitive: 158 (primitiveCompareWith)"),!1);case 159:return this.oldPrims?this.primitiveFileRename(argCount):this.popNandPushIntIfOK(argCount+1,1664525*this.stackSigned53BitInt(0)&268435455);case 160:return this.oldPrims?this.primitiveDirectoryCreate(argCount):this.primitiveAdoptInstance(argCount);case 161:return this.oldPrims?this.primitiveDirectoryDelimitor(argCount):(this.vm.warnOnce("missing primitive: 161 (primitiveSetIdentityHash)"),!1);case 162:if(this.oldPrims)return this.primitiveDirectoryLookup(argCount);break;case 163:return this.oldPrims?this.primitiveDirectoryDelete(argCount):(this.vm.warnOnce("missing primitive: 163 (primitiveGetImmutability)"),!1);case 164:return this.popNandPushIfOK(argCount+1,this.vm.trueObj);case 165:case 166:return this.primitiveIntegerAtAndPut(argCount);case 167:return!1;case 168:return this.primitiveCopyObject(argCount);case 169:return this.oldPrims?this.primitiveDirectorySetMacTypeAndCreator(argCount):this.popNandPushBoolIfOK(argCount+1,this.vm.stackValue(1)!==this.vm.stackValue(0));case 170:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundStart",argCount):this.primitiveAsCharacter(argCount);case 171:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundStartWithSemaphore",argCount):this.popNandPushIfOK(argCount+1,this.stackNonInteger(0).hash);case 172:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundStop",argCount):(this.vm.warnOnce("missing primitive: 172 (primitiveFetchMourner)"),this.popNandPushIfOK(argCount,this.vm.nilObj));case 173:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundAvailableSpace",argCount):this.popNandPushIfOK(argCount+1,this.objectAt(!1,!1,!0));case 174:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundPlaySamples",argCount):this.popNandPushIfOK(argCount+1,this.objectAtPut(!1,!1,!0));case 175:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundPlaySilence",argCount):this.vm.image.isSpur?this.popNandPushIfOK(argCount+1,this.behaviorHash(this.stackNonInteger(0))):(this.vm.warnOnce("primitive 175 called in non-spur image"),this.popNandPushIfOK(argCount+1,this.identityHash(this.stackNonInteger(0))));case 176:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primWaveTableSoundmixSampleCountintostartingAtpan",argCount):this.popNandPushIfOK(argCount+1,this.vm.image.isSpur?4194303:4095);case 177:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primFMSoundmixSampleCountintostartingAtpan",argCount):this.popNandPushIfOK(argCount+1,this.allInstancesOf(this.stackNonInteger(0)));case 178:return!!this.oldPrims&&this.namedPrimitive("SoundGenerationPlugin","primPluckedSoundmixSampleCountintostartingAtpan",argCount);case 179:if(this.oldPrims)return this.namedPrimitive("SoundGenerationPlugin","primSampledSoundmixSampleCountintostartingAtpan",argCount);break;case 180:return!!this.oldPrims&&this.namedPrimitive("SoundGenerationPlugin","primitiveMixFMSound",argCount);case 181:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primitiveMixPluckedSound",argCount):this.primitiveSizeInBytesOfInstance(argCount);case 182:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","oldprimSampledSoundmixSampleCountintostartingAtleftVolrightVol",argCount):this.primitiveSizeInBytes(argCount);case 183:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primitiveApplyReverb",argCount):this.primitiveIsPinned(argCount);case 184:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primitiveMixLoopedSampledSound",argCount):this.primitivePin(argCount);case 185:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primitiveMixSampledSound",argCount):this.primitiveExitCriticalSection(argCount);case 186:if(this.oldPrims)break;return this.primitiveEnterCriticalSection(argCount);case 187:if(this.oldPrims)break;return this.primitiveTestAndSetOwnershipOfCriticalSection(argCount);case 188:if(this.oldPrims)break;return this.primitiveExecuteMethodArgsArray(argCount);case 189:return!!this.oldPrims&&this.namedPrimitive("SoundPlugin","primitiveSoundInsertSamples",argCount);case 190:if(this.oldPrims)return this.namedPrimitive("SoundPlugin","primitiveSoundStartRecording",argCount);case 191:if(this.oldPrims)return this.namedPrimitive("SoundPlugin","primitiveSoundStopRecording",argCount);case 192:if(this.oldPrims)return this.namedPrimitive("SoundPlugin","primitiveSoundGetRecordingSampleRate",argCount);case 193:if(this.oldPrims)return this.namedPrimitive("SoundPlugin","primitiveSoundRecordSamples",argCount);case 194:if(this.oldPrims)return this.namedPrimitive("SoundPlugin","primitiveSoundSetRecordLevel",argCount);break;case 195:case 196:case 197:case 198:case 199:return!1;case 200:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveInitializeNetwork",argCount):this.primitiveClosureCopyWithCopiedValues(argCount);case 201:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverStartNameLookup",argCount):this.primitiveClosureValue(argCount);case 202:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverNameLookupResult",argCount):this.primitiveClosureValue(argCount);case 203:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverStartAddressLookup",argCount):this.primitiveClosureValue(argCount);case 204:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverAddressLookupResult",argCount):this.primitiveClosureValue(argCount);case 205:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverAbortLookup",argCount):this.primitiveClosureValue(argCount);case 206:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverLocalAddress",argCount):this.primitiveClosureValueWithArgs(argCount);case 207:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverStatus",argCount):this.primitiveFullClosureValue(argCount);case 208:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverError",argCount):this.primitiveFullClosureValueWithArgs(argCount);case 209:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketCreate",argCount):this.primitiveFullClosureValueNoContextSwitch(argCount);case 210:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketDestroy",argCount):this.popNandPushIfOK(argCount+1,this.objectAt(!1,!1,!1));case 211:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketConnectionStatus",argCount):this.popNandPushIfOK(argCount+1,this.objectAtPut(!1,!1,!1));case 212:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketError",argCount):this.popNandPushIfOK(argCount+1,this.objectSize(!1));case 213:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketLocalAddress",argCount);case 214:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketLocalPort",argCount);case 215:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketRemoteAddress",argCount);case 216:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketRemotePort",argCount);case 217:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketConnectToPort",argCount);case 218:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketListenWithOrWithoutBacklog",argCount):this.primitiveDoNamedPrimitive(argCount);case 219:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketCloseConnection",argCount);case 220:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketAbortConnection",argCount);break;case 221:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketReceiveDataBufCount",argCount):this.primitiveClosureValueNoContextSwitch(argCount);case 222:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketReceiveDataAvailable",argCount):this.primitiveClosureValueNoContextSwitch(argCount);case 223:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketSendDataBufCount",argCount);case 224:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketSendDone",argCount);case 225:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketAccept",argCount);break;case 230:return this.primitiveRelinquishProcessorForMicroseconds(argCount);case 231:return this.primitiveForceDisplayUpdate(argCount);case 232:return this.vm.warnOnce("missing primitive: 232 (primitiveFormPrint)"),!1;case 233:return this.primitiveSetFullScreen(argCount);case 234:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveDecompressFromByteArray",argCount);case 235:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveCompareString",argCount);case 236:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveConvert8BitSigned",argCount);case 237:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveCompressToByteArray",argCount);break;case 238:return this.oldPrims?this.namedPrimitive("SerialPlugin","primitiveSerialPortOpen",argCount):this.namedPrimitive("FloatArrayPlugin","primitiveAt",argCount);case 239:return this.oldPrims?this.namedPrimitive("SerialPlugin","primitiveSerialPortClose",argCount):this.namedPrimitive("FloatArrayPlugin","primitiveAtPut",argCount);case 240:return this.oldPrims?this.namedPrimitive("SerialPlugin","primitiveSerialPortWrite",argCount):this.popNandPushIfOK(argCount+1,this.microsecondClockUTC());case 241:return this.oldPrims?this.namedPrimitive("SerialPlugin","primitiveSerialPortRead",argCount):this.popNandPushIfOK(argCount+1,this.microsecondClockLocal());case 242:if(this.oldPrims)break;return this.primitiveSignalAtUTCMicroseconds(argCount);case 243:return this.oldPrims?this.namedPrimitive("MiscPrimitivePlugin","primitiveTranslateStringWithTable",argCount):(this.vm.warnOnce("missing primitive: 243 (primitiveUpdateTimeZone)"),!1);case 244:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveFindFirstInString",argCount);case 245:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveIndexOfAsciiInString",argCount);case 246:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveFindSubstring",argCount);break;case 248:return this.primitiveArrayBecome(argCount,!1,!1);case 249:return this.primitiveArrayBecome(argCount,!1,!0);case 254:return this.primitiveVMParameter(argCount);case 521:return this.namedPrimitive("MIDIPlugin","primitiveMIDIClosePort",argCount);case 522:return this.namedPrimitive("MIDIPlugin","primitiveMIDIGetClock",argCount);case 523:return this.namedPrimitive("MIDIPlugin","primitiveMIDIGetPortCount",argCount);case 524:return this.namedPrimitive("MIDIPlugin","primitiveMIDIGetPortDirectionality",argCount);case 525:return this.namedPrimitive("MIDIPlugin","primitiveMIDIGetPortName",argCount);case 526:return this.namedPrimitive("MIDIPlugin","primitiveMIDIOpenPort",argCount);case 527:return this.namedPrimitive("MIDIPlugin","primitiveMIDIParameterGetOrSet",argCount);case 528:return this.namedPrimitive("MIDIPlugin","primitiveMIDIRead",argCount);case 529:return this.namedPrimitive("MIDIPlugin","primitiveMIDIWrite",argCount);case 550:return this.namedPrimitive("ADPCMCodecPlugin","primitiveDecodeMono",argCount);case 551:return this.namedPrimitive("ADPCMCodecPlugin","primitiveDecodeStereo",argCount);case 552:return this.namedPrimitive("ADPCMCodecPlugin","primitiveEncodeMono",argCount);case 553:return this.namedPrimitive("ADPCMCodecPlugin","primitiveEncodeStereo",argCount);case 571:return this.primitiveUnloadModule(argCount);case 572:return this.primitiveListBuiltinModule(argCount);case 573:return this.primitiveListLoadedModule(argCount);case 575:return this.vm.warnOnce("missing primitive: 575 (primitiveHighBit)"),!1;case 576:return this.vm.primitiveInvokeObjectAsMethod(argCount,primMethod);case 578:return this.vm.warnOnce("missing primitive: 578 (primitiveSuspendAndBackupPC)"),!1}return console.error("primitive "+index+" not implemented yet"),!1},namedPrimitive:function(modName,functionName,argCount){var mod=""===modName?this:this.loadedModules[modName],justLoaded=!1;void 0===mod&&(mod=this.loadModule(modName),this.loadedModules[modName]=mod,justLoaded=!0);var result=!1,sp=this.vm.sp;if(mod){this.interpreterProxy.argCount=argCount,this.interpreterProxy.primitiveName=functionName;var primitive=mod[functionName];"function"==typeof primitive?result=mod[functionName](argCount):"string"==typeof primitive?result=this[primitive](argCount):this.vm.warnOnce("missing primitive: "+modName+"."+functionName)}else justLoaded&&(this.success?this.vm.warnOnce("missing module: "+modName+" ("+functionName+")"):this.vm.warnOnce("failed to load module: "+modName+" ("+functionName+")"));return(!0===result||!1!==result&&this.success)&&this.vm.sp!==sp-argCount&&!this.vm.frozen&&this.vm.warnOnce("stack unbalanced after primitive "+modName+"."+functionName,"error"),!0===result||!1===result?result:this.success},doNamedPrimitive:function(argCount,primMethod){if(!primMethod.primFunction){if(primMethod.pointersSize()<2)return!1;if(4!==(firstLiteral=primMethod.pointers[1]).pointersSize())return!1;this.primMethod=primMethod;var moduleName=firstLiteral.pointers[0].bytesAsString(),functionName=firstLiteral.pointers[1].bytesAsString();if(primMethod.primFunction=this.loadFunctionFrom(functionName,moduleName),!primMethod.primFunction)return!1}this.interpreterProxy.argCount=argCount;var sp=this.vm.sp,result=primMethod.primFunction(argCount);if((!0===result||!1!==result&&this.success)&&this.vm.sp!==sp-argCount&&!this.vm.frozen){var firstLiteral;moduleName=(firstLiteral=primMethod.pointers[1]).pointers[0].bytesAsString(),functionName=firstLiteral.pointers[1].bytesAsString();this.vm.warnOnce("stack unbalanced after primitive "+moduleName+"."+functionName,"error")}return!0===result||!1===result?result:this.success},fakePrimitive:function(prim,retVal,argCount){return this.vm.warnOnce("faking primitive: "+prim),void 0===retVal?this.vm.popN(argCount):this.vm.popNandPush(argCount+1,this.makeStObject(retVal)),!0}},"modules",{loadModule:function(modName){var mod=Squeak.externalModules[modName]||this.builtinModules[modName]||this.loadModuleDynamically(modName);if(!mod)return null;if(this.patchModules[modName]&&this.patchModule(mod,modName),mod.setInterpreter&&!mod.setInterpreter(this.interpreterProxy))return console.log("Wrong interpreter proxy version: "+modName),null;var initFunc=mod.initialiseModule;return"function"==typeof initFunc?mod.initialiseModule():"string"==typeof initFunc&&this[initFunc](),this.interpreterProxy.failed()?(console.log("Module initialization failed: "+modName),null):(mod.getModuleName&&(modName=mod.getModuleName()),console.log("Loaded module: "+modName),mod)},loadModuleDynamically:function(modName){},patchModule:function(mod,modName){var patch=this.patchModules[modName];for(var key in patch)mod[key]=patch[key]},unloadModule:function(modName){var mod=this.loadedModules[modName];if(!modName||!mod||mod===this)return null;delete this.loadedModules[modName];var unloadFunc=mod.unloadModule;return"function"==typeof unloadFunc?mod.unloadModule(this):"string"==typeof unloadFunc&&this[unloadFunc](this),console.log("Unloaded module: "+modName),mod},loadFunctionFrom:function(functionName,modName){var mod=""===modName?this:this.loadedModules[modName];if(void 0===mod&&(mod=this.loadModule(modName),this.loadedModules[modName]=mod),!mod)return null;var func=mod[functionName];return"function"==typeof func?func.bind(mod):"string"==typeof func?this[func].bind(this):(this.vm.warnOnce("missing primitive: "+modName+"."+functionName),null)},primitiveUnloadModule:function(argCount){var moduleName=this.stackNonInteger(0).bytesAsString();return!!moduleName&&(this.unloadModule(moduleName),this.popNIfOK(argCount))},primitiveListBuiltinModule:function(argCount){var index=this.stackInteger(0)-1;if(!this.success)return!1;var moduleNames=Object.keys(this.builtinModules);return this.popNandPushIfOK(argCount+1,this.makeStObject(moduleNames[index]))},primitiveListLoadedModule:function(argCount){var index=this.stackInteger(0)-1;if(!this.success)return!1;var moduleNames=[];for(var key in this.loadedModules){var module=this.loadedModules[key];if(module){var moduleName=module.getModuleName?module.getModuleName():key;moduleNames.push(moduleName)}}return this.popNandPushIfOK(argCount+1,this.makeStObject(moduleNames[index]))}},"stack access",{popNIfOK:function(nToPop){return!!this.success&&(this.vm.popN(nToPop),!0)},pop2andPushBoolIfOK:function(bool){return this.vm.success=this.success,this.vm.pop2AndPushBoolResult(bool)},popNandPushBoolIfOK:function(nToPop,bool){return!!this.success&&(this.vm.popNandPush(nToPop,bool?this.vm.trueObj:this.vm.falseObj),!0)},popNandPushIfOK:function(nToPop,returnValue){return!(!this.success||null==returnValue)&&(this.vm.popNandPush(nToPop,returnValue),!0)},popNandPushIntIfOK:function(nToPop,returnValue){return!(!this.success||!this.vm.canBeSmallInt(returnValue))&&(this.vm.popNandPush(nToPop,returnValue),!0)},popNandPushFloatIfOK:function(nToPop,returnValue){return!!this.success&&(this.vm.popNandPush(nToPop,this.makeFloat(returnValue)),!0)},stackNonInteger:function(nDeep){return this.checkNonInteger(this.vm.stackValue(nDeep))},stackInteger:function(nDeep){return this.checkSmallInt(this.vm.stackValue(nDeep))},stackPos32BitInt:function(nDeep){return this.positive32BitValueOf(this.vm.stackValue(nDeep))},pos32BitIntFor:function(signed32){if(signed32>=0&&signed32<=Squeak.MaxSmallInt)return signed32;for(var lgIntClass=this.vm.specialObjects[Squeak.splOb_ClassLargePositiveInteger],lgIntObj=this.vm.instantiateClass(lgIntClass,4),bytes=lgIntObj.bytes,i=0;i<4;i++)bytes[i]=signed32>>>8*i&255;return lgIntObj},pos53BitIntFor:function(longlong){if(longlong<=4294967295)return this.pos32BitIntFor(longlong);if(longlong>9007199254740991)return console.warn("Out of range: pos53BitIntFor("+longlong+")"),this.success=!1,0;for(var sz=longlong<=0xffffffffff?5:longlong<=0xffffffffffff?6:7,lgIntClass=this.vm.specialObjects[Squeak.splOb_ClassLargePositiveInteger],lgIntObj=this.vm.instantiateClass(lgIntClass,sz),bytes=lgIntObj.bytes,i=0;i<sz;i++)bytes[i]=255&longlong,longlong/=256;return lgIntObj},stackSigned32BitInt:function(nDeep){var stackVal=this.vm.stackValue(nDeep);if("number"==typeof stackVal)return stackVal;if(4!==stackVal.bytesSize())return this.success=!1,0;for(var bytes=stackVal.bytes,value=0,i=0,f=1;i<4;i++,f*=256)value+=bytes[i]*f;return this.isA(stackVal,Squeak.splOb_ClassLargePositiveInteger)&&value<=2147483647?value:this.isA(stackVal,Squeak.splOb_ClassLargeNegativeInteger)&&-value>=-2147483648?-value:(this.success=!1,0)},signed32BitIntegerFor:function(signed32){if(signed32>=Squeak.MinSmallInt&&signed32<=Squeak.MaxSmallInt)return signed32;for(var negative=signed32<0,unsigned=negative?-signed32:signed32,lgIntClass=negative?Squeak.splOb_ClassLargeNegativeInteger:Squeak.splOb_ClassLargePositiveInteger,lgIntObj=this.vm.instantiateClass(this.vm.specialObjects[lgIntClass],4),bytes=lgIntObj.bytes,i=0;i<4;i++)bytes[i]=unsigned>>>8*i&255;return lgIntObj},stackFloat:function(nDeep){return this.checkFloat(this.vm.stackValue(nDeep))},stackBoolean:function(nDeep){return this.checkBoolean(this.vm.stackValue(nDeep))},stackSigned53BitInt:function(nDeep){var stackVal=this.vm.stackValue(nDeep);if("number"==typeof stackVal)return stackVal;var n=stackVal.bytesSize();if(n<=7){for(var bytes=stackVal.bytes,value=0,i=0,f=1;i<n;i++,f*=256)value+=bytes[i]*f;if(value<=9007199254740991){if(this.isA(stackVal,Squeak.splOb_ClassLargePositiveInteger))return value;if(this.isA(stackVal,Squeak.splOb_ClassLargeNegativeInteger))return-value}}return this.success=!1,0}},"numbers",{doBitAnd:function(){var rcvr=this.stackPos32BitInt(1),arg=this.stackPos32BitInt(0);return this.success?this.pos32BitIntFor(rcvr&arg):0},doBitOr:function(){var rcvr=this.stackPos32BitInt(1),arg=this.stackPos32BitInt(0);return this.success?this.pos32BitIntFor(rcvr|arg):0},doBitXor:function(){var rcvr=this.stackPos32BitInt(1),arg=this.stackPos32BitInt(0);return this.success?this.pos32BitIntFor(rcvr^arg):0},doBitShift:function(){var result,rcvr=this.stackPos32BitInt(1),arg=this.stackInteger(0);if(!this.success)return 0;if(arg<0){if(arg<-31)return 0;result=rcvr>>>-arg}else{if(arg>31)return this.success=!1,0;if((result=rcvr<<arg)>>>arg!==rcvr)return this.success=!1,0}return this.pos32BitIntFor(result)},safeFDiv:function(dividend,divisor){return 0===divisor?(this.success=!1,1):dividend/divisor},floatAsSmallInt:function(float){var truncated=float>=0?Math.floor(float):Math.ceil(float);return this.ensureSmallInt(truncated)},floatFractionPart:function(float){return-9007199254740991<=float&&float<=9007199254740991?float-Math.floor(float):(this.success=!1,0)},frexp_exponent:function(value){if(0==value)return 0;var data=new DataView(new ArrayBuffer(8));data.setFloat64(0,value);var bits=data.getUint32(0)>>>20&2047;return 0===bits&&(data.setFloat64(0,value*Math.pow(2,64)),bits=(data.getUint32(0)>>>20&2047)-64),bits-1022},ldexp:function(mantissa,exponent){for(var steps=Math.min(3,Math.ceil(Math.abs(exponent)/1023)),result=mantissa,i=0;i<steps;i++)result*=Math.pow(2,Math.floor((exponent+i)/steps));return result},primitiveRemLargeIntegers:function(argCount){return this.popNandPushIfOK(argCount+1,this.makeStObject(this.stackSigned53BitInt(1)%this.stackSigned53BitInt(0)))},primitiveAddLargeIntegers:function(argCount){return this.popNandPushIfOK(argCount+1,this.makeStObject(this.stackSigned53BitInt(1)+this.stackSigned53BitInt(0)))},primitiveSubtractLargeIntegers:function(argCount){return this.popNandPushIfOK(argCount+1,this.makeStObject(this.stackSigned53BitInt(1)-this.stackSigned53BitInt(0)))},primitiveLessThanLargeIntegers:function(argCount){return this.popNandPushBoolIfOK(argCount+1,this.stackSigned53BitInt(1)<this.stackSigned53BitInt(0))},primitiveGreaterThanLargeIntegers:function(argCount){return this.popNandPushBoolIfOK(argCount+1,this.stackSigned53BitInt(1)>this.stackSigned53BitInt(0))},primitiveLessOrEqualLargeIntegers:function(argCount){return this.popNandPushBoolIfOK(argCount+1,this.stackSigned53BitInt(1)<=this.stackSigned53BitInt(0))},primitiveGreaterOrEqualLargeIntegers:function(argCount){return this.popNandPushBoolIfOK(argCount+1,this.stackSigned53BitInt(1)>=this.stackSigned53BitInt(0))},primitiveEqualLargeIntegers:function(argCount){return this.popNandPushBoolIfOK(argCount+1,this.stackSigned53BitInt(1)===this.stackSigned53BitInt(0))},primitiveNotEqualLargeIntegers:function(argCount){return this.popNandPushBoolIfOK(argCount+1,this.stackSigned53BitInt(1)!==this.stackSigned53BitInt(0))},primitiveMultiplyLargeIntegers:function(argCount){return this.popNandPushIfOK(argCount+1,this.makeStObject(this.stackSigned53BitInt(1)*this.stackSigned53BitInt(0)))},primitiveDivideLargeIntegers:function(argCount){return this.popNandPushIfOK(argCount+1,this.makeStObject(this.stackSigned53BitInt(1)/this.stackSigned53BitInt(0)))},primitiveModLargeIntegers:function(argCount){return this.popNandPushIfOK(argCount+1,this.makeStObject(Math.floor(this.stackSigned53BitInt(1)%this.stackSigned53BitInt(0))))},primitiveDivLargeIntegers:function(argCount){return this.popNandPushIfOK(argCount+1,this.makeStObject(Math.floor(this.stackSigned53BitInt(1)/this.stackSigned53BitInt(0))))},primitiveQuoLargeIntegers:function(argCount){return this.popNandPushIfOK(argCount+1,this.makeStObject(Math.trunc(this.stackSigned53BitInt(1)/this.stackSigned53BitInt(0))))}},"utils",{floatOrInt:function(obj){return obj.isFloat?obj.float:"number"==typeof obj?obj:0},positive32BitValueOf:function(obj){if("number"==typeof obj)return obj>=0?obj:(this.success=!1,0);if(!this.isA(obj,Squeak.splOb_ClassLargePositiveInteger)||4!==obj.bytesSize())return this.success=!1,0;for(var bytes=obj.bytes,value=0,i=0,f=1;i<4;i++,f*=256)value+=bytes[i]*f;return value},checkFloat:function(maybeFloat){return maybeFloat.isFloat?maybeFloat.float:"number"==typeof maybeFloat?maybeFloat:(this.success=!1,0)},checkSmallInt:function(maybeSmall){return"number"==typeof maybeSmall?maybeSmall:(this.success=!1,0)},checkNonInteger:function(obj){return"number"!=typeof obj?obj:(this.success=!1,this.vm.nilObj)},checkBoolean:function(obj){return!!obj.isTrue||!obj.isFalse&&(this.success=!1)},indexableSize:function(obj){return"number"==typeof obj?-1:obj.indexableSize(this)},isA:function(obj,knownClass){return obj.sqClass===this.vm.specialObjects[knownClass]},isKindOf:function(obj,knownClass){for(var classOrSuper=obj.sqClass,theClass=this.vm.specialObjects[knownClass];!classOrSuper.isNil;){if(classOrSuper===theClass)return!0;classOrSuper=classOrSuper.pointers[Squeak.Class_superclass]}return!1},isAssociation:function(obj){return"number"!=typeof obj&&2==obj.pointersSize()},ensureSmallInt:function(number){return number===(0|number)&&this.vm.canBeSmallInt(number)?number:(this.success=!1,0)},charFromInt:function(ascii){var char=this.vm.specialObjects[Squeak.splOb_CharacterTable].pointers[ascii];if(char)return char;var charClass=this.vm.specialObjects[Squeak.splOb_ClassCharacter];return(char=this.vm.instantiateClass(charClass,0)).pointers[0]=ascii,char},charFromIntSpur:function(unicode){return this.vm.image.getCharacter(unicode)},charToInt:function(obj){return obj.pointers[0]},charToIntSpur:function(obj){return obj.hash},makeFloat:function(value){var floatClass=this.vm.specialObjects[Squeak.splOb_ClassFloat],newFloat=this.vm.instantiateClass(floatClass,2);return newFloat.float=value,newFloat},makeLargeIfNeeded:function(integer){return this.vm.canBeSmallInt(integer)?integer:this.makeLargeInt(integer)},makeLargeInt:function(integer){if(integer<0)throw Error("negative large ints not implemented yet");if(integer>4294967295)throw Error("large large ints not implemented yet");return this.pos32BitIntFor(integer)},makePointWithXandY:function(x,y){var pointClass=this.vm.specialObjects[Squeak.splOb_ClassPoint],newPoint=this.vm.instantiateClass(pointClass,0);return newPoint.pointers[Squeak.Point_x]=x,newPoint.pointers[Squeak.Point_y]=y,newPoint},makeStArray:function(jsArray,proxyClass){for(var array=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassArray],jsArray.length),i=0;i<jsArray.length;i++)array.pointers[i]=this.makeStObject(jsArray[i],proxyClass);return array},makeStByteArray:function(jsArray){for(var array=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassByteArray],jsArray.length),i=0;i<jsArray.length;i++)array.bytes[i]=255&jsArray[i];return array},makeStString:function(jsString){for(var stString=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassString],jsString.length),i=0;i<jsString.length;++i)stString.bytes[i]=255&jsString.charCodeAt(i);return stString},makeStStringFromBytes:function(bytes,zeroTerminated){var length=bytes.length;zeroTerminated&&(length=bytes.indexOf(0))<0&&(length=bytes.length);for(var stString=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassString],length),i=0;i<length;++i)stString.bytes[i]=bytes[i];return stString},makeStObject:function(obj,proxyClass){if(null==obj)return this.vm.nilObj;if(!0===obj)return this.vm.trueObj;if(!1===obj)return this.vm.falseObj;if(obj.sqClass)return obj;if("number"==typeof obj)return obj===(0|obj)?this.makeLargeIfNeeded(obj):this.makeFloat(obj);if(proxyClass){var stObj=this.vm.instantiateClass(proxyClass,0);return stObj.jsObject=obj,stObj}if("string"==typeof obj||"Uint8Array"===obj.constructor.name)return this.makeStString(obj);if("Array"===obj.constructor.name)return this.makeStArray(obj);throw Error("cannot make smalltalk object")},pointsTo:function(rcvr,arg){return!!rcvr.pointers&&rcvr.pointers.indexOf(arg)>=0},asUint8Array:function(buffer){if("Uint8Array"===buffer.constructor.name)return buffer;if("ArrayBuffer"===buffer.constructor.name)return new Uint8Array(buffer);if("string"==typeof buffer){for(var array=new Uint8Array(buffer.length),i=0;i<buffer.length;i++)array[i]=buffer.charCodeAt(i);return array}throw Error("unknown buffer type")},filenameToSqueak:function(unixpath){var filepath="/SqueakJS"+("/"!==unixpath[0]?"/":"")+unixpath;return this.emulateMac&&(filepath=("Macintosh HD"+filepath).replace(/\//g,"€").replace(/:/g,"/").replace(/€/g,":")),filepath},filenameFromSqueak:function(filepath){var unixpath=this.emulateMac?filepath.replace(/^[^:]*:/,":").replace(/\//g,"€").replace(/:/g,"/").replace(/€/g,":"):filepath;return unixpath=unixpath.replace(/^\/*SqueakJS\/?/,"/")}},"indexing",{objectAt:function(cameFromBytecode,convertChars,includeInstVars){var info,array=this.stackNonInteger(1),index=this.stackPos32BitInt(0);if(!this.success)return array;if(cameFromBytecode){if((info=this.atCache[array.hash&this.atCacheMask]).array!==array)return this.success=!1,array}else{if(array.isFloat){var floatData=array.floatData();return 1==index?this.pos32BitIntFor(floatData.getUint32(0,!1)):2==index?this.pos32BitIntFor(floatData.getUint32(4,!1)):(this.success=!1,array)}info=this.makeAtCacheInfo(this.atCache,this.vm.specialSelectors[32],array,convertChars,includeInstVars)}if(index<1||index>info.size)return this.success=!1,array;if(includeInstVars)return array.pointers[index-1];if(array.isPointers())return array.pointers[index-1+info.ivarOffset];if(array.isWords())return info.convertChars?this.charFromInt(1073741823&array.words[index-1]):this.pos32BitIntFor(array.words[index-1]);if(array.isBytes())return info.convertChars?this.charFromInt(255&array.bytes[index-1]):255&array.bytes[index-1];var offset=4*array.pointersSize();return index-1-offset<0?(this.success=!1,array):255&array.bytes[index-1-offset]},objectAtPut:function(cameFromBytecode,convertChars,includeInstVars){var info,array=this.stackNonInteger(2),index=this.stackPos32BitInt(1);if(!this.success)return array;if(cameFromBytecode){if((info=this.atPutCache[array.hash&this.atCacheMask]).array!==array)return this.success=!1,array}else{if(array.isFloat){var wordToPut=this.stackPos32BitInt(0);if(!this.success||1!=index&&2!=index)this.success=!1;else{var floatData=array.floatData();floatData.setUint32(1==index?0:4,wordToPut,!1),array.float=floatData.getFloat64(0)}return this.vm.stackValue(0)}info=this.makeAtCacheInfo(this.atPutCache,this.vm.specialSelectors[34],array,convertChars,includeInstVars)}if(index<1||index>info.size)return this.success=!1,array;var intToPut,objToPut=this.vm.stackValue(0);if(includeInstVars)return array.dirty=!0,array.pointers[index-1]=objToPut;if(array.isPointers())return array.dirty=!0,array.pointers[index-1+info.ivarOffset]=objToPut;if(array.isWords()){if(convertChars){if(objToPut.sqClass!==this.vm.specialObjects[Squeak.splOb_ClassCharacter])return this.success=!1,objToPut;if("number"!=typeof(intToPut=this.charToInt(objToPut)))return this.success=!1,objToPut}else intToPut=this.stackPos32BitInt(0);return this.success&&(array.words[index-1]=intToPut),objToPut}if(convertChars){if(objToPut.sqClass!==this.vm.specialObjects[Squeak.splOb_ClassCharacter])return this.success=!1,objToPut;if("number"!=typeof(intToPut=this.charToInt(objToPut)))return this.success=!1,objToPut}else{if("number"!=typeof objToPut)return this.success=!1,objToPut;intToPut=objToPut}if(intToPut<0||intToPut>255)return this.success=!1,objToPut;if(array.isBytes())return array.bytes[index-1]=intToPut,objToPut;var offset=4*array.pointersSize();return index-1-offset<0?(this.success=!1,array):(array.bytes[index-1-offset]=intToPut,objToPut)},objectSize:function(cameFromBytecode){var rcvr=this.vm.stackValue(0),size=-1;return cameFromBytecode?rcvr.sqClass===this.vm.specialObjects[Squeak.splOb_ClassArray]?size=rcvr.pointersSize():rcvr.sqClass===this.vm.specialObjects[Squeak.splOb_ClassString]&&(size=rcvr.bytesSize()):size=this.indexableSize(rcvr),-1===size?(this.success=!1,-1):this.pos32BitIntFor(size)},initAtCache:function(){this.atCacheSize=32,this.atCacheMask=this.atCacheSize-1,this.atCache=[],this.atPutCache=[],this.nonCachedInfo={};for(var i=0;i<this.atCacheSize;i++)this.atCache.push({}),this.atPutCache.push({})},makeAtCacheInfo:function(atOrPutCache,atOrPutSelector,array,convertChars,includeInstVars){var info;return(info=this.vm.verifyAtSelector===atOrPutSelector&&this.vm.verifyAtClass===array.sqClass&&!this.vm.isContext(array)?atOrPutCache[array.hash&this.atCacheMask]:this.nonCachedInfo).array=array,info.convertChars=convertChars,includeInstVars?(info.size=array.instSize()+Math.max(0,array.indexableSize(this)),info.ivarOffset=0):(info.size=array.indexableSize(this),info.ivarOffset=array.isPointers()?array.instSize():0),info}},"basic",{instantiateClass:function(clsObj,indexableSize){return 4*indexableSize>this.vm.image.bytesLeft()?(console.warn("squeak: out of memory, failing allocation"),this.success=!1,this.vm.primFailCode=Squeak.PrimErrNoMemory,null):this.vm.instantiateClass(clsObj,indexableSize)},someObject:function(){return this.vm.image.firstOldObject},nextObject:function(obj){return this.vm.image.objectAfter(obj)||0},someInstanceOf:function(clsObj){var someInstance=this.vm.image.someInstanceOf(clsObj);return someInstance||(this.success=!1,0)},nextInstanceAfter:function(obj){var nextInstance=this.vm.image.nextInstanceAfter(obj);return nextInstance||(this.success=!1,0)},allInstancesOf:function(clsObj){var instances=this.vm.image.allInstancesOf(clsObj),array=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassArray],instances.length);return array.pointers=instances,array},identityHash:function(obj){return obj.hash},identityHashSpur:function(obj){var hash=obj.hash;return hash>0?hash:obj.hash=this.newObjectHash()},behaviorHash:function(obj){var hash=obj.hash;return hash>0?hash:this.vm.image.enterIntoClassTable(obj)},newObjectHash:function(obj){return Math.floor(4194302*Math.random())+1},primitivePin:function(argCount){var rcvr=this.stackNonInteger(1),pin=this.stackBoolean(0);if(!this.success)return!1;var wasPinned=rcvr.pinned;return rcvr.pinned=pin,this.popNandPushIfOK(argCount+1,this.makeStObject(!!wasPinned))},primitiveIsPinned:function(argCount){var rcvr=this.stackNonInteger(0);return!!this.success&&this.popNandPushIfOK(argCount+1,this.makeStObject(!!rcvr.pinned))},primitiveSizeInBytesOfInstance:function(argCount){if(argCount>1)return!1;var classObj=this.stackNonInteger(argCount),nElements=argCount?this.stackInteger(0):0,bytes=classObj.classByteSizeOfInstance(nElements);return this.popNandPushIfOK(argCount+1,this.makeLargeIfNeeded(bytes))},primitiveSizeInBytes:function(argCount){var bytes=this.stackNonInteger(0).totalBytes();return this.popNandPushIfOK(argCount+1,this.makeLargeIfNeeded(bytes))},primitiveAsCharacter:function(argCount){var unicode=this.stackInteger(0);if(unicode<0||unicode>1073741823)return!1;var char=this.charFromInt(unicode);return!!char&&this.popNandPushIfOK(argCount+1,char)},primitiveFullGC:function(argCount){this.vm.image.fullGC("primitive");var bytes=this.vm.image.bytesLeft();return this.popNandPushIfOK(argCount+1,this.makeLargeIfNeeded(bytes))},primitivePartialGC:function(argCount){for(var young=this.vm.image.partialGC("primitive"),youngSpaceBytes=0;young;)youngSpaceBytes+=young.totalBytes(),young=young.nextObject;console.log(" old space: "+this.vm.image.oldSpaceBytes.toLocaleString()+" bytes, young space: "+youngSpaceBytes.toLocaleString()+" bytes, total: "+(this.vm.image.oldSpaceBytes+youngSpaceBytes).toLocaleString()+" bytes");var bytes=this.vm.image.bytesLeft()-youngSpaceBytes;return this.popNandPushIfOK(argCount+1,this.makeLargeIfNeeded(bytes))},primitiveMakePoint:function(argCount,checkNumbers){var x=this.vm.stackValue(1),y=this.vm.stackValue(0);return!(checkNumbers&&(this.checkFloat(x),this.checkFloat(y),!this.success))&&(this.vm.popNandPush(1+argCount,this.makePointWithXandY(x,y)),!0)},primitiveStoreStackp:function(argCount){var ctxt=this.stackNonInteger(1),newStackp=this.stackInteger(0);if(!this.success||newStackp<0||this.vm.decodeSqueakSP(newStackp)>=ctxt.pointers.length)return!1;for(var stackp=ctxt.pointers[Squeak.Context_stackPointer];stackp<newStackp;)ctxt.pointers[this.vm.decodeSqueakSP(++stackp)]=this.vm.nilObj;return ctxt.pointers[Squeak.Context_stackPointer]=newStackp,this.vm.popN(argCount),!0},primitiveChangeClass:function(argCount){if(argCount>2)return!1;var rcvr=this.stackNonInteger(1),arg=this.stackNonInteger(0);return!!this.changeClassTo(rcvr,arg.sqClass)&&this.popNIfOK(argCount)},primitiveAdoptInstance:function(argCount){if(argCount>2)return!1;var cls=this.stackNonInteger(1),obj=this.stackNonInteger(0);return!!this.changeClassTo(obj,cls)&&this.popNIfOK(argCount)},changeClassTo:function(rcvr,cls){if(rcvr.sqClass.isCompact!==cls.isCompact)return!1;var classInstIsPointers=cls.classInstIsPointers();if(rcvr.isPointers()){if(!classInstIsPointers)return!1;if(rcvr.sqClass.classInstSize()!==cls.classInstSize())return!1}else{if(classInstIsPointers)return!1;var hasBytes=rcvr.isBytes(),needBytes=cls.classInstIsBytes();if(hasBytes&&!needBytes){if(rcvr.bytes){if(3&rcvr.bytes.length)return!1;rcvr.words=new Uint32Array(rcvr.bytes.buffer),delete rcvr.bytes}}else!hasBytes&&needBytes&&rcvr.words&&(rcvr.bytes=new Uint8Array(rcvr.words.buffer),delete rcvr.words)}return rcvr._format=cls.classInstFormat(),rcvr.sqClass=cls,!0},primitiveDoPrimitiveWithArgs:function(argCount){var argumentArray=this.stackNonInteger(0),primIdx=this.stackInteger(1);if(!this.success)return!1;var arraySize=argumentArray.pointersSize(),cntxSize=this.vm.activeContext.pointersSize();if(this.vm.sp+arraySize>=cntxSize)return!1;this.vm.popN(2);for(var i=0;i<arraySize;i++)this.vm.push(argumentArray.pointers[i]);return!!this.vm.tryPrimitive(primIdx,arraySize)||(this.vm.popN(arraySize),this.vm.push(primIdx),this.vm.push(argumentArray),!1)},primitiveDoNamedPrimitive:function(argCount){var argumentArray=this.stackNonInteger(0),rcvr=this.stackNonInteger(1),primMethod=this.stackNonInteger(2);if(!this.success)return!1;var arraySize=argumentArray.pointersSize(),cntxSize=this.vm.activeContext.pointersSize();if(this.vm.sp+arraySize>=cntxSize)return!1;this.vm.popN(3),this.vm.push(rcvr);for(var i=0;i<arraySize;i++)this.vm.push(argumentArray.pointers[i]);return!!this.doNamedPrimitive(arraySize,primMethod)||(this.vm.popN(arraySize+1),this.vm.push(primMethod),this.vm.push(rcvr),this.vm.push(argumentArray),!1)},primitiveShortAtAndPut:function(argCount){var value,rcvr=this.stackNonInteger(argCount),index=this.stackInteger(argCount-1)-1,array=rcvr.wordsAsInt16Array();if(!this.success||!array||index<0||index>=array.length)return!1;if(argCount<2)value=array[index];else{if((value=this.stackInteger(0))<-32768||value>32767)return!1;array[index]=value}return this.popNandPushIfOK(argCount+1,value),!0},primitiveIntegerAtAndPut:function(argCount){var value,rcvr=this.stackNonInteger(argCount),index=this.stackInteger(argCount-1)-1,array=rcvr.wordsAsInt32Array();if(!this.success||!array||index<0||index>=array.length)return!1;if(argCount<2)value=this.signed32BitIntegerFor(array[index]);else{if(value=this.stackSigned32BitInt(0),!this.success)return!1;array[index]=value}return this.popNandPushIfOK(argCount+1,value),!0},primitiveConstantFill:function(argCount){var rcvr=this.stackNonInteger(1),value=this.stackPos32BitInt(0);if(!this.success||!rcvr.isWordsOrBytes())return!1;var array=rcvr.words||rcvr.bytes;if(array){if(array===rcvr.bytes&&value>255)return!1;for(var i=0;i<array.length;i++)array[i]=value}return this.vm.popN(argCount),!0},primitiveNewMethod:function(argCount){var header=this.stackInteger(0),bytecodeCount=this.stackInteger(1);if(!this.success)return 0;var method=this.vm.instantiateClass(this.vm.stackValue(2),bytecodeCount);method.pointers=[header];for(var litCount=method.methodNumLits(),i=0;i<litCount;i++)method.pointers.push(this.vm.nilObj);return this.vm.popNandPush(1+argCount,method),this.vm.breakOnNewMethod&&(this.vm.breakOnMethod=method),!0},primitiveExecuteMethodArgsArray:function(argCount){var methodObj=this.stackNonInteger(0),argsArray=this.stackNonInteger(1),receiver=this.vm.stackValue(2);if(!this.success||!methodObj.isMethod()||argCount>4)return!1;var numArgs=methodObj.methodNumArgs();if(numArgs!==argsArray.pointersSize())return!1;this.vm.popNandPush(argCount+1,receiver);for(var i=0;i<numArgs;i++)this.vm.push(argsArray.pointers[i]);return this.vm.executeNewMethod(receiver,methodObj,numArgs,methodObj.methodPrimitiveIndex(),null,null),!0},primitiveArrayBecome:function(argCount,doBothWays,copyHash){var rcvr=this.stackNonInteger(argCount),arg=this.stackNonInteger(argCount-1);return argCount>1&&(copyHash=this.stackBoolean(argCount-2)),!!this.success&&(this.success=this.vm.image.bulkBecome(rcvr.pointers,arg.pointers,doBothWays,copyHash),this.popNIfOK(argCount))},doStringReplace:function(){var dst=this.stackNonInteger(4),dstPos=this.stackInteger(3)-1,count=this.stackInteger(2)-dstPos,src=this.stackNonInteger(1),srcPos=this.stackInteger(0)-1;if(!this.success)return dst;if(!src.sameFormatAs(dst))return this.success=!1,dst;if(src.isPointers()){var totalLength=src.pointersSize();if((srcPos+=src.instSize())<0||srcPos+count>totalLength)return this.success=!1,dst;if(totalLength=dst.pointersSize(),(dstPos+=dst.instSize())<0||dstPos+count>totalLength)return this.success=!1,dst;for(var i=0;i<count;i++)dst.pointers[dstPos+i]=src.pointers[srcPos+i];return dst}if(src.isWords()){totalLength=src.wordsSize();if(srcPos<0||srcPos+count>totalLength)return this.success=!1,dst;if(totalLength=dst.wordsSize(),dstPos<0||dstPos+count>totalLength)return this.success=!1,dst;if(src.isFloat&&dst.isFloat)dst.float=src.float;else if(src.isFloat)dst.wordsAsFloat64Array()[dstPos]=src.float;else if(dst.isFloat)dst.float=src.wordsAsFloat64Array()[srcPos];else for(i=0;i<count;i++)dst.words[dstPos+i]=src.words[srcPos+i];return dst}totalLength=src.bytesSize();if(srcPos<0||srcPos+count>totalLength)return this.success=!1,dst;if(totalLength=dst.bytesSize(),dstPos<0||dstPos+count>totalLength)return this.success=!1,dst;for(i=0;i<count;i++)dst.bytes[dstPos+i]=src.bytes[srcPos+i];return dst},primitiveCopyObject:function(argCount){var rcvr=this.stackNonInteger(1),arg=this.stackNonInteger(0),length=rcvr.pointersSize();if(!this.success||rcvr.isWordsOrBytes()||rcvr.sqClass!==arg.sqClass||length!==arg.pointersSize())return!1;for(var i=0;i<length;i++)rcvr.pointers[i]=arg.pointers[i];return rcvr.dirty=arg.dirty,this.vm.popN(argCount),!0},primitiveStoreImageSegment:function(argCount){var arrayOfRoots=this.stackNonInteger(2),segmentWordArray=this.stackNonInteger(1),outPointerArray=this.stackNonInteger(0);return!!(arrayOfRoots.pointers&&segmentWordArray.words&&outPointerArray.pointers)&&(!!this.vm.image.storeImageSegment(segmentWordArray,outPointerArray,arrayOfRoots)&&(this.vm.popN(argCount),!0))},primitiveLoadImageSegment:function(argCount){var segmentWordArray=this.stackNonInteger(1),outPointerArray=this.stackNonInteger(0);if(!segmentWordArray.words||!outPointerArray.pointers)return!1;var roots=this.vm.image.loadImageSegment(segmentWordArray,outPointerArray);return!!roots&&this.popNandPushIfOK(argCount+1,roots)}},"blocks/closures",{doBlockCopy:function(){var rcvr=this.vm.stackValue(1),sqArgCount=this.stackInteger(0),homeCtxt=rcvr;if(this.vm.isContext(homeCtxt)||(this.success=!1),!this.success)return rcvr;"number"==typeof homeCtxt.pointers[Squeak.Context_method]&&(homeCtxt=homeCtxt.pointers[Squeak.BlockContext_home]);var blockSize=homeCtxt.pointersSize()-homeCtxt.instSize(),newBlock=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassBlockContext],blockSize),initialPC=this.vm.encodeSqueakPC(this.vm.pc+2,this.vm.method);return newBlock.pointers[Squeak.BlockContext_initialIP]=initialPC,newBlock.pointers[Squeak.Context_instructionPointer]=initialPC,newBlock.pointers[Squeak.Context_stackPointer]=0,newBlock.pointers[Squeak.BlockContext_argumentCount]=sqArgCount,newBlock.pointers[Squeak.BlockContext_home]=homeCtxt,newBlock.pointers[Squeak.Context_sender]=this.vm.nilObj,newBlock},primitiveBlockValue:function(argCount){var rcvr=this.vm.stackValue(argCount);if(!this.isA(rcvr,Squeak.splOb_ClassBlockContext))return!1;var block=rcvr,blockArgCount=block.pointers[Squeak.BlockContext_argumentCount];if("number"!=typeof blockArgCount)return!1;if(blockArgCount!=argCount)return!1;if(!block.pointers[Squeak.BlockContext_caller].isNil)return!1;this.vm.arrayCopy(this.vm.activeContext.pointers,this.vm.sp-argCount+1,block.pointers,Squeak.Context_tempFrameStart,argCount);var initialIP=block.pointers[Squeak.BlockContext_initialIP];return block.pointers[Squeak.Context_instructionPointer]=initialIP,block.pointers[Squeak.Context_stackPointer]=argCount,block.pointers[Squeak.BlockContext_caller]=this.vm.activeContext,this.vm.popN(argCount+1),this.vm.newActiveContext(block),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0},primitiveBlockValueWithArgs:function(argCount){var block=this.vm.stackValue(1),array=this.vm.stackValue(0);if(!this.isA(block,Squeak.splOb_ClassBlockContext))return!1;if(!this.isA(array,Squeak.splOb_ClassArray))return!1;var blockArgCount=block.pointers[Squeak.BlockContext_argumentCount];if("number"!=typeof blockArgCount)return!1;if(blockArgCount!=array.pointersSize())return!1;if(!block.pointers[Squeak.BlockContext_caller].isNil)return!1;this.vm.arrayCopy(array.pointers,0,block.pointers,Squeak.Context_tempFrameStart,blockArgCount);var initialIP=block.pointers[Squeak.BlockContext_initialIP];return block.pointers[Squeak.Context_instructionPointer]=initialIP,block.pointers[Squeak.Context_stackPointer]=blockArgCount,block.pointers[Squeak.BlockContext_caller]=this.vm.activeContext,this.vm.popN(argCount+1),this.vm.newActiveContext(block),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0},primitiveClosureCopyWithCopiedValues:function(argCount){this.vm.breakNow("primitiveClosureCopyWithCopiedValues");debugger;return!1},primitiveClosureValue:function(argCount){var blockClosure=this.vm.stackValue(argCount);return argCount===blockClosure.pointers[Squeak.Closure_numArgs]&&(this.activateNewClosureMethod(blockClosure,argCount),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0)},primitiveClosureValueWithArgs:function(argCount){var array=this.vm.top(),arraySize=array.pointersSize(),blockClosure=this.vm.stackValue(argCount);if(arraySize!==blockClosure.pointers[Squeak.Closure_numArgs])return!1;this.vm.pop();for(var i=0;i<arraySize;i++)this.vm.push(array.pointers[i]);return this.activateNewClosureMethod(blockClosure,arraySize),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0},primitiveClosureValueNoContextSwitch:function(argCount){var blockClosure=this.vm.stackValue(argCount);return argCount===blockClosure.pointers[Squeak.Closure_numArgs]&&(this.activateNewClosureMethod(blockClosure,argCount),!0)},primitiveFullClosureValue:function(argCount){var blockClosure=this.vm.stackValue(argCount);return argCount===blockClosure.pointers[Squeak.Closure_numArgs]&&(this.activateNewFullClosure(blockClosure,argCount),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0)},primitiveFullClosureValueWithArgs:function(argCount){var array=this.vm.top(),arraySize=array.pointersSize(),blockClosure=this.vm.stackValue(argCount);if(arraySize!==blockClosure.pointers[Squeak.Closure_numArgs])return!1;this.vm.pop();for(var i=0;i<arraySize;i++)this.vm.push(array.pointers[i]);return this.activateNewFullClosure(blockClosure,arraySize),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0},primitiveFullClosureValueNoContextSwitch:function(argCount){var blockClosure=this.vm.stackValue(argCount);return argCount===blockClosure.pointers[Squeak.Closure_numArgs]&&(this.activateNewFullClosure(blockClosure,argCount),!0)},activateNewClosureMethod:function(blockClosure,argCount){var outerContext=blockClosure.pointers[Squeak.Closure_outerContext],method=outerContext.pointers[Squeak.Context_method],newContext=this.vm.allocateOrRecycleContext(method.methodNeedsLargeFrame()),numCopied=blockClosure.pointers.length-Squeak.Closure_firstCopiedValue;newContext.pointers[Squeak.Context_sender]=this.vm.activeContext,newContext.pointers[Squeak.Context_instructionPointer]=blockClosure.pointers[Squeak.Closure_startpc],newContext.pointers[Squeak.Context_stackPointer]=argCount+numCopied,newContext.pointers[Squeak.Context_method]=outerContext.pointers[Squeak.Context_method],newContext.pointers[Squeak.Context_closure]=blockClosure,newContext.pointers[Squeak.Context_receiver]=outerContext.pointers[Squeak.Context_receiver];for(var where=Squeak.Context_tempFrameStart,i=0;i<argCount;i++)newContext.pointers[where++]=this.vm.stackValue(argCount-i-1);for(i=0;i<numCopied;i++)newContext.pointers[where++]=blockClosure.pointers[Squeak.Closure_firstCopiedValue+i];this.vm.popN(argCount+1),this.vm.newActiveContext(newContext)},activateNewFullClosure:function(blockClosure,argCount){var closureMethod=blockClosure.pointers[Squeak.ClosureFull_method],newContext=this.vm.allocateOrRecycleContext(closureMethod.methodNeedsLargeFrame()),numCopied=blockClosure.pointers.length-Squeak.ClosureFull_firstCopiedValue;newContext.pointers[Squeak.Context_sender]=this.vm.activeContext,newContext.pointers[Squeak.Context_instructionPointer]=this.vm.encodeSqueakPC(0,closureMethod),newContext.pointers[Squeak.Context_stackPointer]=closureMethod.methodTempCount(),newContext.pointers[Squeak.Context_method]=closureMethod,newContext.pointers[Squeak.Context_closure]=blockClosure,newContext.pointers[Squeak.Context_receiver]=blockClosure.pointers[Squeak.ClosureFull_receiver];for(var where=Squeak.Context_tempFrameStart,i=0;i<argCount;i++)newContext.pointers[where++]=this.vm.stackValue(argCount-i-1);for(i=0;i<numCopied;i++)newContext.pointers[where++]=blockClosure.pointers[Squeak.ClosureFull_firstCopiedValue+i];this.vm.popN(argCount+1),this.vm.newActiveContext(newContext),closureMethod.compiled||this.vm.compileIfPossible(closureMethod)}},"scheduling",{primitiveResume:function(){return this.resume(this.vm.top()),!0},primitiveSuspend:function(){var process=this.vm.top();if(process===this.activeProcess())this.vm.popNandPush(1,this.vm.nilObj),this.transferTo(this.wakeHighestPriority());else if(process.runProcess)this.vm.popNandPush(1,this.vm.nilObj);else{var oldList=process.pointers[Squeak.Proc_myList];if(oldList.isNil)return!1;if(this.removeProcessFromList(process,oldList),!this.success)return!1;process.pointers[Squeak.Proc_myList]=this.vm.nilObj,this.vm.popNandPush(1,oldList)}return!0},getScheduler:function(){return this.vm.specialObjects[Squeak.splOb_SchedulerAssociation].pointers[Squeak.Assn_value]},activeProcess:function(){return this.getScheduler().pointers[Squeak.ProcSched_activeProcess]},resume:function(newProc){if(newProc.runProcess)newProc.runProcess();else{var activeProc=this.activeProcess();if(activeProc.runProcess)this.putToSleep(newProc);else{var activePriority=activeProc.pointers[Squeak.Proc_priority];newProc.pointers[Squeak.Proc_priority]>activePriority?(this.putToSleep(activeProc),this.transferTo(newProc)):this.putToSleep(newProc)}}},putToSleep:function(aProcess){if(null!==aProcess&&!aProcess.runProcess){var priority=aProcess.pointers[Squeak.Proc_priority],processList=this.getScheduler().pointers[Squeak.ProcSched_processLists].pointers[priority-1];this.linkProcessToList(aProcess,processList)}},transferTo:function(newProc){var sched=this.getScheduler(),oldProc=sched.pointers[Squeak.ProcSched_activeProcess];oldProc!==newProc&&(sched.pointers[Squeak.ProcSched_activeProcess]=newProc,sched.dirty=!0,null!==oldProc&&(oldProc.pointers[Squeak.Proc_suspendedContext]=this.vm.activeContext,oldProc.dirty=!0),null!==newProc&&(this.vm.newActiveContext(newProc.pointers[Squeak.Proc_suspendedContext]),newProc.pointers[Squeak.Proc_suspendedContext]=this.vm.nilObj,this.oldPrims||(newProc.pointers[Squeak.Proc_myList]=this.vm.nilObj)),this.vm.reclaimableContextCount=0,this.vm.breakOnContextChanged&&(this.vm.breakOnContextChanged=!1,this.vm.breakNow()),this.vm.logProcess&&console.log("\n============= Process Switch ==================\n"+this.vm.printProcess(newProc,!0,this.vm.logSends?"| ":"")+"==============================================="))},wakeHighestPriority:function(){var processList,schedLists=this.getScheduler().pointers[Squeak.ProcSched_processLists],p=schedLists.pointersSize()-1;do{if(p<0)return null;processList=schedLists.pointers[p--]}while(this.isEmptyList(processList));return this.removeFirstLinkOfList(processList)},linkProcessToList:function(proc,aList){if(this.isEmptyList(aList))aList.pointers[Squeak.LinkedList_firstLink]=proc;else{var lastLink=aList.pointers[Squeak.LinkedList_lastLink];lastLink.pointers[Squeak.Link_nextLink]=proc,lastLink.dirty=!0}aList.pointers[Squeak.LinkedList_lastLink]=proc,aList.dirty=!0,proc.pointers[Squeak.Proc_myList]=aList,proc.dirty=!0},isEmptyList:function(aLinkedList){return aLinkedList.pointers[Squeak.LinkedList_firstLink].isNil},removeFirstLinkOfList:function(aList){var first=aList.pointers[Squeak.LinkedList_firstLink];if(first===aList.pointers[Squeak.LinkedList_lastLink])aList.pointers[Squeak.LinkedList_firstLink]=this.vm.nilObj,aList.pointers[Squeak.LinkedList_lastLink]=this.vm.nilObj;else{var next=first.pointers[Squeak.Link_nextLink];aList.pointers[Squeak.LinkedList_firstLink]=next,aList.dirty=!0}return first.pointers[Squeak.Link_nextLink]=this.vm.nilObj,first},removeProcessFromList:function(process,list){var first=list.pointers[Squeak.LinkedList_firstLink],last=list.pointers[Squeak.LinkedList_lastLink];if(process===first){var next=process.pointers[Squeak.Link_nextLink];list.pointers[Squeak.LinkedList_firstLink]=next,process===last&&(list.pointers[Squeak.LinkedList_lastLink]=this.vm.nilObj)}else{for(var temp=first;;){if(temp.isNil)return void(this.oldPrims&&(this.success=!1));if((next=temp.pointers[Squeak.Link_nextLink])===process)break;temp=next}next=process.pointers[Squeak.Link_nextLink],temp.pointers[Squeak.Link_nextLink]=next,process===last&&(list.pointers[Squeak.LinkedList_lastLink]=temp)}process.pointers[Squeak.Link_nextLink]=this.vm.nilObj},registerSemaphore:function(specialObjIndex){var sema=this.vm.top();return this.isA(sema,Squeak.splOb_ClassSemaphore)?this.vm.specialObjects[specialObjIndex]=sema:this.vm.specialObjects[specialObjIndex]=this.vm.nilObj,this.vm.stackValue(1)},primitiveWait:function(){var sema=this.vm.top();if(!this.isA(sema,Squeak.splOb_ClassSemaphore))return!1;var excessSignals=sema.pointers[Squeak.Semaphore_excessSignals];return excessSignals>0?sema.pointers[Squeak.Semaphore_excessSignals]=excessSignals-1:(this.linkProcessToList(this.activeProcess(),sema),this.transferTo(this.wakeHighestPriority())),!0},primitiveSignal:function(){var sema=this.vm.top();return!!this.isA(sema,Squeak.splOb_ClassSemaphore)&&(this.synchronousSignal(sema),!0)},synchronousSignal:function(sema){this.isEmptyList(sema)?sema.pointers[Squeak.Semaphore_excessSignals]++:this.resume(this.removeFirstLinkOfList(sema))},signalAtMilliseconds:function(sema,msTime){this.isA(sema,Squeak.splOb_ClassSemaphore)?(this.vm.specialObjects[Squeak.splOb_TheTimerSemaphore]=sema,this.vm.nextWakeupTick=msTime):(this.vm.specialObjects[Squeak.splOb_TheTimerSemaphore]=this.vm.nilObj,this.vm.nextWakeupTick=0)},primitiveSignalAtMilliseconds:function(argCount){var msTime=this.stackInteger(0),sema=this.stackNonInteger(1);return!!this.success&&(this.signalAtMilliseconds(sema,msTime),this.vm.popN(argCount),!0)},primitiveSignalAtUTCMicroseconds:function(argCount){var usecsUTC=this.stackSigned53BitInt(0),sema=this.stackNonInteger(1);if(!this.success)return!1;var msTime=usecsUTC/1e3+Squeak.EpochUTC-this.vm.startupTime&Squeak.MillisecondClockMask;return this.signalAtMilliseconds(sema,msTime),this.vm.popN(argCount),!0},signalSemaphoreWithIndex:function(semaIndex){this.semaphoresToSignal.push(semaIndex)},signalExternalSemaphores:function(){for(var semaphores=this.vm.specialObjects[Squeak.splOb_ExternalObjectsArray].pointers,semaClass=this.vm.specialObjects[Squeak.splOb_ClassSemaphore];this.semaphoresToSignal.length;){var sema=semaphores[this.semaphoresToSignal.shift()-1];sema.sqClass==semaClass&&this.synchronousSignal(sema)}},primitiveEnterCriticalSection:function(argCount){if(argCount>1)return!1;var mutex=this.vm.stackValue(argCount),activeProc=argCount?this.vm.top():this.activeProcess(),owningProcess=mutex.pointers[Squeak.Mutex_owner];return owningProcess.isNil?(mutex.pointers[Squeak.Mutex_owner]=activeProc,mutex.dirty=!0,this.popNandPushIfOK(argCount+1,this.vm.falseObj)):owningProcess===activeProc?this.popNandPushIfOK(argCount+1,this.vm.trueObj):(this.popNandPushIfOK(argCount+1,this.vm.falseObj),this.linkProcessToList(activeProc,mutex),this.transferTo(this.wakeHighestPriority())),!0},primitiveExitCriticalSection:function(argCount){var criticalSection=this.vm.top();if(this.isEmptyList(criticalSection))criticalSection.pointers[Squeak.Mutex_owner]=this.vm.nilObj;else{var owningProcess=this.removeFirstLinkOfList(criticalSection);criticalSection.pointers[Squeak.Mutex_owner]=owningProcess,criticalSection.dirty=!0,this.resume(owningProcess)}return!0},primitiveTestAndSetOwnershipOfCriticalSection:function(argCount){if(argCount>1)return!1;var mutex=this.vm.stackValue(argCount),activeProc=argCount?this.vm.top():this.activeProcess(),owningProcess=mutex.pointers[Squeak.Mutex_owner];return owningProcess.isNil?(mutex.pointers[Squeak.Mutex_owner]=activeProc,mutex.dirty=!0,this.popNandPushIfOK(argCount+1,this.vm.falseObj)):owningProcess===activeProc?this.popNandPushIfOK(argCount+1,this.vm.trueObj):this.popNandPushIfOK(argCount+1,this.vm.nilObj),!0}},"vm functions",{primitiveGetAttribute:function(argCount){var attr=this.stackInteger(0);if(!this.success)return!1;var argv=this.display.argv,vmOptions=this.display.vmOptions,value=null;switch(attr){case 0:value=argv&&argv[0]||this.filenameToSqueak(Squeak.vmPath+Squeak.vmFile);break;case 1:value=argv&&argv[1]||this.display.documentName;break;case 2:value=argv&&argv[2]||this.display.documentName;break;case 1001:value=this.vm.options.unix?"unix":Squeak.platformName;break;case 1002:value=Squeak.osVersion;break;case 1003:value=Squeak.platformSubtype;break;case 1004:value=Squeak.vmVersion+" "+Squeak.vmMakerVersion;break;case 1005:value=Squeak.windowSystem;break;case 1006:value=Squeak.vmBuild;break;case 1007:value=Squeak.vmInterpreterVersion;break;case 1009:value=Squeak.vmVersion+" Date: "+Squeak.vmDate;break;default:if(attr>=0&&argv&&argv.length>attr)value=argv[attr];else{if(!(attr<0&&vmOptions&&vmOptions.length>-attr-1))return!1;value=vmOptions[-attr-1]}}return this.vm.popNandPush(argCount+1,this.makeStObject(value)),!0},setLowSpaceThreshold:function(){var nBytes=this.stackInteger(0);return this.success&&(this.vm.lowSpaceThreshold=nBytes),this.vm.stackValue(1)},primitiveVMParameter:function(argCount){var paramsArraySize=this.vm.image.isSpur?71:44;switch(argCount){case 0:for(var arrayObj=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassArray],paramsArraySize),i=0;i<paramsArraySize;i++)arrayObj.pointers[i]=this.makeStObject(this.vmParameterAt(i+1));return this.popNandPushIfOK(1,arrayObj);case 1:var parm=this.stackInteger(0);return!(parm<1||parm>paramsArraySize)&&this.popNandPushIfOK(2,this.makeStObject(this.vmParameterAt(parm)));case 2:return this.popNandPushIfOK(3,0)}return!1},vmParameterAt:function(index){switch(index){case 1:case 2:return this.vm.image.oldSpaceBytes;case 3:case 67:return this.vm.image.totalMemory;case 4:return this.vm.image.allocationCount+this.vm.image.newSpaceCount;case 7:return this.vm.image.gcCount;case 8:return this.vm.image.gcMilliseconds;case 9:return this.vm.image.pgcCount;case 10:return this.vm.image.pgcMilliseconds;case 11:return this.vm.image.gcTenured;case 15:case 16:case 17:case 18:case 19:case 20:case 22:case 44:case 46:case 48:case 65:return 0;case 23:return this.vm.image.extraVMMemory;case 40:return 4;case 41:return this.vm.image.formatVersion();case 54:return this.vm.image.bytesLeft()}return null},primitiveImageName:function(argCount){return 0==argCount?this.popNandPushIfOK(1,this.makeStString(this.filenameToSqueak(this.vm.image.name))):(this.vm.image.name=this.filenameFromSqueak(this.vm.top().bytesAsString()),Squeak.Settings.squeakImageName=this.vm.image.name,this.vm.popN(argCount),!0)},primitiveSnapshot:function(argCount){this.vm.popNandPush(1,this.vm.trueObj),this.vm.storeContextRegisters(),this.activeProcess().pointers[Squeak.Proc_suspendedContext]=this.vm.activeContext,this.vm.image.fullGC("snapshot");var buffer=this.vm.image.writeToBuffer();return Squeak.flushAllFiles&&(Squeak.flushAllFiles(),Squeak.filePut(this.vm.image.name+".image",buffer)),this.vm.popNandPush(1,this.vm.falseObj),!0},primitiveQuit:function(argCount){return Squeak.flushAllFiles&&Squeak.flushAllFiles(),this.display.quitFlag=!0,this.vm.breakNow("quit"),!0},primitiveExitToDebugger:function(argCount){this.vm.breakNow("debugger primitive");debugger;return!0},primitiveSetGCBiasToGrow:function(argCount){return this.fakePrimitive(".primitiveSetGCBiasToGrow",0,argCount)},primitiveSetGCBiasToGrowGCLimit:function(argCount){return this.fakePrimitive(".primitiveSetGCBiasToGrowGCLimit",0,argCount)}},"time",{primitiveRelinquishProcessorForMicroseconds:function(argCount){return this.vm.popN(argCount),this.vm.goIdle(),!0},millisecondClockValue:function(){return Date.now()-this.vm.startupTime&Squeak.MillisecondClockMask},millisecondClockValueSet:function(clock){this.vm.startupTime=Date.now()-clock},secondClock:function(){return this.pos32BitIntFor(Squeak.totalSeconds())},microsecondClock:function(state){var millis=Date.now()-state.epoch;if("object"!=typeof performance)return this.pos53BitIntFor(1e3*millis);var micros=1e3*performance.now()%1e3|0,oldMillis=state.millis,oldMicros=state.micros;return oldMillis>millis&&(millis=oldMillis),millis===oldMillis&µs<oldMicros&&millis++,state.millis=millis,state.micros=micros,this.pos53BitIntFor(1e3*millis+micros)},microsecondClockUTC:function(){return this.microsecondClockUTCState||(this.microsecondClockUTCState={epoch:Squeak.EpochUTC,millis:0,micros:0}),this.microsecondClock(this.microsecondClockUTCState)},microsecondClockLocal:function(){return this.microsecondClockLocalState||(this.microsecondClockLocalState={epoch:Squeak.Epoch,millis:0,micros:0}),this.microsecondClock(this.microsecondClockLocalState)},primitiveUtcWithOffset:function(argCount){var d=new Date,posixMicroseconds=this.pos53BitIntFor(1e3*d.getTime()),offset=-60*d.getTimezoneOffset();if(argCount>0){var stWordIndexableObject=this.vm.stackValue(0);return stWordIndexableObject.pointers[0]=posixMicroseconds,stWordIndexableObject.pointers[1]=offset,this.popNandPushIfOK(argCount+1,stWordIndexableObject),!0}var timeAndOffset=[posixMicroseconds,offset];return this.popNandPushIfOK(argCount+1,this.makeStArray(timeAndOffset)),!0}})),vm_primitives}var jit={},hasRequiredJit;function requireJit(){return hasRequiredJit||(hasRequiredJit=1,Object.subclass("Squeak.Compiler","initialization",{initialize:function(vm){this.vm=vm,this.comments=!!Squeak.Compiler.comments,this.specialSelectors=["+","-","<",">","<=",">=","=","~=","*","/","\\\\","@","bitShift:","//","bitAnd:","bitOr:","at:","at:put:","size","next","nextPut:","atEnd","==","class","blockCopy:","value","value:","do:","new","new:","x","y"],this.doitCounter=0,this.blockCounter=0}},"accessing",{compile:function(method,optClassObj,optSelObj){if(void 0===method.compiled)method.compiled=!1;else{var clsName,sel,instVars;if(this.singleStep=!1,this.debug=this.comments,this.debug&&!optClassObj){var isMethod=method.sqClass===this.vm.specialObjects[Squeak.splOb_ClassCompiledMethod];this.vm.allMethodsDo((function(classObj,methodObj,selectorObj){if(isMethod?methodObj===method:methodObj.pointers.includes(method))return optClassObj=classObj,optSelObj=selectorObj,!0}))}if(optClassObj)if(clsName=optClassObj.className(),sel=optSelObj.bytesAsString(),this.debug)(isMethod=method.sqClass===this.vm.specialObjects[Squeak.splOb_ClassCompiledMethod])||(clsName="[] in "+clsName),instVars=optClassObj.allInstVarNames();method.compiled=this.generate(method,clsName,sel,instVars)}},enableSingleStepping:function(method,optClass,optSel){if(!method.compiled||!method.compiled.canSingleStep){this.singleStep=!0,this.debug=!0,optClass||this.vm.allMethodsDo((function(classObj,methodObj,selectorObj){if(methodObj===method)return optClass=classObj,optSel=selectorObj,!0}));var cls=optClass&&optClass.className(),sel=optSel&&optSel.bytesAsString(),instVars=optClass&&optClass.allInstVarNames();method.compiled=this.generate(method,cls,sel,instVars),method.compiled.canSingleStep=!0}return!0},functionNameFor:function(cls,sel){return void 0===cls||"?"===cls?this.method.sqClass===this.vm.specialObjects[Squeak.splOb_ClassCompiledMethod]?"DOIT_"+ ++this.doitCounter:"BLOCK_"+ ++this.blockCounter:(cls=cls.replace(/ /g,"_").replace("[]","Block"),/[^a-zA-Z0-9:_]/.test(sel)?cls+"__"+sel.replace(/./g,(function(char){return{"|":"OR","~":"NOT","<":"LT","=":"EQ",">":"GT","&":"AND","@":"AT","*":"TIMES","+":"PLUS","\\":"MOD","-":"MINUS",",":"COMMA","/":"DIV","?":"IF"}[char]||"OPERATOR"}))+"__":cls+"_"+sel.replace(/:/g,"ː"))}},"generating",{generate:function(method,optClass,optSel,optInstVarNames){this.method=method,this.sista=method.methodSignFlag(),this.pc=0,this.endPC=0,this.prevPC=0,this.source=[],this.sourceLabels={},this.needsLabel={},this.sourcePos={},this.needsVar={},this.needsBreak=!1,optClass&&optSel&&this.source.push("// ",optClass,">>",optSel,"\n"),this.instVarNames=optInstVarNames,this.allVars=["context","stack","rcvr","inst[","temp[","lit["],this.sourcePos.context=this.source.length,this.source.push("var context = vm.activeContext;\n"),this.sourcePos.stack=this.source.length,this.source.push("var stack = context.pointers;\n"),this.sourcePos.rcvr=this.source.length,this.source.push("var rcvr = vm.receiver;\n"),this.sourcePos["inst["]=this.source.length,this.source.push("var inst = rcvr.pointers;\n"),this.sourcePos["temp["]=this.source.length,this.source.push("var temp = vm.homeContext.pointers;\n"),this.sourcePos["lit["]=this.source.length,this.source.push("var lit = vm.method.pointers;\n"),this.sourcePos["loop-start"]=this.source.length,this.source.push("while (true) switch (vm.pc) {\ncase 0:\n"),this.sista?this.generateSista(method):this.generateV3(method);var funcName=this.functionNameFor(optClass,optSel);this.singleStep?(this.debug&&this.source.push("// all valid PCs have a label;\n"),this.source.push("default: throw Error('invalid PC');\n}")):(this.sourcePos["loop-end"]=this.source.length,this.source.push("default: vm.interpretOne(true); return;\n}"),this.deleteUnneededLabels()),this.deleteUnneededVariables();var source="'use strict';\nreturn function "+funcName+"(vm) {\n"+this.source.join("")+"}";return new Function(source)()},generateV3:function(method){for(this.done=!1;!this.done;){var byte=method.bytes[this.pc++],byte2=0;switch(248&byte){case 0:case 8:this.generatePush("inst[",15&byte,"]");break;case 16:case 24:this.generatePush("temp[",6+(15&byte),"]");break;case 32:case 40:case 48:case 56:this.generatePush("lit[",1+(31&byte),"]");break;case 64:case 72:case 80:case 88:this.generatePush("lit[",1+(31&byte),"].pointers[1]");break;case 96:this.generatePopInto("inst[",7&byte,"]");break;case 104:this.generatePopInto("temp[",6+(7&byte),"]");break;case 112:switch(byte){case 112:this.generatePush("rcvr");break;case 113:this.generatePush("vm.trueObj");break;case 114:this.generatePush("vm.falseObj");break;case 115:this.generatePush("vm.nilObj");break;case 116:this.generatePush("-1");break;case 117:this.generatePush("0");break;case 118:this.generatePush("1");break;case 119:this.generatePush("2")}break;case 120:switch(byte){case 120:this.generateReturn("rcvr");break;case 121:this.generateReturn("vm.trueObj");break;case 122:this.generateReturn("vm.falseObj");break;case 123:this.generateReturn("vm.nilObj");break;case 124:this.generateReturn("stack[vm.sp]");break;case 125:this.generateBlockReturn();break;default:throw Error("unusedBytecode "+byte)}break;case 128:case 136:this.generateV3Extended(byte);break;case 144:this.generateJump(1+(7&byte));break;case 152:this.generateJumpIf(!1,1+(7&byte));break;case 160:byte2=method.bytes[this.pc++],this.generateJump(256*((7&byte)-4)+byte2);break;case 168:byte2=method.bytes[this.pc++],this.generateJumpIf(byte<172,256*(3&byte)+byte2);break;case 176:case 184:this.generateNumericOp(byte);break;case 192:case 200:this.generateQuickPrim(byte);break;case 208:case 216:this.generateSend("lit[",1+(15&byte),"]",0,!1);break;case 224:case 232:this.generateSend("lit[",1+(15&byte),"]",1,!1);break;case 240:case 248:this.generateSend("lit[",1+(15&byte),"]",2,!1)}}},generateV3Extended:function(bytecode){var byte2,byte3;switch(bytecode){case 128:switch((byte2=this.method.bytes[this.pc++])>>6){case 0:return void this.generatePush("inst[",63&byte2,"]");case 1:return void this.generatePush("temp[",6+(63&byte2),"]");case 2:return void this.generatePush("lit[",1+(63&byte2),"]");case 3:return void this.generatePush("lit[",1+(63&byte2),"].pointers[1]")}return;case 129:switch((byte2=this.method.bytes[this.pc++])>>6){case 0:return void this.generateStoreInto("inst[",63&byte2,"]");case 1:return void this.generateStoreInto("temp[",6+(63&byte2),"]");case 2:throw Error("illegal store into literal");case 3:return void this.generateStoreInto("lit[",1+(63&byte2),"].pointers[1]")}return;case 130:switch((byte2=this.method.bytes[this.pc++])>>6){case 0:return void this.generatePopInto("inst[",63&byte2,"]");case 1:return void this.generatePopInto("temp[",6+(63&byte2),"]");case 2:throw Error("illegal pop into literal");case 3:return void this.generatePopInto("lit[",1+(63&byte2),"].pointers[1]")}return;case 131:return byte2=this.method.bytes[this.pc++],void this.generateSend("lit[",1+(31&byte2),"]",byte2>>5,!1);case 132:switch(byte2=this.method.bytes[this.pc++],byte3=this.method.bytes[this.pc++],byte2>>5){case 0:return void this.generateSend("lit[",1+byte3,"]",31&byte2,!1);case 1:return void this.generateSend("lit[",1+byte3,"]",31&byte2,!0);case 2:return void this.generatePush("inst[",byte3,"]");case 3:return void this.generatePush("lit[",1+byte3,"]");case 4:return void this.generatePush("lit[",1+byte3,"].pointers[1]");case 5:return void this.generateStoreInto("inst[",byte3,"]");case 6:return void this.generatePopInto("inst[",byte3,"]");case 7:return void this.generateStoreInto("lit[",1+byte3,"].pointers[1]")}return;case 133:return byte2=this.method.bytes[this.pc++],void this.generateSend("lit[",1+(31&byte2),"]",byte2>>5,!0);case 134:return byte2=this.method.bytes[this.pc++],void this.generateSend("lit[",1+(63&byte2),"]",byte2>>6,!1);case 135:return void this.generateInstruction("pop","vm.sp--");case 136:return this.needsVar.stack=!0,void this.generateInstruction("dup","var dup = stack[vm.sp]; stack[++vm.sp] = dup");case 137:return this.needsVar.stack=!0,void this.generateInstruction("push thisContext","stack[++vm.sp] = vm.exportThisContext()");case 138:var popValues=(byte2=this.method.bytes[this.pc++])>127,count=127&byte2;return void this.generateClosureTemps(count,popValues);case 139:return byte2=this.method.bytes[this.pc++],byte3=this.method.bytes[this.pc++],void this.generateCallPrimitive(byte2+256*byte3,129);case 140:return byte2=this.method.bytes[this.pc++],byte3=this.method.bytes[this.pc++],void this.generatePush("temp[",6+byte3,"].pointers[",byte2,"]");case 141:return byte2=this.method.bytes[this.pc++],byte3=this.method.bytes[this.pc++],void this.generateStoreInto("temp[",6+byte3,"].pointers[",byte2,"]");case 142:return byte2=this.method.bytes[this.pc++],byte3=this.method.bytes[this.pc++],void this.generatePopInto("temp[",6+byte3,"].pointers[",byte2,"]");case 143:var numArgs=15&(byte2=this.method.bytes[this.pc++]),numCopied=byte2>>4,blockSize=(byte3=this.method.bytes[this.pc++])<<8|this.method.bytes[this.pc++];return void this.generateClosureCopy(numArgs,numCopied,blockSize)}},generateSista:function(){var b,b2,b3,bytes=this.method.bytes,extA=0,extB=0;for(this.done=!1;!this.done;){switch(b=bytes[this.pc++]){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:this.generatePush("inst[",15&b,"]");break;case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:this.generatePush("lit[",1+(15&b),"].pointers[1]");break;case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 58:case 59:case 60:case 61:case 62:case 63:this.generatePush("lit[",1+(31&b),"]");break;case 64:case 65:case 66:case 67:case 68:case 69:case 70:case 71:this.generatePush("temp[",6+(7&b),"]");break;case 72:case 73:case 74:case 75:this.generatePush("temp[",6+(3&b)+8,"]");break;case 76:this.generatePush("rcvr");break;case 77:this.generatePush("vm.trueObj");break;case 78:this.generatePush("vm.falseObj");break;case 79:this.generatePush("vm.nilObj");break;case 80:this.generatePush(0);break;case 81:this.generatePush(1);break;case 82:this.needsVar.stack=!0,this.generateInstruction("push thisContext","stack[++vm.sp] = vm.exportThisContext()");break;case 83:this.needsVar.stack=!0,this.generateInstruction("dup","var dup = stack[vm.sp]; stack[++vm.sp] = dup");break;case 84:case 85:case 86:case 87:case 218:case 219:case 220:case 221:case 222:case 223:case 246:case 247:case 254:case 255:throw Error("unusedBytecode "+b);case 88:this.generateReturn("rcvr");break;case 89:this.generateReturn("vm.trueObj");break;case 90:this.generateReturn("vm.falseObj");break;case 91:this.generateReturn("vm.nilObj");break;case 92:this.generateReturn("stack[vm.sp]");break;case 93:this.generateBlockReturn("vm.nilObj");break;case 94:this.generateBlockReturn();break;case 95:break;case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:this.generateNumericOp(b);break;case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:case 123:case 124:case 125:case 126:case 127:this.generateQuickPrim(b);break;case 128:case 129:case 130:case 131:case 132:case 133:case 134:case 135:case 136:case 137:case 138:case 139:case 140:case 141:case 142:case 143:this.generateSend("lit[",1+(15&b),"]",0,!1);break;case 144:case 145:case 146:case 147:case 148:case 149:case 150:case 151:case 152:case 153:case 154:case 155:case 156:case 157:case 158:case 159:this.generateSend("lit[",1+(15&b),"]",1,!1);break;case 160:case 161:case 162:case 163:case 164:case 165:case 166:case 167:case 168:case 169:case 170:case 171:case 172:case 173:case 174:case 175:this.generateSend("lit[",1+(15&b),"]",2,!1);break;case 176:case 177:case 178:case 179:case 180:case 181:case 182:case 183:this.generateJump(1+(7&b));break;case 184:case 185:case 186:case 187:case 188:case 189:case 190:case 191:this.generateJumpIf(!0,1+(7&b));break;case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:this.generateJumpIf(!1,1+(7&b));break;case 200:case 201:case 202:case 203:case 204:case 205:case 206:case 207:this.generatePopInto("inst[",7&b,"]");break;case 208:case 209:case 210:case 211:case 212:case 213:case 214:case 215:this.generatePopInto("temp[",6+(7&b),"]");break;case 216:this.generateInstruction("pop","vm.sp--");break;case 217:throw Error("unumplementedBytecode: 0xD9 (unconditional trap)");case 224:extA=256*extA+(b2=bytes[this.pc++]);continue;case 225:extB=256*extB+((b2=bytes[this.pc++])<128?b2:b2-256);continue;case 226:b2=bytes[this.pc++],this.generatePush("inst[",b2+256*extA,"]");break;case 227:b2=bytes[this.pc++],this.generatePush("lit[",1+b2+256*extA,"].pointers[1]");break;case 228:b2=bytes[this.pc++],this.generatePush("lit[",1+b2+256*extA,"]");break;case 229:b2=bytes[this.pc++],this.generatePush("temp[",6+b2,"]");break;case 230:throw Error("unusedBytecode 0xE6");case 231:var popValues=(b2=bytes[this.pc++])>127,count=127&b2;this.generateClosureTemps(count,popValues);break;case 232:b2=bytes[this.pc++],this.generatePush(b2+256*extB);break;case 233:b2=bytes[this.pc++],this.generatePush("vm.image.getCharacter(",b2+256*extB,")");break;case 234:b2=bytes[this.pc++],this.generateSend("lit[",1+(b2>>3)+(extA<<5),"]",(7&b2)+(extB<<3),!1);break;case 235:var lit=((b2=bytes[this.pc++])>>3)+(extA<<5),numArgs=(7&b2)+((63&extB)<<3),directed=extB>=64;this.generateSend("lit[",1+lit,"]",numArgs,!directed||"directed");break;case 236:throw Error("unimplemented bytecode: 0xEC (class trap)");case 237:b2=bytes[this.pc++],this.generateJump(b2+256*extB);break;case 238:b2=bytes[this.pc++],this.generateJumpIf(!0,b2+256*extB);break;case 239:b2=bytes[this.pc++],this.generateJumpIf(!1,b2+256*extB);break;case 240:b2=bytes[this.pc++],this.generatePopInto("inst[",b2+256*extA,"]");break;case 241:b2=bytes[this.pc++],this.generatePopInto("lit[",1+b2+256*extA,"].pointers[1]");break;case 242:b2=bytes[this.pc++],this.generatePopInto("temp[",6+b2,"]");break;case 243:b2=bytes[this.pc++],this.generateStoreInto("inst[",b2+256*extA,"]");break;case 244:b2=bytes[this.pc++],this.generateStoreInto("lit[",1+b2+256*extA,"].pointers[1]");break;case 245:b2=bytes[this.pc++],this.generateStoreInto("temp[",6+b2,"]");break;case 248:b2=bytes[this.pc++],b3=bytes[this.pc++],this.generateCallPrimitive(b2+256*b3,245);break;case 249:b2=bytes[this.pc++],b3=bytes[this.pc++],this.generatePushFullClosure(b2+255*extA,b3);break;case 250:numArgs=(7&(b2=bytes[this.pc++]))+8*(15&extA);var numCopied=(b2>>3&7)+8*(extA>>4),blockSize=(b3=bytes[this.pc++])+(extB<<8);this.generateClosureCopy(numArgs,numCopied,blockSize);break;case 251:b2=bytes[this.pc++],b3=bytes[this.pc++],this.generatePush("temp[",6+b3,"].pointers[",b2,"]");break;case 252:b2=bytes[this.pc++],b3=bytes[this.pc++],this.generateStoreInto("temp[",6+b3,"].pointers[",b2,"]");break;case 253:b2=bytes[this.pc++],b3=bytes[this.pc++],this.generatePopInto("temp[",6+b3,"].pointers[",b2,"]");break;default:throw Error("illegal bytecode: "+b)}extA=0,extB=0}},generatePush:function(target,arg1,suffix1,arg2,suffix2){this.debug&&this.generateDebugCode("push",target,arg1,suffix1,arg2,suffix2),this.generateLabel(),this.needsVar[target]=!0,this.needsVar.stack=!0,this.source.push("stack[++vm.sp] = ",target),void 0!==arg1&&(this.source.push(arg1,suffix1),void 0!==arg2&&this.source.push(arg2,suffix2)),this.source.push(";\n")},generateStoreInto:function(target,arg1,suffix1,arg2,suffix2){this.debug&&this.generateDebugCode("store into",target,arg1,suffix1,arg2,suffix2),this.generateLabel(),this.needsVar[target]=!0,this.needsVar.stack=!0,this.source.push(target),void 0!==arg1&&(this.source.push(arg1,suffix1),void 0!==arg2&&this.source.push(arg2,suffix2)),this.source.push(" = stack[vm.sp];\n"),this.generateDirty(target,arg1,suffix1)},generatePopInto:function(target,arg1,suffix1,arg2,suffix2){this.debug&&this.generateDebugCode("pop into",target,arg1,suffix1,arg2,suffix2),this.generateLabel(),this.needsVar[target]=!0,this.needsVar.stack=!0,this.source.push(target),void 0!==arg1&&(this.source.push(arg1,suffix1),void 0!==arg2&&this.source.push(arg2,suffix2)),this.source.push(" = stack[vm.sp--];\n"),this.generateDirty(target,arg1,suffix1)},generateReturn:function(what){this.debug&&this.generateDebugCode("return",what),this.generateLabel(),this.needsVar[what]=!0,this.source.push("vm.pc = ",this.pc,"; vm.doReturn(",what,"); return;\n"),this.needsBreak=!1,this.done=this.pc>this.endPC},generateBlockReturn:function(retVal){this.debug&&this.generateDebugCode("block return"),this.generateLabel(),retVal||(this.needsVar.stack=!0,retVal="stack[vm.sp--]"),this.needsVar.context=!0,this.source.push("vm.pc = ",this.pc,"; vm.doReturn(",retVal,", context.pointers[0]); return;\n"),this.needsBreak=!1,this.done=this.pc>this.endPC},generateJump:function(distance){var destination=this.pc+distance;this.debug&&this.generateDebugCode("jump to "+destination),this.generateLabel(),this.needsVar.context=!0,this.source.push("vm.pc = ",destination,"; "),distance<0&&this.source.push("\nif (vm.interruptCheckCounter-- <= 0) {\n"," vm.checkForInterrupts();\n"," if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return;\n","}\n"),this.singleStep&&this.source.push("\nif (vm.breakOutOfInterpreter) return;\n"),this.source.push("continue;\n"),this.needsBreak=!1,this.needsLabel[destination]=!0,destination>this.endPC&&(this.endPC=destination)},generateJumpIf:function(condition,distance){var destination=this.pc+distance;this.debug&&this.generateDebugCode("jump if "+condition+" to "+destination),this.generateLabel(),this.needsVar.stack=!0,this.source.push("var cond = stack[vm.sp--]; if (cond === vm.",condition,"Obj) {vm.pc = ",destination,"; "),this.singleStep&&this.source.push("if (vm.breakOutOfInterpreter) return; else "),this.source.push("continue}\n","else if (cond !== vm.",!condition,"Obj) {vm.sp++; vm.pc = ",this.pc,"; vm.send(vm.specialObjects[25], 0, false); return}\n"),this.needsLabel[this.pc]=!0,this.needsLabel[destination]=!0,destination>this.endPC&&(this.endPC=destination)},generateQuickPrim:function(byte){switch(this.debug&&this.generateDebugCode("quick send #"+this.specialSelectors[16+(15&byte)]),this.generateLabel(),15&byte){case 0:return this.needsVar.stack=!0,this.source.push("var a, b; if ((a=stack[vm.sp-1]).sqClass === vm.specialObjects[7] && typeof (b=stack[vm.sp]) === 'number' && b>0 && b<=a.pointers.length) {\n"," stack[--vm.sp] = a.pointers[b-1];","} else { var c = vm.primHandler.objectAt(true,true,false); if (vm.primHandler.success) stack[--vm.sp] = c; else {\n"," vm.pc = ",this.pc,"; vm.sendSpecial(16); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return; }}\n"),void(this.needsLabel[this.pc]=!0);case 1:return this.needsVar.stack=!0,this.source.push("var a, b; if ((a=stack[vm.sp-2]).sqClass === vm.specialObjects[7] && typeof (b=stack[vm.sp-1]) === 'number' && b>0 && b<=a.pointers.length) {\n"," var c = stack[vm.sp]; stack[vm.sp-=2] = a.pointers[b-1] = c; a.dirty = true;","} else { vm.primHandler.objectAtPut(true,true,false); if (vm.primHandler.success) stack[vm.sp-=2] = c; else {\n"," vm.pc = ",this.pc,"; vm.sendSpecial(17); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return; }}\n"),void(this.needsLabel[this.pc]=!0);case 2:return this.needsVar.stack=!0,this.source.push("if (stack[vm.sp].sqClass === vm.specialObjects[7]) stack[vm.sp] = stack[vm.sp].pointersSize();\n","else if (stack[vm.sp].sqClass === vm.specialObjects[6]) stack[vm.sp] = stack[vm.sp].bytesSize();\n","else { vm.pc = ",this.pc,"; vm.sendSpecial(18); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return; }\n"),void(this.needsLabel[this.pc]=!0);case 6:return this.needsVar.stack=!0,void this.source.push("var cond = stack[vm.sp-1] === stack[vm.sp];\nstack[--vm.sp] = cond ? vm.trueObj : vm.falseObj;\n");case 7:return this.needsVar.stack=!0,void this.source.push("stack[vm.sp] = typeof stack[vm.sp] === 'number' ? vm.specialObjects[5] : stack[vm.sp].sqClass;\n");case 8:return this.needsVar.rcvr=!0,this.source.push("vm.pc = ",this.pc,"; if (!vm.primHandler.quickSendOther(rcvr, ",15&byte,")) ","{vm.sendSpecial(",16+(15&byte),"); return}\n"),this.needsLabel[this.pc]=!0,void(this.needsLabel[this.pc+2]=!0);case 9:case 10:case 11:return this.needsVar.rcvr=!0,this.source.push("vm.pc = ",this.pc,"; if (!vm.primHandler.quickSendOther(rcvr, ",15&byte,")) vm.sendSpecial(",16+(15&byte),"); return;\n"),void(this.needsLabel[this.pc]=!0)}this.needsVar.rcvr=!0,this.needsVar.context=!0,this.source.push("vm.pc = ",this.pc,"; if (!vm.primHandler.quickSendOther(rcvr, ",15&byte,"))"," vm.sendSpecial(",16+(15&byte),");\n","if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return;\n"),this.needsBreak=!1,this.needsLabel[this.pc]=!0},generateNumericOp:function(byte){switch(this.debug&&this.generateDebugCode("quick send #"+this.specialSelectors[15&byte]),this.generateLabel(),this.needsLabel[this.pc]=!0,15&byte){case 0:return this.needsVar.stack=!0,void this.source.push("var a = stack[vm.sp - 1], b = stack[vm.sp];\n","if (typeof a === 'number' && typeof b === 'number') {\n"," stack[--vm.sp] = vm.primHandler.signed32BitIntegerFor(a + b);\n","} else { vm.pc = ",this.pc,"; vm.sendSpecial(0); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return}\n");case 1:return this.needsVar.stack=!0,void this.source.push("var a = stack[vm.sp - 1], b = stack[vm.sp];\n","if (typeof a === 'number' && typeof b === 'number') {\n"," stack[--vm.sp] = vm.primHandler.signed32BitIntegerFor(a - b);\n","} else { vm.pc = ",this.pc,"; vm.sendSpecial(1); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return}\n");case 2:return this.needsVar.stack=!0,void this.source.push("var a = stack[vm.sp - 1], b = stack[vm.sp];\n","if (typeof a === 'number' && typeof b === 'number') {\n"," stack[--vm.sp] = a < b ? vm.trueObj : vm.falseObj;\n","} else { vm.pc = ",this.pc,"; vm.sendSpecial(2); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return}\n");case 3:return this.needsVar.stack=!0,void this.source.push("var a = stack[vm.sp - 1], b = stack[vm.sp];\n","if (typeof a === 'number' && typeof b === 'number') {\n"," stack[--vm.sp] = a > b ? vm.trueObj : vm.falseObj;\n","} else { vm.pc = ",this.pc,"; vm.sendSpecial(3); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return}\n");case 4:return this.needsVar.stack=!0,void this.source.push("var a = stack[vm.sp - 1], b = stack[vm.sp];\n","if (typeof a === 'number' && typeof b === 'number') {\n"," stack[--vm.sp] = a <= b ? vm.trueObj : vm.falseObj;\n","} else { vm.pc = ",this.pc,"; vm.sendSpecial(4); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return}\n");case 5:return this.needsVar.stack=!0,void this.source.push("var a = stack[vm.sp - 1], b = stack[vm.sp];\n","if (typeof a === 'number' && typeof b === 'number') {\n"," stack[--vm.sp] = a >= b ? vm.trueObj : vm.falseObj;\n","} else { vm.pc = ",this.pc,"; vm.sendSpecial(5); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return}\n");case 6:return this.needsVar.stack=!0,void this.source.push("var a = stack[vm.sp - 1], b = stack[vm.sp];\n","if (typeof a === 'number' && typeof b === 'number') {\n"," stack[--vm.sp] = a === b ? vm.trueObj : vm.falseObj;\n","} else if (a === b && a.float === a.float) {\n"," stack[--vm.sp] = vm.trueObj;\n","} else { vm.pc = ",this.pc,"; vm.sendSpecial(6); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return}\n");case 7:return this.needsVar.stack=!0,void this.source.push("var a = stack[vm.sp - 1], b = stack[vm.sp];\n","if (typeof a === 'number' && typeof b === 'number') {\n"," stack[--vm.sp] = a !== b ? vm.trueObj : vm.falseObj;\n","} else if (a === b && a.float === a.float) {\n"," stack[--vm.sp] = vm.falseObj;\n","} else { vm.pc = ",this.pc,"; vm.sendSpecial(7); if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return}\n");case 8:return void this.source.push("vm.success = true; vm.resultIsFloat = false; if(!vm.pop2AndPushNumResult(vm.stackIntOrFloat(1) * vm.stackIntOrFloat(0))) { vm.pc = ",this.pc,"; vm.sendSpecial(8); return}\n");case 9:return void this.source.push("vm.success = true; if(!vm.pop2AndPushIntResult(vm.quickDivide(vm.stackInteger(1),vm.stackInteger(0)))) { vm.pc = ",this.pc,"; vm.sendSpecial(9); return}\n");case 10:return void this.source.push("vm.success = true; if(!vm.pop2AndPushIntResult(vm.mod(vm.stackInteger(1),vm.stackInteger(0)))) { vm.pc = ",this.pc,"; vm.sendSpecial(10); return}\n");case 11:return void this.source.push("vm.success = true; if(!vm.primHandler.primitiveMakePoint(1, true)) { vm.pc = ",this.pc,"; vm.sendSpecial(11); return}\n");case 12:return void this.source.push("vm.success = true; if(!vm.pop2AndPushIntResult(vm.safeShift(vm.stackInteger(1),vm.stackInteger(0)))) { vm.pc = ",this.pc,"; vm.sendSpecial(12); return}\n");case 13:return void this.source.push("vm.success = true; if(!vm.pop2AndPushIntResult(vm.div(vm.stackInteger(1),vm.stackInteger(0)))) { vm.pc = ",this.pc,"; vm.sendSpecial(13); return}\n");case 14:return void this.source.push("vm.success = true; if(!vm.pop2AndPushIntResult(vm.stackInteger(1) & vm.stackInteger(0))) { vm.pc = ",this.pc,"; vm.sendSpecial(14); return}\n");case 15:return void this.source.push("vm.success = true; if(!vm.pop2AndPushIntResult(vm.stackInteger(1) | vm.stackInteger(0))) { vm.pc = ",this.pc,"; vm.sendSpecial(15); return}\n")}},generateSend:function(prefix,num,suffix,numArgs,superSend){this.debug&&this.generateDebugCode(("directed"===superSend?"directed super send ":superSend?"super send ":"send ")+("lit["===prefix?this.method.pointers[num].bytesAsString():"...")),this.generateLabel(),this.needsVar[prefix]=!0,this.needsVar.context=!0,this.source.push("vm.pc = ",this.pc),"directed"===superSend?this.source.push("; vm.sendSuperDirected(",prefix,num,suffix,", ",numArgs,"); "):this.source.push("; vm.send(",prefix,num,suffix,", ",numArgs,", ",superSend,"); "),this.source.push("if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return;\n"),this.needsBreak=!1,this.needsLabel[this.pc]=!0},generateClosureTemps:function(count,popValues){if(this.debug&&this.generateDebugCode("closure temps"),this.generateLabel(),this.needsVar.stack=!0,this.source.push("var array = vm.instantiateClass(vm.specialObjects[7], ",count,");\n"),popValues){for(var i=0;i<count;i++)this.source.push("array.pointers[",i,"] = stack[vm.sp - ",count-i-1,"];\n");this.source.push("stack[vm.sp -= ",count-1,"] = array;\n")}else this.source.push("stack[++vm.sp] = array;\n")},generateClosureCopy:function(numArgs,numCopied,blockSize){var from=this.pc,to=from+blockSize;if(this.debug&&this.generateDebugCode("push closure("+from+"-"+(to-1)+"): "+numCopied+" copied, "+numArgs+" args"),this.generateLabel(),this.needsVar.stack=!0,this.source.push("var closure = vm.instantiateClass(vm.specialObjects[36], ",numCopied,");\n","closure.pointers[0] = context; vm.reclaimableContextCount = 0;\n","closure.pointers[1] = ",from+4*this.method.pointers.length+1,";\n","closure.pointers[2] = ",numArgs,";\n"),numCopied>0){for(var i=0;i<numCopied;i++)this.source.push("closure.pointers[",i+3,"] = stack[vm.sp - ",numCopied-i-1,"];\n");this.source.push("stack[vm.sp -= ",numCopied-1,"] = closure;\n")}else this.source.push("stack[++vm.sp] = closure;\n");this.source.push("vm.pc = ",to,";\n"),this.singleStep&&this.source.push("if (vm.breakOutOfInterpreter) return;\n"),this.source.push("continue;\n"),this.needsBreak=!1,this.needsLabel[from]=!0,this.needsLabel[to]=!0,to>this.endPC&&(this.endPC=to)},generatePushFullClosure:function(index,b3){this.debug&&this.generateDebugCode("push full closure "+(index+1)),this.generateLabel(),this.needsVar["lit["]=!0,this.needsVar.rcvr=!0,this.needsVar.stack=!0;var outer,numCopied=63&b3;if(outer=1==(b3>>6&1)?"vm.nilObj":"context",1==(b3>>7&1))throw Error("on-stack receiver not yet supported");if(this.source.push("var closure = vm.newFullClosure(",outer,", ",numCopied,", lit[",1+index,"]);\n"),this.source.push("closure.pointers[",Squeak.ClosureFull_receiver,"] = rcvr;\n"),"context"===outer&&this.source.push("vm.reclaimableContextCount = 0;\n"),numCopied>0){for(var i=0;i<numCopied;i++)this.source.push("closure.pointers[",i+Squeak.ClosureFull_firstCopiedValue,"] = stack[vm.sp - ",numCopied-i-1,"];\n");this.source.push("stack[vm.sp -= ",numCopied-1,"] = closure;\n")}else this.source.push("stack[++vm.sp] = closure;\n")},generateCallPrimitive:function(index,extendedStoreBytecode){this.debug&&this.generateDebugCode("call primitive "+index),this.generateLabel(),this.method.bytes[this.pc]===extendedStoreBytecode&&(this.needsVar.stack=!0,this.source.push("if (vm.primFailCode) {stack[vm.sp] = vm.getErrorObjectFromPrimFailCode(); vm.primFailCode = 0;}\n"))},generateDirty:function(target,arg,suffix){switch(target){case"inst[":this.source.push("rcvr.dirty = true;\n");break;case"lit[":this.source.push(target,arg,"].dirty = true;\n");break;case"temp[":"]"!==suffix&&this.source.push(target,arg,"].dirty = true;\n");break;default:throw Error("unexpected target "+target)}},generateLabel:function(){this.prevPC&&(this.sourceLabels[this.prevPC]=this.source.length,this.source.push("case ",this.prevPC,":\n")),this.prevPC=this.pc},generateDebugCode:function(command,what,arg1,suffix1,arg2,suffix2){this.needsBreak&&(this.source.push("if (vm.breakOutOfInterpreter) {vm.pc = ",this.prevPC,"; return}\n"),this.needsLabel[this.prevPC]=!0);for(var bytecodes=[],i=this.prevPC;i<this.pc;i++)bytecodes.push((this.method.bytes[i]+256).toString(16).slice(-2).toUpperCase());if(this.source.push("// ",this.prevPC," <",bytecodes.join(" "),"> ",command),void 0!==what)switch(this.source.push(" "),what){case"vm.nilObj":this.source.push("nil");break;case"vm.trueObj":this.source.push("true");break;case"vm.falseObj":this.source.push("false");break;case"rcvr":this.source.push("self");break;case"stack[vm.sp]":this.source.push("top of stack");break;case"inst[":this.instVarNames?this.source.push(this.instVarNames[arg1]):this.source.push("inst var ",arg1);break;case"temp[":this.source.push("tmp",arg1-6),"]"!==suffix1&&this.source.push("[",arg2,"]");break;case"lit[":var lit=this.method.pointers[arg1];"]"===suffix1?this.source.push(lit):this.source.push(lit.pointers[0].bytesAsString());break;default:this.source.push(what)}this.source.push("\n"),this.needsBreak=this.singleStep},generateInstruction:function(comment,instr){this.debug&&this.generateDebugCode(comment),this.generateLabel(),this.source.push(instr,";\n")},deleteUnneededLabels:function(){var hasAnyLabel=!1;for(var i in this.sourceLabels)if(this.needsLabel[i])hasAnyLabel=!0;else for(var j=0;j<3;j++)this.source[this.sourceLabels[i]+j]="";hasAnyLabel||(this.source[this.sourcePos["loop-start"]]="",this.source[this.sourcePos["loop-end"]]="")},deleteUnneededVariables:function(){this.needsVar.stack&&(this.needsVar.context=!0),this.needsVar["inst["]&&(this.needsVar.rcvr=!0);for(var i=0;i<this.allVars.length;i++){var v=this.allVars[i];this.needsVar[v]||(this.source[this.sourcePos[v]]="")}}})),jit}var vm_display={},hasRequiredVm_display;function requireVm_display(){return hasRequiredVm_display||(hasRequiredVm_display=1,Object.extend(Squeak,"known classes",{BitBlt_dest:0,BitBlt_source:1,BitBlt_halftone:2,BitBlt_combinationRule:3,BitBlt_destX:4,BitBlt_destY:5,BitBlt_width:6,BitBlt_height:7,BitBlt_sourceX:8,BitBlt_sourceY:9,BitBlt_clipX:10,BitBlt_clipY:11,BitBlt_clipW:12,BitBlt_clipH:13,BitBlt_colorMap:14,BitBlt_warpBase:15,Form_bits:0,Form_width:1,Form_height:2,Form_depth:3,Form_offset:4}),Object.extend(Squeak.Primitives.prototype,"display",{displayDirty:function(){}})),vm_display}var vm_display_headless={},hasRequiredVm_display_headless;function requireVm_display_headless(){return hasRequiredVm_display_headless||(hasRequiredVm_display_headless=1,Object.extend(Squeak.Primitives.prototype,"display",{primitiveScreenSize:function(){return!1},primitiveScreenDepth:function(){return!1},primitiveTestDisplayDepth:function(){return!1},primitiveBeDisplay:function(argCount){return this.vm.popN(argCount),!0},primitiveReverseDisplay:function(){return!1},primitiveDeferDisplayUpdates:function(){return!1},primitiveForceDisplayUpdate:function(){return!1},primitiveScanCharacters:function(){return!1},primitiveSetFullScreen:function(){return!1},primitiveShowDisplayRect:function(){return!1},primitiveBeCursor:function(argCount){return this.vm.popN(argCount),!0}})),vm_display_headless}var vm_input={},hasRequiredVm_input;function requireVm_input(){return hasRequiredVm_input||(hasRequiredVm_input=1,Object.extend(Squeak,"events",{Mouse_Blue:1,Mouse_Yellow:2,Mouse_Red:4,Keyboard_Shift:8,Keyboard_Ctrl:16,Keyboard_Alt:32,Keyboard_Cmd:64,Mouse_All:7,Keyboard_All:120,EventTypeNone:0,EventTypeMouse:1,EventTypeKeyboard:2,EventTypeDragDropFiles:3,EventKeyChar:0,EventKeyDown:1,EventKeyUp:2,EventDragEnter:1,EventDragMove:2,EventDragLeave:3,EventDragDrop:4,EventTypeWindow:5,EventTypeComplex:6,EventTypeMouseWheel:7,WindowEventMetricChange:1,WindowEventClose:2,WindowEventIconise:3,WindowEventActivated:4,WindowEventPaint:5,WindowEventScreenChange:6,EventTouchDown:1,EventTouchUp:2,EventTouchMoved:3,EventTouchStationary:4,EventTouchCancelled:5})),vm_input}var vm_input_headless={},hasRequiredVm_input_headless;function requireVm_input_headless(){return hasRequiredVm_input_headless||(hasRequiredVm_input_headless=1,Object.extend(Squeak.Primitives.prototype,"input",{primitiveMouseButtons:function(){return!1},primitiveMousePoint:function(){return!1},primitiveKeyboardNext:function(){return!1},primitiveKeyboardPeek:function(){return!1},primitiveInputSemaphore:function(argCount){return this.vm.popNandPush(argCount+1,this.vm.nilObj),!0},primitiveInputWord:function(){return!1},primitiveGetNextEvent:function(){return!1},primitiveBeep:function(){return!1},primitiveClipboardText:function(){return!1}})),vm_input_headless}var vm_plugins={},hasRequiredVm_plugins;function requireVm_plugins(){return hasRequiredVm_plugins||(hasRequiredVm_plugins=1,Object.extend(Squeak.Primitives.prototype,"initialization",{initPlugins:function(){Object.extend(this.builtinModules,{JavaScriptPlugin:this.findPluginFunctions("js_"),FilePlugin:this.findPluginFunctions("","primitive(Disable)?(File|Directory)"),DropPlugin:this.findPluginFunctions("","primitiveDropRequest"),SoundPlugin:this.findPluginFunctions("snd_"),JPEGReadWriter2Plugin:this.findPluginFunctions("jpeg2_"),SqueakFFIPrims:this.findPluginFunctions("ffi_","",!0),HostWindowPlugin:this.findPluginFunctions("hostWindow_"),SecurityPlugin:{primitiveDisableImageWrite:this.fakePrimitive.bind(this,"SecurityPlugin.primitiveDisableImageWrite",0),primitiveGetUntrustedUserDirectory:this.fakePrimitive.bind(this,"SecurityPlugin.primitiveGetUntrustedUserDirectory","/SqueakJS")},LocalePlugin:{primitiveTimezoneOffset:this.fakePrimitive.bind(this,"LocalePlugin.primitiveTimezoneOffset",0)}}),Object.extend(this.patchModules,{ScratchPlugin:this.findPluginFunctions("scratch_")})},findPluginFunctions:function(prefix,match,bindLate){match=match||"(initialise|shutdown|prim)";var plugin={},regex=new RegExp("^"+prefix+match,"i");for(var funcName in this)if(regex.test(funcName)&&"function"==typeof this[funcName]){var primName=funcName;prefix&&(primName=funcName[prefix.length].toLowerCase()+funcName.slice(prefix.length+1)),plugin[primName]=bindLate?funcName:this[funcName].bind(this)}return plugin}})),vm_plugins}var vm_plugins_file_node={},hasRequiredVm_plugins_file_node;function requireVm_plugins_file_node(){if(hasRequiredVm_plugins_file_node)return vm_plugins_file_node;hasRequiredVm_plugins_file_node=1;var fs=require$$0$3,path=require$$1$1,previousWriteBuffers=["","",""],openFileDescriptors=[];return Object.extend(Squeak.Primitives.prototype,"FilePlugin",{primitiveDirectoryCreate:function(argCount){var dirNameObj=this.stackNonInteger(0);if(!this.success)return!1;var dirName=dirNameObj.bytesAsString();try{fs.mkdirSync(dirName)}catch(e){return console.error("Failed to create directory: "+dirName),!1}return this.popNIfOK(argCount)},primitiveDirectoryDelete:function(argCount){if(this.stackNonInteger(0),!this.success)return!1;var dirName=dirName.bytesAsString();try{fs.rmdirSync(dirName)}catch(e){return console.error("Failed to delete directory: "+dirName),!1}return this.popNIfOK(argCount)},primitiveDirectoryDelimitor:function(argCount){var delimitor=this.emulateMac?":":path.sep;return this.popNandPushIfOK(argCount+1,this.charFromInt(delimitor.charCodeAt(0)))},primitiveDirectoryLookup:function(argCount){var index=this.stackInteger(0),dirNameObj=this.stackNonInteger(1);if(!this.success)return!1;var dirName=dirNameObj.bytesAsString(),entry=null;try{var dirEntries=fs.readdirSync(dirName);if(index<1||index>dirEntries.length)return!1;var dirEntry=dirEntries[index-1],stats=fs.statSync(dirName+path.sep+dirEntry);entry=[dirEntry,Math.floor((stats.ctimeMs-Squeak.Epoch)/1e3),Math.floor((stats.mtimeMs-Squeak.Epoch)/1e3),stats.isDirectory(),stats.isFile()?stats.size:0]}catch(e){return-20!==e.errno&&console.error("Failed to read directory: "+dirName),!1}return this.popNandPushIfOK(argCount+1,this.makeStObject(entry)),!0},primitiveFileStdioHandles:function(argCount){var handles=[this.makeFileHandle("/dev/stdin",0,!1),this.makeFileHandle("/dev/stdout",1,!0),this.makeFileHandle("/dev/stderr",2,!0)];return this.popNandPushIfOK(argCount+1,this.makeStArray(handles)),!0},primitiveFileOpen:function(argCount){var writeFlag=this.stackBoolean(0),fileNameObj=this.stackNonInteger(1);if(!this.success)return!1;var fd,fileName=fileNameObj.bytesAsString();try{if((fd=fs.openSync(fileName,writeFlag?"a+":"r"))<0)return!1}catch(e){return console.error("Failed to open file: "+fileName),!1}var handle=this.makeFileHandle(fileName,fd,writeFlag);return openFileDescriptors.push(fd),this.popNandPushIfOK(argCount+1,handle),!0},primitiveFileSize:function(argCount){var fileSize,handle=this.stackNonInteger(0);if(!this.success)return!1;try{fileSize=fs.fstatSync(handle.fd).size}catch(e){return console.error("Failed to get file size"),!1}return this.popNandPushIfOK(argCount+1,this.makeLargeIfNeeded(fileSize)),!0},primitiveFileGetPosition:function(argCount){var handle=this.stackNonInteger(0);return!!this.success&&(this.popNandPushIfOK(argCount+1,this.makeLargeIfNeeded(handle.filePos)),!0)},primitiveFileSetPosition:function(argCount){var pos=this.stackPos32BitInt(0),handle=this.stackNonInteger(1);return!!this.success&&(handle.filePos=pos,this.popNIfOK(argCount))},primitiveFileAtEnd:function(argCount){var fileAtEnd,handle=this.stackNonInteger(0);if(!this.success)return!1;try{fileAtEnd=handle.filePos>=fs.fstatSync(handle.fd).size}catch(e){return console.error("Failed to decide if at end of file"),!1}return this.popNandPushIfOK(argCount+1,this.makeStObject(fileAtEnd)),!0},primitiveDirectorySetMacTypeAndCreator:function(argCount){return this.popNIfOK(argCount)},primitiveFileRead:function(argCount){var count=this.stackInteger(0),startIndex=this.stackInteger(1)-1,arrayObj=this.stackNonInteger(2),handle=this.stackNonInteger(3);if(!this.success||!arrayObj.isWordsOrBytes())return!1;if(!count)return this.popNandPushIfOK(argCount+1,0);var bytesRead,array=arrayObj.bytes;if(array||(array=arrayObj.wordsAsUint8Array(),startIndex*=4,count*=4),startIndex<0||startIndex+count>array.length)return!1;if(0===handle.fd)return console.warn("File reading on stdin not implemented yet"),!1;try{bytesRead=fs.readSync(handle.fd,array,startIndex,count,handle.filePos),handle.filePos+=bytesRead}catch(e){return console.error("Failed to read from file"),!1}return count=arrayObj.bytes?bytesRead:bytesRead>>2,this.popNandPushIfOK(argCount+1,count),!0},primitiveFileWrite:function(argCount){var count=this.stackInteger(0),startIndex=this.stackInteger(1)-1,arrayObj=this.stackNonInteger(2),handle=this.stackNonInteger(3);if(!this.success||!handle.fileWrite)return!1;if(!count)return this.popNandPushIfOK(argCount+1,0);var bytesWritten,array=arrayObj.bytes;if(array||(array=arrayObj.wordsAsUint8Array(),startIndex*=4,count*=4),!array)return!1;if(startIndex<0||startIndex+count>array.length)return!1;if(1===handle.fd||2===handle.fd)for(var logger=1===handle.fd?console.log:console.error,buffer=array.slice(startIndex,startIndex+count);count>0&&buffer.length>0;){var linefeedIndex=buffer.indexOf(10);linefeedIndex>=0?(logger(previousWriteBuffers[handle.fd]+String.fromCharCode.apply(null,buffer.slice(0,linefeedIndex))),previousWriteBuffers[handle.fd]="",buffer=buffer.slice(linefeedIndex+1),bytesWritten+=linefeedIndex+1,count-=linefeedIndex+1,handle.filePos+=linefeedIndex+1):(previousWriteBuffers[handle.fd]+=String.fromCharCode.apply(null,buffer),bytesWritten+=buffer.length,count-=buffer.length,handle.filePos+=buffer.length)}else try{bytesWritten=fs.writeSync(handle.fd,array,startIndex,count,handle.filePos),handle.filePos+=bytesWritten}catch(e){return console.error("Failed to write to file"),!1}return arrayObj.bytes||(bytesWritten>>=2),this.popNandPushIfOK(argCount+1,bytesWritten),!0},primitiveFileFlush:function(argCount){var handle=this.stackNonInteger(0);if(!this.success)return!1;if(1===handle.fd||2===handle.fd)(1===handle.fd?console.log:console.error)(previousWriteBuffers[handle.fd]),previousWriteBuffers[handle.fd]="";else try{fs.fsyncSync(handle.fd)}catch(e){return console.error("Failed to flush file"),!1}return this.popNIfOK(argCount)},primitiveFileTruncate:function(argCount){var pos=this.stackPos32BitInt(0),handle=this.stackNonInteger(1);if(!this.success||!handle.fileWrite)return!1;try{fs.fstatSync(handle.fd).size>pos&&(fs.ftruncateSync(handle.fd,pos),handle.filePos>pos&&(handle.filePos=pos))}catch(e){return console.error("Failed to truncate file"),!1}return this.popNIfOK(argCount)},primitiveFileClose:function(argCount){var handle=this.stackNonInteger(0);if(!this.success)return!1;try{fs.closeSync(handle.fd),openFileDescriptors=openFileDescriptors.filter((function(fd){return fd!==handle.fd}))}catch(e){return console.error("Failed to close file"),!1}return this.popNIfOK(argCount)},primitiveFileRename:function(argCount){var oldNameObj=this.stackNonInteger(1),newNameObj=this.stackNonInteger(0);if(!this.success)return!1;var oldName=oldNameObj.bytesAsString(),newName=newNameObj.bytesAsString();try{fs.renameSync(oldName,newName)}catch(e){return console.error("Failed to rename file from: "+oldName+" to: "+newName),!1}return this.popNIfOK(argCount)},primitiveFileDelete:function(argCount){var fileNameObj=this.stackNonInteger(0);if(!this.success)return!1;var fileName=fileNameObj.bytesAsString();try{fs.unlinkSync(fileName)}catch(e){return console.error("Failed to delete file: "+fileName),!1}return this.popNIfOK(argCount)},makeFileHandle:function(filename,fd,writeFlag){var handle=this.makeStString(filename);return handle.fd=fd,handle.fileWrite=writeFlag,handle.filePos=0,handle},filenameToSqueak:function(unixpath){return unixpath},filenameFromSqueak:function(filepath){return filepath}}),Object.extend(Squeak,{flushAllFiles:function(){openFileDescriptors.forEach((function(fd){try{fs.fsyncSync(fd)}catch(e){console.error("Failed to flush one of the files")}}))},filePut:function(fileName,buffer){try{fs.writeFileSync(fileName,new Uint8Array(buffer))}catch(e){console.error("Failed to create file with content: "+fileName)}}}),vm_plugins_file_node}var os=require$$0$4,fs=require$$0$3,process$1=require$$2$1,path=require$$1$1,processArgs=process$1.argv.slice(2),ignoreQuit="-ignoreQuit"===processArgs[0];ignoreQuit&&(processArgs=processArgs.slice(1));var fullName=processArgs[0];fullName||(console.error("No image name specified."),console.log("Usage (simplified): "+path.basename(process$1.argv0)+path.basename(process$1.argv[1])+" [-ignoreQuit] <image filename>"),process$1.exit(1));var root=path.dirname(fullName)+path.sep,imageName=path.basename(fullName,".image");Object.assign(commonjsGlobal,{self:new Proxy({},{get:function(obj,prop){return commonjsGlobal[prop]},set:function(obj,prop,value){return commonjsGlobal[prop]=value,!0}})});class SessionStorage{storage={};constructor(){var self=this;Object.keys(process$1.env).forEach((function(key){self.storage[key]=process$1.env[key]})),self.storage.CLIENT_VERSION="2"}getItem(name){return this.storage[name]}setItem(name,value){this.storage[name]=value}removeItem(name){delete this.storage[name]}get length(){return Object.keys(this.storage).length}key(index){return Object.keys(this.storage)[index]}}function CpSystemPlugin(){return{getModuleName:function(){return"CpSystemPlugin"},interpreterProxy:null,primHandler:null,setInterpreter:function(anInterpreter){return this.setupGlobalObject(),this.interpreterProxy=anInterpreter,this.vm=anInterpreter.vm,this.primHandler=this.vm.primHandler,this.characterClass=this.vm.globalNamed("Character"),this.symbolClass=this.vm.globalNamed("Symbol"),this.symbolTable=Object.create(null),this.stringClass=this.vm.globalNamed("String"),this.byteStringClass=this.vm.globalNamed("ByteString"),this.wideStringClass=this.vm.globalNamed("WideString"),this.arrayClass=this.vm.globalNamed("Array"),this.byteArrayClass=this.vm.globalNamed("ByteArray"),this.wordArrayClass=this.vm.globalNamed("WordArray"),this.associationClass=this.vm.globalNamed("Association"),this.dictionaryClass=this.vm.globalNamed("Dictionary"),this.orderedDictionaryClass=this.vm.globalNamed("OrderedDictionary"),this.largePositiveIntegerClass=this.vm.globalNamed("LargePositiveInteger"),this.largeNegativeIntegerClass=this.vm.globalNamed("LargeNegativeInteger"),this.contextClass=this.vm.globalNamed("Context"),this.processClass=this.vm.globalNamed("Process"),this.maxProcessPriority=this.primHandler.getScheduler().pointers[Squeak.ProcSched_processLists].pointersSize(),this.globalProxyClasses={},this.lastException=null,this.updateStringSupport(),this.updateMakeStObject(),this.updateMakeStArray(),!0},setupGlobalObject:function(){"undefined"!=typeof window?window.globalThis||(window.globalThis=window):(commonjsGlobal.globalThis||(commonjsGlobal.globalThis=commonjsGlobal),globalThis.require=function(name){var module=require(name);return Object.keys(module).forEach((function(key){if(key[0]>="A"&&key[0]<="Z"){var value=module[key];value&&value.constructor&&value.prototype&&value===value.prototype.constructor&&(value.__cp_className=name+"."+key)}})),module},globalThis.constructor=function(){}),globalThis.identity=function(x){return x??globalThis}},runUninterrupted:function(process){var primHandler=this.primHandler,schedulerPointers=primHandler.getScheduler().pointers,activeProcess=schedulerPointers[Squeak.ProcSched_activeProcess];activeProcess&&!activeProcess.runProcess&&primHandler.putToSleep(activeProcess),primHandler.transferTo(process);var compiled,vm=this.vm;do{(compiled=vm.method.compiled)?compiled(vm):vm.interpretOneSistaWithExtensions(!1,0,0)}while(process===schedulerPointers[Squeak.ProcSched_activeProcess]);activeProcess&&primHandler.transferTo(activeProcess)},signalSemaphoreWithIndex:function(index){this.vm.runProcessLoop(!0),this.primHandler.signalSemaphoreWithIndex(index)},updateStringSupport:function(){this.stringClass.classInstProto().prototype.asString=function(){for(var charChunks=[],src=this.bytes||this.words||[],i=0;i<src.length;)charChunks.push(String.fromCodePoint.apply(null,src.subarray(i,i+=16348)));return charChunks.join("")};var thisHandle=this;Squeak.Primitives.prototype.makeStString=function(string){for(var isWideString=!1,src=Array.from(string).map((function(char){var charValue=char.codePointAt(0);return charValue>=256&&(isWideString=!0),charValue})),newString=thisHandle.vm.instantiateClass(isWideString?thisHandle.wideStringClass:thisHandle.byteStringClass,src.length),dst=newString.bytes||newString.words||[],i=0;i<src.length;i++)dst[i]=src[i];return newString}},updateMakeStObject:function(){var thisHandle=this;this.minSmallInteger=this.vm.image.is64Bit?Number.MIN_SAFE_INTEGER:-1073741824,this.maxSmallInteger=this.vm.image.is64Bit?Number.MAX_SAFE_INTEGER:1073741823,this.primHandler.makeStObject=function(obj,proxyClass,seen){if(null==obj)return this.vm.nilObj;if(!0===obj)return this.vm.trueObj;if(!1===obj)return this.vm.falseObj;if(obj.sqClass)return obj;if(obj.constructor===Number){if(Number.isInteger(obj)){if(obj>thisHandle.maxSmallInteger||obj<thisHandle.minSmallInteger){var isNegative=obj<0;isNegative&&(obj=-obj);for(var bytes=[],i=0;obj>0;){var byte=255&obj;bytes[i++]=byte,obj=(obj-byte)/256}var largeInteger=this.vm.instantiateClass(this.vm.specialObjects[isNegative?Squeak.splOb_ClassLargeNegativeInteger:Squeak.splOb_ClassLargePositiveInteger],bytes.length);return largeInteger.bytes=bytes,largeInteger}return obj}return this.makeFloat(obj)}var stObj;if(seen=seen||[],void 0!==(stObj=thisHandle.findSeenObj(seen,obj)))return stObj;if(obj.substring)return thisHandle.addSeenObj(seen,obj,this.makeStString(obj));if(obj.slice&&void 0!==obj.length){if(!obj.BYTES_PER_ELEMENT)return thisHandle.addSeenObj(seen,obj,this.makeStArray(obj,proxyClass,seen));if(obj.constructor===Float32Array||obj.constructor===Float64Array)return thisHandle.addSeenObj(seen,obj,this.makeStArray(obj,null,seen));switch(obj.BYTES_PER_ELEMENT){case 1:return thisHandle.addSeenObj(seen,obj,this.makeStByteArray(obj));case 2:case 4:return thisHandle.addSeenObj(seen,obj,thisHandle.makeStWordArray(obj));default:return console.error("No support for TypedArrays with bytes per element: "+obj.BYTES_PER_ELEMENT,obj),this.vm.nilObj}}return obj.constructor===Object&&!thisHandle.hasFunctions(obj)||void 0===obj.constructor&&"object"==typeof obj?thisHandle.makeStOrderedDictionary(obj,seen):(proxyClass||(proxyClass=thisHandle.getProxyClassFor(obj)),proxyClass?((stObj=this.vm.instantiateClass(proxyClass,0)).jsObj=obj,thisHandle.addSeenObj(seen,obj,stObj)):(console.error("Can't create Smalltalk object for the following object (answering nil)",obj),this.vm.nilObj))}},updateMakeStArray:function(){var thisHandle=this;this.primHandler.makeStArray=function(obj,proxyClass,seen){seen=seen||[];var stObj=thisHandle.findSeenObj(seen,obj);if(void 0!==stObj)return stObj;var array=this.vm.instantiateClass(thisHandle.arrayClass,obj.length);seen.push({jsObj:obj,stObj:array});for(var i=0;i<obj.length;i++)array.pointers[i]=this.makeStObject(obj[i],proxyClass,seen);return array}},makeStWordArray:function(obj){for(var array=this.vm.instantiateClass(this.wordArrayClass,obj.length),i=0;i<obj.length;i++)array.words[i]=4294967295&obj[i];return array},makeStAssociation:function(key,value,seen){var stObj;(seen=seen||[],key&&!key.sqClass)&&(void 0!==(stObj=this.findSeenObj(seen,key))&&(key=stObj));value&&!value.sqClass&&(void 0!==(stObj=this.findSeenObj(seen,value))&&(value=stObj));var association=this.vm.instantiateClass(this.associationClass,0);return association.pointers[0]=this.primHandler.makeStObject(key,void 0,seen),association.pointers[1]=this.primHandler.makeStObject(value,void 0,seen),association},makeStOrderedDictionary:function(obj,seen){seen=seen||[];var stObj=this.findSeenObj(seen,obj);if(void 0!==stObj)return stObj;var orderedDictionary=this.vm.instantiateClass(this.orderedDictionaryClass,0);seen.push({jsObj:obj,stObj:orderedDictionary});var dictionary=this.makeStDictionary(obj,[]);orderedDictionary.pointers[0]=dictionary;var orderedKeys=this.primHandler.makeStArray(Object.keys(obj),void 0,seen);return orderedDictionary.pointers[1]=orderedKeys,orderedDictionary},makeStDictionary:function(obj,seen){seen=seen||[];var stObj=this.findSeenObj(seen,obj);if(void 0!==stObj)return stObj;var dictionary=this.vm.instantiateClass(this.dictionaryClass,0);seen.push({jsObj:obj,stObj:dictionary});var keys=Object.keys(obj),arraySize=Math.floor(4*(keys.length+1)/3),associations=Array(arraySize).fill(null),thisHandle=this;return keys.forEach((function(key){for(var association=thisHandle.makeStAssociation(key,obj[key],seen),position=thisHandle.stringHash(Array.from(key).map((function(c){return c.codePointAt(0)})))%arraySize,index=position,found=!1;!found&&index<arraySize;)null===associations[index]?found=!0:index++;if(!found)for(index=0;!found&&index<position;)null===associations[index]?found=!0:index++;associations[index]=association})),dictionary.pointers[0]=keys.length,dictionary.pointers[1]=this.primHandler.makeStArray(associations,void 0,seen),dictionary},findSeenObj:function(seen,jsObj){var reference=seen.find((function(ref){return ref.jsObj===jsObj}));if(void 0!==reference)return reference.stObj},addSeenObj:function(seen,jsObj,stObj){return seen.push({jsObj,stObj}),stObj},hasFunctions:function(obj){return Object.keys(obj).some((function(each){return each&&each.apply}))},answer:function(argCount,value){return this.interpreterProxy.popthenPush(argCount+1,this.primHandler.makeStObject(value)),!0},answerSelf:function(argCount){return this.interpreterProxy.pop(argCount),!0},asJavaScriptObject:function(obj){return obj.isNil?null:!!obj.isTrue||!obj.isFalse&&("number"==typeof obj?obj:obj.isFloat?obj.float:obj.jsObj?obj.jsObj:this.isKindOf(obj.sqClass,this.stringClass)?obj.asString():obj.sqClass===this.arrayClass?this.arrayAsJavaScriptObject(obj):this.isKindOf(obj.sqClass,this.orderedDictionaryClass)?this.orderedDictionaryAsJavaScriptObject(obj):this.isKindOf(obj.sqClass,this.dictionaryClass)?this.dictionaryAsJavaScriptObject(obj):obj.domElement?obj.domElement:this.isKindOf(obj.sqClass,this.contextClass)?this.contextAsJavaScriptFunction(obj):obj.sqClass===this.largePositiveIntegerClass?this.largeInteger(obj):obj.sqClass===this.largeNegativeIntegerClass?-this.largeInteger(obj):obj.bytes?obj.bytes:obj.words?obj.words:obj.asString())},arrayAsJavaScriptObject:function(obj){var thisHandle=this;return(obj.pointers||[]).map((function(each){return thisHandle.asJavaScriptObject(each)}))},orderedDictionaryAsJavaScriptObject:function(obj){var unordered=this.dictionaryAsJavaScriptObject(obj.pointers[0]);return this.arrayAsJavaScriptObject(obj.pointers[1]).reduce((function(result,key){return result[key]=unordered[key],result}),{})},dictionaryAsJavaScriptObject:function(obj){var thisHandle=this,associations=obj.pointers.find((function(pointer){return pointer&&pointer.sqClass===thisHandle.arrayClass}));if(!associations||!associations.pointers||!associations.pointers.forEach)throw Error("Dictionary has unexpected structure");var result={};return associations.pointers.forEach((function(assoc){assoc.isNil||(result[thisHandle.asJavaScriptObject(assoc.pointers[0])]=thisHandle.asJavaScriptObject(assoc.pointers[1]))})),result},contextAsJavaScriptFunction:function(obj){var thisHandle=this,func=function(){var context=thisHandle.vm.image.clone(obj);func.__cp_context=context;var blockArgs=Array.from(arguments).map((function(each){return thisHandle.primHandler.makeStObject(each)}));context.__cp_func_arguments=blockArgs;var processResult=thisHandle.newProcessForContext(context).runProcess();if(processResult.error)throw processResult.error;return processResult.answer};return func},newProcessForContext:function(context,processName){var process=this.vm.instantiateClass(this.processClass,0);process.pointers[Squeak.Proc_suspendedContext]=context,process.pointers[Squeak.Proc_priority]=this.maxProcessPriority,processName&&(process.pointers[Squeak.Proc_name]=processName);var thisHandle=this;return process.runProcess=function(){thisHandle.runUninterrupted(process);var result=context.__cp_func_result;return result instanceof Error&&result.cause&&result.cause.sqClass?{error:result}:{answer:result}},process},isKindOf:function(sqClass,searchClass){for(;sqClass&&!sqClass.isNil;){if(sqClass===searchClass)return!0;sqClass=sqClass.superclass()}return!1},largeInteger:function(obj){for(var value=0,bytes=obj.bytes||[],n=bytes.length,i=0,f=1;i<n;i++,f*=256)value+=bytes[i]*f;return value},"primitiveObjectTraceCr:":function(argCount){if(1!==argCount)return!1;var message=this.interpreterProxy.stackValue(0).asString();return console.log((new Date).toISOString()+" "+message),this.answerSelf(argCount)},"primitiveObjectWarnCr:":function(argCount){if(1!==argCount)return!1;var message=this.interpreterProxy.stackValue(0).asString();return console.warn((new Date).toISOString()+" "+message),this.answerSelf(argCount)},"primitiveObjectErrorCr:":function(argCount){if(1!==argCount)return!1;var message=this.interpreterProxy.stackValue(0).asString();return console.error((new Date).toISOString()+" "+message),this.answerSelf(argCount)},symbolFromString:function(string){var registeredSymbol=this.symbolTable[string];if(void 0!==registeredSymbol)return registeredSymbol;for(var newSymbol=this.vm.instantiateClass(this.symbolClass,string.length),i=0;i<string.length;i++)newSymbol.bytes[i]=255&string.charCodeAt(i);return this.symbolTable[string]=newSymbol,newSymbol},"primitiveSymbolRegister:":function(argCount){if(1!==argCount)return!1;var symbol=this.interpreterProxy.stackValue(0),symbolString=symbol.asString();if(this.symbolTable[symbolString])throw Error("Registered non-unique Symbol: "+symbolString);return this.symbolTable[symbolString]=symbol,this.answerSelf(argCount)},"primitiveSymbolFromString:":function(argCount){if(1!==argCount)return!1;var string=this.interpreterProxy.stackValue(0).asString();return this.answer(argCount,this.symbolFromString(string))},"primitiveSymbolEquals:":function(argCount){if(1!==argCount)return!1;var otherObject=this.interpreterProxy.stackValue(0),receiver=this.interpreterProxy.stackValue(argCount),result=otherObject===receiver;if(!result){var src=receiver.bytes||receiver.words||[],dst=otherObject.bytes||otherObject.words||[];if(src.length===dst.length){var i=0;for(result=!0;i<src.length&&result;)src[i]!==dst[i]?result=!1:i++}}return this.answer(argCount,result)},primitiveSymbolIsLiteralSymbol:function(argCount){if(0!==argCount)return!1;var receiver=this.interpreterProxy.stackValue(argCount),src=receiver.bytes||receiver.words||[],i=1,result=src.length>0;if(result){var isLetter=function(c){return c>=65&&c<=90||c>=97&&c<=122},isBinary=function(c){return[33,37,38,42,43,44,45,47,60,61,62,63,64,92,96,124,215,247].indexOf(c)>=0||c>=126&&c<=191&&[170,181,186].indexOf(c)<0},check=isLetter(src[0])?function(c){return isLetter(c)||function(c){return c>=48&&c<=57}(c)||function(c){return 58===c}(c)}:isBinary(src[0])?function(c){return isBinary(c)}:null;for(result=null!==check;i<src.length&&result;){result=check(src[i]),i++}}return this.answer(argCount,result)},primitiveByteArrayAsString:function(argCount){if(0!==argCount)return!1;var receiver=this.interpreterProxy.stackValue(argCount);return this.answer(argCount,receiver.asString())},"primitiveNumberRaisedTo:":function(argCount){if(1!==argCount)return!1;var receiver=this.interpreterProxy.stackValue(argCount),exp=this.interpreterProxy.stackValue(0),base=null;return receiver.isFloat?base=receiver.float:"number"==typeof receiver&&(base=receiver),null!==base&&this.answer(argCount,Math.pow(base,exp))},primitiveNumberPrintString:function(argCount){if(0!==argCount)return!1;var receiver=this.interpreterProxy.stackValue(argCount),value=null;return receiver.isFloat?value=receiver.float:"number"==typeof receiver&&(value=receiver),null!==value&&this.answer(argCount,value.toString())},"primitiveNumberPrintStringBase:":function(argCount){if(1!==argCount)return!1;var base=this.interpreterProxy.stackValue(0);if("number"!=typeof base||base<2||base>36)return!1;var receiver=this.interpreterProxy.stackValue(argCount),value=null;return receiver.isFloat?10===base&&(value=receiver.float.toString()):"number"==typeof receiver&&(value=receiver.toString(base)),null!==value&&this.answer(argCount,10!==base?base+"r"+value:value)},primitiveIntegerAtRandom:function(argCount){if(0!==argCount)return!1;var upperBound=this.interpreterProxy.stackValue(argCount);return"number"==typeof upperBound&&this.answer(argCount,Math.floor(Math.random()*(upperBound-1)+1))},"primitiveStringFromWordArray:":function(argCount){if(1!==argCount)return!1;for(var receiver=this.interpreterProxy.stackValue(argCount),src=this.interpreterProxy.stackValue(0).words||[],newString=this.vm.instantiateClass(receiver,src.length),dst=newString.bytes||newString.words,i=0;i<src.length;i++)dst[i]=src[i];return this.answer(argCount,newString)},skipDelimiters:function(src,delimiters,from){for(;from<src.length;from++)if(delimiters.indexOf(src[from])<0)return from;return src.length+1},findDelimiters:function(src,delimiters,from){for(;from<src.length;from++)if(delimiters.indexOf(src[from])>=0)return from;return src.length+1},createSubstring:function(src,start,end){for(var substring=src.slice(start,end),isWideString=substring.some((function(charValue){return charValue>=256})),newString=this.vm.instantiateClass(isWideString?this.wideStringClass:this.byteStringClass,substring.length),dst=newString.bytes||newString.words||[],i=0;i<substring.length;i++)dst[i]=substring[i];return newString},stringHash:function(src){for(var hash=13312,i=0;i<src.length;i++){var low=16383&(hash+=src[i]);hash=9741*low+16384*(9741*Math.floor(hash/16384)+101*low&16383)&268435455}return hash},"primitiveStringConcatenate:":function(argCount){if(1!==argCount)return!1;for(var receiver=this.interpreterProxy.stackValue(argCount),otherString=this.interpreterProxy.stackValue(0),first=receiver.bytes||receiver.words||[],second=otherString.bytes||otherString.words||[],isWideString=receiver.words||otherString.words||!1,newString=this.vm.instantiateClass(isWideString?this.wideStringClass:this.byteStringClass,first.length+second.length),dst=newString.bytes||newString.words,i=0;i<first.length;i++)dst[i]=first[i];for(var j=0;j<second.length;j++,i++)dst[i]=second[j];return this.answer(argCount,newString)},"primitiveStringAsciiCompare:":function(argCount){if(1!==argCount)return!1;for(var otherString=this.interpreterProxy.stackValue(0),receiver=this.interpreterProxy.stackValue(argCount),src=receiver.bytes||receiver.words||[],dst=otherString.bytes||otherString.words||[],minLength=Math.min(src.length,dst.length),i=0;i<minLength;i++){var cmp=src[i]-dst[i];if(cmp>0)return this.answer(argCount,3);if(cmp<0)return this.answer(argCount,1)}return src.length>minLength?this.answer(argCount,3):dst.length>minLength?this.answer(argCount,1):this.answer(argCount,2)},primitiveStringAsUppercase:function(argCount){if(0!==argCount)return!1;for(var receiver=this.interpreterProxy.stackValue(argCount),src=receiver.bytes||receiver.words||[],uppercaseString=this.vm.instantiateClass(receiver.sqClass,src.length),dst=receiver.bytes?uppercaseString.bytes:uppercaseString.words,i=0;i<src.length;i++)dst[i]=String.fromCodePoint(src[i]).toUpperCase().codePointAt(0);return this.answer(argCount,uppercaseString)},primitiveStringAsLowercase:function(argCount){if(0!==argCount)return!1;for(var receiver=this.interpreterProxy.stackValue(argCount),src=receiver.bytes||receiver.words||[],lowercaseString=this.vm.instantiateClass(receiver.sqClass,src.length),dst=receiver.bytes?lowercaseString.bytes:lowercaseString.words,i=0;i<src.length;i++)dst[i]=String.fromCodePoint(src[i]).toLowerCase().codePointAt(0);return this.answer(argCount,lowercaseString)},primitiveStringAsNumber:function(argCount){if(0!==argCount)return!1;var numberString=this.interpreterProxy.stackValue(argCount).asString(),result=null;if("NaN"===numberString)result=Number.NaN;else if("Infinity"===numberString)result=Number.POSITIVE_INFINITY;else if("-Infinity"===numberString)result=Number.NEGATIVE_INFINITY;else{var numberMatch=numberString.match(/^(\d+r)?(-?\d+(?:\.\d+)?(?:e-?\d)?)$/);if(numberMatch)if(numberMatch[1]){var base=Number.parseInt(numberMatch[1]);base>=2&&base<=36&&numberMatch[2].indexOf(".")<0&&numberMatch[2].indexOf("e")<0&&(result=Number.parseInt(numberMatch[2],base))}else result=+numberMatch[2]}return null!==result&&this.answer(argCount,result)},"primitiveStringFindTokens:":function(argCount){if(1!==argCount)return!1;for(var receiver=this.interpreterProxy.stackValue(argCount),src=receiver.bytes||receiver.words||[],delimitersString=this.interpreterProxy.stackValue(0),delimiters=delimitersString.bytes||delimitersString.words||[],result=[],keyStop=0;keyStop<src.length;){var keyStart=this.skipDelimiters(src,delimiters,keyStop);keyStart<(keyStop=this.findDelimiters(src,delimiters,keyStart))&&result.push(this.createSubstring(src,keyStart,keyStop))}return this.answer(argCount,result)},"primitiveStringIndexOf:":function(argCount){if(1!==argCount)return!1;var character=this.interpreterProxy.stackValue(0),string=this.interpreterProxy.stackValue(argCount).asString();return this.answer(argCount,character.sqClass===this.characterClass?string.indexOf(String.fromCodePoint(character.hash))+1:0)},"primitiveStringIncludesSubstring:":function(argCount){if(1!==argCount)return!1;var src=this.interpreterProxy.stackValue(argCount).asString(),substring=this.interpreterProxy.stackValue(0).asString();return this.answer(argCount,src.indexOf(substring)>=0)},primitiveStringHash:function(argCount){if(0!==argCount)return!1;var receiver=this.interpreterProxy.stackValue(argCount),src=receiver.bytes||receiver.words||[],hash=this.stringHash(src);return this.answer(argCount,hash)},primitiveStringTrim:function(argCount){if(0!==argCount)return!1;this.interpreterProxy.stackValue(argCount);var src=this.interpreterProxy.stackValue(argCount).asString();return this.answer(argCount,src.trim())},primitiveStringTrimLeft:function(argCount){if(0!==argCount)return!1;this.interpreterProxy.stackValue(argCount);var src=this.interpreterProxy.stackValue(argCount).asString();return this.answer(argCount,src.trimStart())},primitiveStringTrimRight:function(argCount){if(0!==argCount)return!1;this.interpreterProxy.stackValue(argCount);var src=this.interpreterProxy.stackValue(argCount).asString();return this.answer(argCount,src.trimEnd())},"primitiveWideStringFrom:":function(argCount){if(1!==argCount)return!1;for(var receiver=this.interpreterProxy.stackValue(argCount),srcString=this.interpreterProxy.stackValue(0),src=srcString.bytes||srcString.words||[],newString=this.vm.instantiateClass(receiver,src.length),dst=newString.words,i=0;i<src.length;i++)dst[i]=src[i];return this.answer(argCount,newString)},"primitiveJavaScriptObjectRegisterProxyClass:forClassName:":function(argCount){if(2!==argCount)return!1;var proxyClass=this.interpreterProxy.stackValue(1);if(proxyClass.isNil)return!1;var proxyClassName=this.interpreterProxy.stackValue(0).asString();return!!proxyClassName&&(this.globalProxyClasses[proxyClassName]=proxyClass,Function.prototype.applyPassThrough||(Function.prototype.applyPassThrough=function(thisArg,args){return this.apply(thisArg,args)}),this.answerSelf(argCount))},getProxyClassFor:function(jsObj){var jsClass=jsObj&&jsObj.constructor;if(!jsClass)return null;var proxyClassNames=Object.keys(this.globalProxyClasses);if(0===proxyClassNames.length)return null;for(var proxyClassName=void 0;jsClass;)proxyClassName=proxyClassNames.find((function(name){return jsClass.__cp_className===name||globalThis[name]===jsClass})),jsClass=proxyClassName?null:Object.getPrototypeOf(jsClass);return proxyClassName||(proxyClassName="Object"),this.globalProxyClasses[proxyClassName]},"primitiveJavaScriptObjectApply:withArguments:resultAs:":function(argCount){if(3!==argCount)return!1;var obj=this.interpreterProxy.stackValue(argCount).jsObj;if(void 0===obj)return!1;var selectorName=this.interpreterProxy.stackValue(2).asString();if(!selectorName)return!1;var args=obj.constructor===Function&&"applyPassThrough"===selectorName?[null,this.interpreterProxy.stackValue(1).pointers[1].pointers.map((function(each){return each}))]:this.asJavaScriptObject(this.interpreterProxy.stackValue(1))||[],proxyClass=this.interpreterProxy.stackValue(0),result=void 0;try{this.lastException=null;var func=obj[selectorName];if(func&&func.apply)result=func.apply(obj,args);else{var selectorDescription=this.getSelectorNamed(obj,selectorName);if(!selectorDescription){var colonIndex=selectorName.indexOf(":");colonIndex>0&&(selectorDescription=this.getSelectorNamed(obj,selectorName.slice(0,colonIndex)))}if(!selectorDescription)return!1;if(selectorDescription.get&&0===args.length)result=selectorDescription.get.apply(obj);else if(selectorDescription.set&&1===args.length)result=selectorDescription.set.apply(obj,args);else if(selectorDescription.value&&selectorDescription.value.constructor===Function)result=selectorDescription.value.apply(obj,args);else{if(void 0===selectorDescription.writable)return!1;0===args.length?result=selectorDescription.value:1===args.length&&selectorDescription.writable&&(result=obj[selectorName]=args[0])}}}catch(e){return this.lastException=e,!1}if(null!=result&&!proxyClass.isNil){var proxyInstance=this.vm.instantiateClass(proxyClass,0);proxyInstance.jsObj=result,result=proxyInstance}return this.answer(argCount,result)},"primitiveJavaScriptObjectLastExceptionAs:":function(argCount){if(1!==argCount)return!1;var exception=this.lastException;if(null!==exception){var proxyClass=this.getProxyClassFor(exception);proxyClass&&proxyClass!==this.globalProxyClasses.Object||(proxyClass=this.interpreterProxy.stackValue(0));var proxyInstance=this.vm.instantiateClass(proxyClass,0);proxyInstance.jsObj=exception,exception=proxyInstance,this.lastException=null}return this.answer(argCount,exception)},"primitiveJavaScriptObjectPropertyAt:resultAs:":function(argCount){if(2!==argCount)return!1;var obj=this.interpreterProxy.stackValue(argCount).jsObj;if(void 0===obj)return!1;var propertyName=this.interpreterProxy.stackValue(1).asString(),proxyClass=this.interpreterProxy.stackValue(0),result=obj[propertyName];if(null!=result&&!proxyClass.isNil){var proxyInstance=this.vm.instantiateClass(proxyClass,0);proxyInstance.jsObj=result,result=proxyInstance}return this.answer(argCount,result)},"primitiveJavaScriptObjectPropertyAt:put:":function(argCount){if(2!==argCount)return!1;var obj=this.interpreterProxy.stackValue(argCount).jsObj;if(void 0===obj)return!1;var propertyName=this.interpreterProxy.stackValue(1).asString(),propertyValue=this.asJavaScriptObject(this.interpreterProxy.stackValue(0));return obj[propertyName]=propertyValue,this.answerSelf(argCount)},"primitiveJavaScriptObjectRawPropertyAt:":function(argCount){if(1!==argCount)return!1;var obj=this.interpreterProxy.stackValue(argCount).jsObj;if(void 0===obj)return!1;var result=obj[this.interpreterProxy.stackValue(0).asString()];return null==result||result.isNil?(this.interpreterProxy.popthenPush(argCount+1,this.vm.nilObj),!0):!!(result.sqClass||"number"==typeof result&&result>=this.minSmallInteger&&result<=this.maxSmallInteger)&&(this.interpreterProxy.popthenPush(argCount+1,result),!0)},"primitiveJavaScriptObjectRawPropertyAt:put:":function(argCount){if(2!==argCount)return!1;var obj=this.interpreterProxy.stackValue(argCount).jsObj;if(void 0===obj)return!1;var propertyName=this.interpreterProxy.stackValue(1).asString(),propertyValue=this.interpreterProxy.stackValue(0);return obj[propertyName]=propertyValue,this.answerSelf(argCount)},primitiveJavaScriptObjectGetSelectorNames:function(argCount){if(0!==argCount)return!1;var obj=this.interpreterProxy.stackValue(argCount).jsObj;if(void 0===obj)return!1;for(var names=Object.create(null);obj;){Object.getOwnPropertyNames(obj).forEach((function(name){names[name]=!0})),obj=Object.getPrototypeOf(obj)}return this.answer(argCount,Object.keys(names))},"primitiveJavaScriptObjectGetSelectorType:":function(argCount){if(1!==argCount)return!1;var obj=this.interpreterProxy.stackValue(argCount).jsObj;if(void 0===obj)return!1;var selectorName=this.interpreterProxy.stackValue(0).asString();if(!selectorName)return!1;var selectorDescription=this.getSelectorNamed(obj,selectorName);if(!selectorDescription)return this.answer(argCount,null);var type=void 0;return type=selectorDescription.get?selectorDescription.set?"read-write-prop":"read-prop":selectorDescription.set?"write-prop":void 0!==selectorDescription.writable?selectorDescription.value&&selectorDescription.value.constructor===Function?"function":selectorDescription.writable?"read-write-attr":"read-attr":"unknown",this.answer(argCount,this.symbolFromString(type))},"primitiveJavaScriptObjectGetClassRefFrom:resultAs:":function(argCount){if(2!==argCount)return!1;var obj=this.interpreterProxy.stackValue(argCount).jsObj;if(void 0===obj)return!1;var selectorName=this.interpreterProxy.stackValue(1).asString();if(!selectorName)return!1;var proxyClass=this.interpreterProxy.stackValue(0);if(proxyClass.isNil)return!1;var objClass=obj[selectorName];if(!objClass)return!1;var proxyInstance=this.vm.instantiateClass(proxyClass,0);return proxyInstance.jsObj=objClass,this.answer(argCount,proxyInstance)},getSelectorNamed:function(obj,selectorName){for(var selectorDescription=void 0;obj&&!selectorDescription;)(selectorDescription=Object.getOwnPropertyDescriptor(obj,selectorName))||(obj=Object.getPrototypeOf(obj));return selectorDescription},"primitiveJavaScriptClassNewInstanceWithArguments:resultAs:":function(argCount){if(2!==argCount)return!1;var jsClass=this.interpreterProxy.stackValue(argCount).jsObj,args=this.asJavaScriptObject(this.interpreterProxy.stackValue(1))||[],proxyClass=this.interpreterProxy.stackValue(0),instance=void 0;try{var jsInstance=Reflect.construct(jsClass,args);(instance=this.vm.instantiateClass(proxyClass.isNil?this.getProxyClassFor(jsInstance):proxyClass,0)).jsObj=jsInstance}catch(e){console.error("Failed to instantiate class "+jsClass,e)}return this.answer(argCount,instance)},primitiveJavaScriptFunctionArguments:function(argCount){if(0!==argCount)return!1;var receiver=this.interpreterProxy.stackValue(argCount);if(!receiver.jsObj)return!1;var context=receiver.jsObj.__cp_context;return!!context&&this.answer(argCount,context.__cp_func_arguments)},"primitiveJavaScriptFunctionSetResult:":function(argCount){if(1!==argCount)return!1;var receiver=this.interpreterProxy.stackValue(argCount);if(!receiver.jsObj)return!1;var context=receiver.jsObj.__cp_context;if(!context)return!1;var result=this.asJavaScriptObject(this.interpreterProxy.stackValue(0));return context.__cp_func_result=result,this.answerSelf(argCount)},"primitiveEnvironmentVariableAt:":function(argCount){if(1!==argCount)return!1;var variableName=this.interpreterProxy.stackValue(0).asString();if(!variableName)return!1;var variableValue=globalThis.sessionStorage.getItem(variableName);return this.answer(argCount,variableValue)},"primitiveEnvironmentVariableAt:put:":function(argCount){if(2!==argCount)return!1;var variableName=this.interpreterProxy.stackValue(1).asString();if(!variableName)return!1;var variableValue=this.interpreterProxy.stackValue(0).asString();return!!variableValue&&(globalThis.sessionStorage.setItem(variableName,variableValue),this.answerSelf(argCount))},primitiveEnvironmentVariableNames:function(argCount){if(0!==argCount)return!1;for(var variableNames=new Array(globalThis.sessionStorage.length),i=0;i<globalThis.sessionStorage.length;i++)variableNames[i]=globalThis.sessionStorage.key(i);return this.answer(argCount,variableNames)},"primitiveEnvironmentRemoveVariableAt:":function(argCount){if(1!==argCount)return!1;var variableName=this.interpreterProxy.stackValue(0).asString();return!!variableName&&(globalThis.sessionStorage.removeItem(variableName),this.answerSelf(argCount))},"primitiveEnvironmentPersistentVariableAt:":function(argCount){if(1!==argCount)return!1;var variableName=this.interpreterProxy.stackValue(0).asString();if(!variableName)return!1;var variableValue=globalThis.localStorage.getItem(variableName);return this.answer(argCount,variableValue)},"primitiveEnvironmentPersistentVariableAt:put:":function(argCount){if(2!==argCount)return!1;var variableName=this.interpreterProxy.stackValue(1).asString();if(!variableName)return!1;var variableValue=this.interpreterProxy.stackValue(0).asString();return!!variableValue&&(globalThis.localStorage.setItem(variableName,variableValue),this.answerSelf(argCount))},"primitiveEnvironmentRemovePersistentVariableAt:":function(argCount){if(1!==argCount)return!1;var variableName=this.interpreterProxy.stackValue(0).asString();return!!variableName&&(globalThis.localStorage.removeItem(variableName),this.answerSelf(argCount))},"primitiveEnvironmentAlert:":function(argCount){if(1!==argCount)return!1;var message=this.interpreterProxy.stackValue(0).asString();return globalThis.alert?globalThis.alert(message):console.warn(message),this.answerSelf(argCount)},"primitiveEnvironmentConfirm:":function(argCount){if(1!==argCount)return!1;var message=this.interpreterProxy.stackValue(0).asString();return!!globalThis.confirm&&this.answer(argCount,!0===globalThis.confirm(message))},"primitiveEnvironmentGlobalApply:withArguments:":function(argCount){if(2!==argCount)return!1;var functionName=this.interpreterProxy.stackValue(1).asString();if(!functionName)return!1;var functionArguments=this.asJavaScriptObject(this.interpreterProxy.stackValue(0))||[],func=globalThis[functionName];if(!func||!func.apply)return!1;var result=void 0;try{result=func.apply(globalThis,functionArguments)}catch(e){console.error("Failed to perform apply:withArguments on global object:",e,"Selector:",functionName,"Arguments:",functionArguments)}return this.answer(argCount,result)},primitiveEnvironmentReload:function(argCount){return 0===argCount&&("undefined"!=typeof window&&(window.document.location.reload(!0),this.answerSelf(argCount)))},"primitiveWebSocketConnectToUrl:withEventSemaphore:":function(argCount){if(2!==argCount)return!1;var receiver=this.interpreterProxy.stackValue(argCount),url=this.interpreterProxy.stackValue(1).asString(),semaIndex=this.interpreterProxy.stackIntegerValue(0);return receiver.webSocketHandle={webSocket:new WebSocket(url),url,semaIndex,buffers:[]},this.setupWebSocket(receiver.webSocketHandle),this.answerSelf(argCount)},setupWebSocket:function(webSocketHandle){var thisHandle=this,webSocket=webSocketHandle.webSocket;webSocket.onopen=function(){thisHandle.signalSemaphoreWithIndex(webSocketHandle.semaIndex)},webSocket.onclose=function(){thisHandle.signalSemaphoreWithIndex(webSocketHandle.semaIndex)},webSocket.onerror=function(event){console.error("Failure on WebSocket for url ["+webSocketHandle.url+"]: ",event),thisHandle.signalSemaphoreWithIndex(webSocketHandle.semaIndex)},webSocket.onmessage=function(event){new Response(event.data).arrayBuffer().then((function(data){webSocketHandle.buffers.push(new Uint8Array(data)),thisHandle.signalSemaphoreWithIndex(webSocketHandle.semaIndex),thisHandle.vm.forceInterruptCheck()})).catch((function(error){console.error("Failed to read websocket message",error),thisHandle.signalSemaphoreWithIndex(webSocketHandle.semaIndex)}))}},primitiveWebSocketReceivedMessage:function(argCount){if(0!==argCount)return!1;var webSocketHandle=this.interpreterProxy.stackValue(argCount).webSocketHandle;if(!webSocketHandle)return!1;var receiveBuffer=webSocketHandle.buffers.splice(0,1)[0],result=receiveBuffer?this.primHandler.makeStByteArray(receiveBuffer):this.vm.nilObj;return this.answer(argCount,result)},"primitiveWebSocketSend:":function(argCount){if(1!==argCount)return!1;var receiver=this.interpreterProxy.stackValue(argCount),sendBuffer=this.interpreterProxy.stackObjectValue(0),webSocketHandle=receiver.webSocketHandle;if(!webSocketHandle)return!1;var success=!1;if(1===webSocketHandle.webSocket.readyState)try{webSocketHandle.webSocket.send(sendBuffer.bytes),success=!0}catch(e){console.error("Failed to write websocket message",e),this.signalSemaphoreWithIndex(webSocketHandle.semaIndex)}return this.answer(argCount,success)},primitiveWebSocketReadyState:function(argCount){if(0!==argCount)return!1;var webSocketHandle=this.interpreterProxy.stackValue(argCount).webSocketHandle;if(!webSocketHandle)return!1;var readyState=webSocketHandle.webSocket.readyState;return this.answer(argCount,readyState)},primitiveWebSocketClose:function(argCount){if(0!==argCount)return!1;var webSocketHandle=this.interpreterProxy.stackValue(argCount).webSocketHandle;if(!webSocketHandle)return!1;var success=!1;try{webSocketHandle.webSocket&&(webSocketHandle.webSocket.close(),success=!0)}catch(e){console.error("Failed to close websocket",e),this.signalSemaphoreWithIndex(webSocketHandle.semaIndex)}return this.answer(argCount,success)}}}function registerCpSystemPlugin(){"object"==typeof Squeak&&Squeak.registerExternalModule?Squeak.registerExternalModule("CpSystemPlugin",CpSystemPlugin()):globalThis.setTimeout(registerCpSystemPlugin,100)}Object.assign(self,{localStorage:{},sessionStorage:new SessionStorage,WebSocket:"undefined"==typeof WebSocket?requireWebSocket():WebSocket,sha1:requireSha1(),btoa:function(string){return Buffer.from(string,"ascii").toString("base64")},atob:function(string){return Buffer.from(string,"base64").toString("ascii")}}),requireGlobals(),requireVm(),requireVm_object(),requireVm_object_spur(),requireVm_image(),requireVm_interpreter(),requireVm_interpreter_proxy(),requireVm_instruction_stream(),requireVm_instruction_stream_sista(),requireVm_instruction_printer(),requireVm_primitives(),requireJit(),requireVm_display(),requireVm_display_headless(),requireVm_input(),requireVm_input_headless(),requireVm_plugins(),requireVm_plugins_file_node(),Object.extend(Squeak,{vmPath:process$1.cwd()+path.sep,platformSubtype:"Node.js",osVersion:process$1.version+" "+os.platform()+" "+os.release()+" "+os.arch(),windowSystem:"none"}),Object.extend(Squeak.Primitives.prototype,{loadModuleDynamically:function(modName){try{return require("./plugins/"+modName),Squeak.externalModules[modName]}catch(e){console.error("Plugin "+modName+" could not be loaded")}}}),fs.readFile(root+imageName+".image",(function(error,data){if(error)console.error("Failed to read image",error);else{var image=new Squeak.Image(root+imageName);image.readFromBuffer(data.buffer,(function(){var display={vmOptions:["-vm-display-null","-nodisplay"]},vm=new Squeak.Interpreter(image,display);vm.processLoopCounter=0,vm.runProcessLoop=function(restart){if(!0===restart){if(!vm.stoppedProcessLoop)return;var activeProcess=vm.primHandler.getScheduler().pointers[Squeak.ProcSched_activeProcess];if(!activeProcess||activeProcess.isNil)return;vm.stoppedProcessLoop=!1,vm.processLoopCounter=0}try{vm.interpret(50,(function(ms){if("sleep"===ms){if(vm.stoppedProcessLoop)return;++vm.processLoopCounter>7&&(vm.stoppedProcessLoop=!0)}else vm.processLoopCounter=0;!ignoreQuit&&display.quitFlag||setTimeout(vm.runProcessLoop,"sleep"===ms?10:ms)}))}catch(e){console.error("Failure during Squeak run: ",e)}},vm.runProcessLoop()}))}})),function(){var VM_PROXY_MAJOR=1,VM_PROXY_MINOR=11;function CLASSOF(obj){return"number"==typeof obj?interpreterProxy.classSmallInteger():obj.sqClass}function BYTESIZEOF(obj){return obj.bytes?obj.bytes.length:obj.words?4*obj.words.length:0}function DIV(a,b){return 0|Math.floor(a/b)}function MOD(a,b){return a-DIV(a,b)*b|0}function SHL(a,b){return b>31?0:a<<b}function SHR(a,b){return b>31?0:a>>>b}var andOpIndex=0,interpreterProxy=null,moduleName="LargeIntegers v1.5 (e)",orOpIndex=1,xorOpIndex=2;function anyBitOfBytesfromto(aBytesOop,start,stopArg){var lastByteIx,magnitude,leftShift,rightShift,firstByteIx,stop,mask,ix;if(start<1||stopArg<1)return interpreterProxy.primitiveFail();if(magnitude=aBytesOop,stop=Math.min(stopArg,function(aBytesOop){return cDigitHighBitlen(aBytesOop.bytes,BYTESIZEOF(aBytesOop))}(magnitude)),start>stop)return!1;if(firstByteIx=1+(start-1>>3),lastByteIx=1+(stop-1>>3),rightShift=MOD(start-1,8),leftShift=7-MOD(stop-1,8),firstByteIx===lastByteIx)return mask=SHL(255,rightShift)&SHR(255,leftShift),0!=(digitOfBytesat(magnitude,firstByteIx)&mask);if(0!==SHR(digitOfBytesat(magnitude,firstByteIx),rightShift))return!0;for(ix=firstByteIx+1;ix<=lastByteIx-1;ix++)if(0!==digitOfBytesat(magnitude,ix))return!0;return 0!=(255&SHL(digitOfBytesat(magnitude,lastByteIx),leftShift))}function bytesgrowTo(aBytesObject,newLen){var oldLen,copyLen,newBytes;return newBytes=interpreterProxy.instantiateClassindexableSize(CLASSOF(aBytesObject),newLen),copyLen=(oldLen=BYTESIZEOF(aBytesObject))<newLen?oldLen:newLen,cDigitCopyFromtolen(aBytesObject.bytes,newBytes.bytes,copyLen),newBytes}function bytesOrIntgrowTo(oop,len){var sq_class,val,newBytes;return"number"==typeof oop?(sq_class=(val=oop)<0?interpreterProxy.classLargeNegativeInteger():interpreterProxy.classLargePositiveInteger(),function(val,bytes){var pByte,ix,ixLimiT;for(pByte=bytes.bytes,ix=1,ixLimiT=cDigitLengthOfCSI(val);ix<=ixLimiT;ix++)pByte[ix-1]=cDigitOfCSIat(val,ix)}(val,newBytes=interpreterProxy.instantiateClassindexableSize(sq_class,len))):newBytes=bytesgrowTo(oop,len),newBytes}function cDigitComparewithlen(pFirst,pSecond,len){var firstDigit,secondDigit,ix;for(ix=len-1;ix>=0;){if((secondDigit=pSecond[ix])!==(firstDigit=pFirst[ix]))return secondDigit<firstDigit?1:-1;--ix}return 0}function cDigitCopyFromtolen(pFrom,pTo,len){var limit,i;for(limit=len-1,i=0;i<=limit;i++)pTo[i]=pFrom[i];return 0}function cDigitHighBitlen(pByte,len){var lastDigit,realLength;for(realLength=len;0===(lastDigit=pByte[realLength-1]);)if(0==--realLength)return 0;return cHighBit(lastDigit)+8*(realLength-1)}function cDigitLengthOfCSI(csi){return csi<256&&csi>-256?1:csi<65536&&csi>-65536?2:csi<16777216&&csi>-16777216?3:4}function cDigitOfCSIat(csi,ix){return ix<1&&interpreterProxy.primitiveFail(),ix>4?0:csi<0?255&SHR(0-csi,8*(ix-1)):255&SHR(csi,8*(ix-1))}function cDigitReplacefromtowithstartingAt(pTo,start,stop,pFrom,repStart){return function(){for(var len=stop-start+1,i=0;i<len;i++)pTo[i+start]=pFrom[i+repStart];return 0}()}function cHighBit(uint){var shifted,bitNo;return bitNo=0,(shifted=uint)<65536||(shifted>>>=16,bitNo+=16),shifted<256||(shifted>>>=8,bitNo+=8),shifted<16||(shifted>>>=4,bitNo+=4),shifted<4||(shifted>>>=2,bitNo+=2),shifted<2||(shifted>>>=1,++bitNo),bitNo+shifted}function createLargeFromSmallInteger(anOop){var size,res,pByte,ix,sq_class,val;for(sq_class=(val=anOop)<0?interpreterProxy.classLargeNegativeInteger():interpreterProxy.classLargePositiveInteger(),size=cDigitLengthOfCSI(val),pByte=(res=interpreterProxy.instantiateClassindexableSize(sq_class,size)).bytes,ix=1;ix<=size;ix++)pByte[ix-1]=cDigitOfCSIat(val,ix);return res}function digitLshift(aBytesOop,shiftCount){var newLen,oldLen,newBytes,highBit;return oldLen=BYTESIZEOF(aBytesOop),0===(highBit=cDigitHighBitlen(aBytesOop.bytes,oldLen))?0:(newLen=highBit+shiftCount+7>>3,newBytes=interpreterProxy.instantiateClassindexableSize(CLASSOF(aBytesOop),newLen),function(shiftCount,pFrom,lenFrom,pTo,lenTo){var digitShift,carry,digit,i,bitShift,rshift,limit;for(digitShift=shiftCount>>3,bitShift=MOD(shiftCount,8),limit=digitShift-1,i=0;i<=limit;i++)pTo[i]=0;if(0===bitShift)return cDigitReplacefromtowithstartingAt(pTo,digitShift,lenTo-1,pFrom,0);for(rshift=8-bitShift,carry=0,limit=lenFrom-1,i=0;i<=limit;i++)digit=pFrom[i],pTo[i+digitShift]=255&(carry|SHL(digit,bitShift)),carry=SHR(digit,rshift);0!==carry&&(pTo[lenTo-1]=carry)}(shiftCount,aBytesOop.bytes,oldLen,newBytes.bytes,newLen),newBytes)}function digitRshiftlookfirst(aBytesOop,shiftCount,a){var newOop,oldDigitLen,newByteLen,newBitLen,oldBitLen;return oldDigitLen=(oldBitLen=cDigitHighBitlen(aBytesOop.bytes,a))+7>>3,(newBitLen=oldBitLen-shiftCount)<=0?interpreterProxy.instantiateClassindexableSize(CLASSOF(aBytesOop),0):(newByteLen=newBitLen+7>>3,newOop=interpreterProxy.instantiateClassindexableSize(CLASSOF(aBytesOop),newByteLen),function(shiftCount,pFrom,fromLen,pTo,toLen){var j,digitShift,carry,digit,bitShift,leftShift,limit,start;if(digitShift=shiftCount>>3,0===(bitShift=MOD(shiftCount,8)))return cDigitReplacefromtowithstartingAt(pTo,0,toLen-1,pFrom,digitShift);for(leftShift=8-bitShift,carry=SHR(pFrom[digitShift],bitShift),limit=fromLen-1,j=start=digitShift+1;j<=limit;j++)digit=pFrom[j],pTo[j-start]=255&(carry|SHL(digit,leftShift)),carry=SHR(digit,bitShift);0!==carry&&(pTo[toLen-1]=carry)}(shiftCount,aBytesOop.bytes,oldDigitLen,newOop.bytes,newByteLen),newOop)}function digitAddLargewith(firstInteger,secondInteger){var sum,shortLen,over,shortInt,resClass,newSum,longLen,firstLen,secondLen,longInt;return firstLen=BYTESIZEOF(firstInteger),secondLen=BYTESIZEOF(secondInteger),resClass=CLASSOF(firstInteger),firstLen<=secondLen?(shortInt=firstInteger,shortLen=firstLen,longInt=secondInteger,longLen=secondLen):(shortInt=secondInteger,shortLen=secondLen,longInt=firstInteger,longLen=firstLen),sum=interpreterProxy.instantiateClassindexableSize(resClass,longLen),over=function(pByteShort,shortLen,pByteLong,longLen,pByteRes){var i,limit,accum;for(accum=0,limit=shortLen-1,i=0;i<=limit;i++)accum=(accum>>>8)+pByteShort[i]+pByteLong[i],pByteRes[i]=255&accum;for(limit=longLen-1,i=shortLen;i<=limit;i++)accum=(accum>>>8)+pByteLong[i],pByteRes[i]=255&accum;return accum>>>8}(shortInt.bytes,shortLen,longInt.bytes,longLen,sum.bytes),over>0&&(newSum=interpreterProxy.instantiateClassindexableSize(resClass,longLen+1),cDigitCopyFromtolen(sum.bytes,newSum.bytes,longLen),(sum=newSum).bytes[longLen]=over),sum}function digitBitLogicwithopIndex(firstInteger,secondInteger,opIx){var shortLen,shortLarge,firstLarge,secondLarge,longLen,longLarge,firstLen,secondLen,result;if("number"==typeof firstInteger){if(firstInteger<0)return interpreterProxy.primitiveFail();firstLarge=createLargeFromSmallInteger(firstInteger)}else{if(CLASSOF(firstInteger)===interpreterProxy.classLargeNegativeInteger())return interpreterProxy.primitiveFail();firstLarge=firstInteger}if("number"==typeof secondInteger){if(secondInteger<0)return interpreterProxy.primitiveFail();secondLarge=createLargeFromSmallInteger(secondInteger)}else{if(CLASSOF(secondInteger)===interpreterProxy.classLargeNegativeInteger())return interpreterProxy.primitiveFail();secondLarge=secondInteger}return(firstLen=BYTESIZEOF(firstLarge))<(secondLen=BYTESIZEOF(secondLarge))?(shortLen=firstLen,shortLarge=firstLarge,longLen=secondLen,longLarge=secondLarge):(shortLen=secondLen,shortLarge=secondLarge,longLen=firstLen,longLarge=firstLarge),result=interpreterProxy.instantiateClassindexableSize(interpreterProxy.classLargePositiveInteger(),longLen),function(opIndex,pByteShort,shortLen,pByteLong,longLen,pByteRes){var i,limit;if(limit=shortLen-1,opIndex===andOpIndex){for(i=0;i<=limit;i++)pByteRes[i]=pByteShort[i]&pByteLong[i];for(limit=longLen-1,i=shortLen;i<=limit;i++)pByteRes[i]=0;return 0}if(opIndex===orOpIndex){for(i=0;i<=limit;i++)pByteRes[i]=pByteShort[i]|pByteLong[i];for(limit=longLen-1,i=shortLen;i<=limit;i++)pByteRes[i]=pByteLong[i];return 0}if(opIndex===xorOpIndex){for(i=0;i<=limit;i++)pByteRes[i]=pByteShort[i]^pByteLong[i];for(limit=longLen-1,i=shortLen;i<=limit;i++)pByteRes[i]=pByteLong[i];return 0}interpreterProxy.primitiveFail()}(opIx,shortLarge.bytes,shortLen,longLarge.bytes,longLen,result.bytes),interpreterProxy.failed()?0:normalizePositive(result)}function digitCompareLargewith(firstInteger,secondInteger){var secondLen,firstLen;return firstLen=BYTESIZEOF(firstInteger),(secondLen=BYTESIZEOF(secondInteger))!==firstLen?secondLen>firstLen?-1:1:cDigitComparewithlen(firstInteger.bytes,secondInteger.bytes,firstLen)}function digitDivLargewithnegative(firstInteger,secondInteger,neg){var resultClass,result,rem,div,quo,d,l,secondLen,firstLen;return firstLen=BYTESIZEOF(firstInteger),secondLen=BYTESIZEOF(secondInteger),resultClass=neg?interpreterProxy.classLargeNegativeInteger():interpreterProxy.classLargePositiveInteger(),(l=firstLen-secondLen+1)<=0?(result=interpreterProxy.instantiateClassindexableSize(interpreterProxy.classArray(),2),interpreterProxy.stObjectatput(result,1,0),interpreterProxy.stObjectatput(result,2,firstInteger),result):(div=bytesOrIntgrowTo(div=digitLshift(secondInteger,d=8-cHighBit(unsafeByteOfat(secondInteger,secondLen))),digitLength(div)+1),digitLength(rem=digitLshift(firstInteger,d))===firstLen&&(rem=bytesOrIntgrowTo(rem,firstLen+1)),quo=interpreterProxy.instantiateClassindexableSize(resultClass,l),function(pDiv,divLen,pRem,remLen,pQuo,quoLen){var b,q,a,dnh,lo,hi,r3,mul,cond,l,k,j,i,dl,ql,r1r2,dh,t;for(ql=quoLen,dh=pDiv[(dl=divLen-1)-1],dnh=1===dl?0:pDiv[dl-2],k=1;k<=ql;k++){if(pRem[(j=remLen+1-k)-1]===dh)q=255;else for(t=MOD(r1r2=((r1r2=pRem[j-1])<<8)+pRem[j-2],dh),hi=(mul=(q=DIV(r1r2,dh))*dnh)>>>8,lo=255&mul,r3=j<3?0:pRem[j-3];t<hi||t===hi&&r3<lo?(--q,lo<dnh?(--hi,lo=lo+256-dnh):lo-=dnh,cond=hi>=dh):cond=!1,cond;)hi-=dh;for(l=j-dl,a=0,i=1;i<=divLen;i++)hi=pDiv[i-1]*(q>>>8),lo=pDiv[i-1]*(255&q),b=pRem[l-1]-a-(255&lo),pRem[l-1]=255&b,a=hi+(lo>>>8)-(b>>=8),++l;if(a>0)for(--q,l=j-dl,a=0,i=1;i<=divLen;i++)a=(a>>>8)+pRem[l-1]+pDiv[i-1],pRem[l-1]=255&a,++l;pQuo[quoLen-k]=q}}(div.bytes,digitLength(div),rem.bytes,digitLength(rem),quo.bytes,digitLength(quo)),rem=digitRshiftlookfirst(rem,d,digitLength(div)-1),result=interpreterProxy.instantiateClassindexableSize(interpreterProxy.classArray(),2),interpreterProxy.stObjectatput(result,1,quo),interpreterProxy.stObjectatput(result,2,rem),result)}function digitLength(oop){return"number"==typeof oop?cDigitLengthOfCSI(oop):BYTESIZEOF(oop)}function digitMontgomerytimesmodulomInvModB(firstLarge,secondLarge,thirdLarge,mInv){var prod,thirdLen,firstLen,secondLen;return firstLen=BYTESIZEOF(firstLarge),secondLen=BYTESIZEOF(secondLarge),firstLen<=(thirdLen=BYTESIZEOF(thirdLarge))&&secondLen<=thirdLen&&mInv>=0&&mInv<=255?(prod=interpreterProxy.instantiateClassindexableSize(interpreterProxy.classLargePositiveInteger(),thirdLen),function(pBytesFirst,firstLen,pBytesSecond,secondLen,pBytesThird,thirdLen,mInv,pBytesRes){var k,i,lastByte,limit3,limit2,limit1,u,accum;for(limit1=firstLen-1,limit2=secondLen-1,limit3=thirdLen-1,lastByte=0,i=0;i<=limit1;i++){for(accum=pBytesRes[0]+pBytesFirst[i]*pBytesSecond[0],accum+=(u=accum*mInv&255)*pBytesThird[0],k=1;k<=limit2;k++)accum=(accum>>>8)+pBytesRes[k]+pBytesFirst[i]*pBytesSecond[k]+u*pBytesThird[k],pBytesRes[k-1]=255&accum;for(k=secondLen;k<=limit3;k++)accum=(accum>>>8)+pBytesRes[k]+u*pBytesThird[k],pBytesRes[k-1]=255&accum;accum=(accum>>>8)+lastByte,pBytesRes[limit3]=255&accum,lastByte=accum>>>8}for(i=firstLen;i<=limit3;i++){for(accum=pBytesRes[0],accum+=(u=accum*mInv&255)*pBytesThird[0],k=1;k<=limit3;k++)accum=(accum>>>8)+pBytesRes[k]+u*pBytesThird[k],pBytesRes[k-1]=255&accum;accum=(accum>>>8)+lastByte,pBytesRes[limit3]=255&accum,lastByte=accum>>>8}if(0!==lastByte||1!==cDigitComparewithlen(pBytesThird,pBytesRes,thirdLen))for(accum=0,i=0;i<=limit3;i++)accum=accum+pBytesRes[i]-pBytesThird[i],pBytesRes[i]=255&accum,accum>>=8}(firstLarge.bytes,firstLen,secondLarge.bytes,secondLen,thirdLarge.bytes,thirdLen,mInv,prod.bytes),normalizePositive(prod)):interpreterProxy.primitiveFail()}function digitMultiplyLargewithnegative(firstInteger,secondInteger,neg){var longInt,resultClass,shortLen,shortInt,longLen,prod,secondLen,firstLen;return(firstLen=BYTESIZEOF(firstInteger))<=(secondLen=BYTESIZEOF(secondInteger))?(shortInt=firstInteger,shortLen=firstLen,longInt=secondInteger,longLen=secondLen):(shortInt=secondInteger,shortLen=secondLen,longInt=firstInteger,longLen=firstLen),resultClass=neg?interpreterProxy.classLargeNegativeInteger():interpreterProxy.classLargePositiveInteger(),prod=interpreterProxy.instantiateClassindexableSize(resultClass,longLen+shortLen),function(pByteShort,shortLen,pByteLong,longLen,pByteRes){var ab,j,digit,carry,i,limitLong,k,limitShort;if(1===shortLen&&0===pByteShort[0])return 0;if(1===longLen&&0===pByteLong[0])return 0;for(limitShort=shortLen-1,limitLong=longLen-1,i=0;i<=limitShort;i++)if(0!==(digit=pByteShort[i])){for(k=i,carry=0,j=0;j<=limitLong;j++)carry=(ab=(ab=pByteLong[j])*digit+carry+pByteRes[k])>>>8,pByteRes[k]=255&ab,++k;pByteRes[k]=carry}}(shortInt.bytes,shortLen,longInt.bytes,longLen,prod.bytes),normalize(prod)}function digitOfBytesat(aBytesOop,ix){return ix>BYTESIZEOF(aBytesOop)?0:unsafeByteOfat(aBytesOop,ix)}function digitSubLargewith(firstInteger,secondInteger){var smallerLen,larger,res,smaller,resLen,largerLen,firstNeg,firstLen,secondLen,neg;if(firstNeg=CLASSOF(firstInteger)===interpreterProxy.classLargeNegativeInteger(),(firstLen=BYTESIZEOF(firstInteger))===(secondLen=BYTESIZEOF(secondInteger))){for(;firstLen>1&&digitOfBytesat(firstInteger,firstLen)===digitOfBytesat(secondInteger,firstLen);)--firstLen;secondLen=firstLen}return firstLen<secondLen||firstLen===secondLen&&digitOfBytesat(firstInteger,firstLen)<digitOfBytesat(secondInteger,firstLen)?(larger=secondInteger,largerLen=secondLen,smaller=firstInteger,smallerLen=firstLen,neg=!1===firstNeg):(larger=firstInteger,largerLen=firstLen,smaller=secondInteger,smallerLen=secondLen,neg=firstNeg),resLen=largerLen,res=interpreterProxy.instantiateClassindexableSize(neg?interpreterProxy.classLargeNegativeInteger():interpreterProxy.classLargePositiveInteger(),resLen),function(pByteSmall,smallLen,pByteLarge,largeLen,pByteRes){var i,z;for(z=0,i=0;i<=smallLen-1;i++)z=z+pByteLarge[i]-pByteSmall[i],pByteRes[i]=255&z,z>>=8;for(i=smallLen;i<=largeLen-1;i++)z+=pByteLarge[i],pByteRes[i]=255&z,z>>=8}(smaller.bytes,smallerLen,larger.bytes,largerLen,res.bytes),neg?normalizeNegative(res):normalizePositive(res)}function getModuleName(){return moduleName}function isNormalized(anInteger){var ix,len;if("number"==typeof anInteger)return!0;if(0===(len=digitLength(anInteger)))return!1;if(0===unsafeByteOfat(anInteger,len))return!1;if(4,len>4)return!0;if(len<4)return!1;if(CLASSOF(anInteger)===interpreterProxy.classLargePositiveInteger())return 1073741823,unsafeByteOfat(anInteger,4)>cDigitOfCSIat(1073741823,4);if(-1073741824,unsafeByteOfat(anInteger,4)<cDigitOfCSIat(-1073741824,4))return!1;for(ix=1;ix<=4;ix++)if(unsafeByteOfat(anInteger,ix)!==cDigitOfCSIat(-1073741824,ix))return!0;return!1}function normalize(aLargeInteger){return CLASSOF(aLargeInteger)===interpreterProxy.classLargePositiveInteger()?normalizePositive(aLargeInteger):normalizeNegative(aLargeInteger)}function normalizeNegative(aLargeNegativeInteger){var i,len,oldLen,val;for(len=oldLen=digitLength(aLargeNegativeInteger);0!==len&&0===unsafeByteOfat(aLargeNegativeInteger,len);)--len;if(0===len)return 0;if(4,len<=4){if(-1073741824,len<4||digitOfBytesat(aLargeNegativeInteger,4)<cDigitOfCSIat(-1073741824,4)){for(val=0,i=len;i>=1;i+=-1)val=256*val-unsafeByteOfat(aLargeNegativeInteger,i);return val}for(i=1;i<=4;i++)if(digitOfBytesat(aLargeNegativeInteger,i)!==cDigitOfCSIat(-1073741824,i))return len<oldLen?bytesgrowTo(aLargeNegativeInteger,len):aLargeNegativeInteger;return-1073741824}return len<oldLen?bytesgrowTo(aLargeNegativeInteger,len):aLargeNegativeInteger}function normalizePositive(aLargePositiveInteger){var i,len,val,oldLen;for(len=oldLen=digitLength(aLargePositiveInteger);0!==len&&0===unsafeByteOfat(aLargePositiveInteger,len);)--len;if(0===len)return 0;if(4,len<=4&&digitOfBytesat(aLargePositiveInteger,4)<=cDigitOfCSIat(1073741823,4)){for(val=0,i=len;i>=1;i+=-1)val=256*val+unsafeByteOfat(aLargePositiveInteger,i);return val}return len<oldLen?bytesgrowTo(aLargePositiveInteger,len):aLargePositiveInteger}function primAnyBitFromTo(){var integer,from,to,_return_value;return from=interpreterProxy.stackIntegerValue(1),to=interpreterProxy.stackIntegerValue(0),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(2))),integer=interpreterProxy.stackValue(2),interpreterProxy.failed()?null:(_return_value=anyBitOfBytesfromto("number"==typeof integer?createLargeFromSmallInteger(integer):integer,from,to)?interpreterProxy.trueObject():interpreterProxy.falseObject(),interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null)}function primAsLargeInteger(){var anInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),anInteger=interpreterProxy.stackValue(0),interpreterProxy.failed()?null:"number"==typeof anInteger?(_return_value=createLargeFromSmallInteger(anInteger),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null):(interpreterProxy.failed()||interpreterProxy.popthenPush(2,anInteger),null)}function primCheckIfCModuleExists(){var _return_value;return _return_value=interpreterProxy.trueObject(),interpreterProxy.failed()||interpreterProxy.popthenPush(1,_return_value),null}function _primDigitBitShift(){var aLarge,anInteger,shiftCount,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),anInteger=interpreterProxy.stackValue(1),shiftCount=interpreterProxy.stackIntegerValue(0),interpreterProxy.failed()?null:(aLarge="number"==typeof anInteger?createLargeFromSmallInteger(anInteger):anInteger,shiftCount>=0?(_return_value=digitLshift(aLarge,shiftCount),interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null):(_return_value=normalize(digitRshiftlookfirst(aLarge,0-shiftCount,BYTESIZEOF(aLarge))),interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null))}function primDigitAdd(){var firstInteger,secondInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),secondInteger=interpreterProxy.stackValue(0),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),firstInteger=interpreterProxy.stackValue(1),interpreterProxy.failed()?null:(_return_value=digitAddLargewith("number"==typeof firstInteger?createLargeFromSmallInteger(firstInteger):firstInteger,"number"==typeof secondInteger?createLargeFromSmallInteger(secondInteger):secondInteger),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null)}function primDigitAddWith(){var firstInteger,secondInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),firstInteger=interpreterProxy.stackValue(1),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),secondInteger=interpreterProxy.stackValue(0),interpreterProxy.failed()?null:(_return_value=digitAddLargewith("number"==typeof firstInteger?createLargeFromSmallInteger(firstInteger):firstInteger,"number"==typeof secondInteger?createLargeFromSmallInteger(secondInteger):secondInteger),interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null)}function primDigitBitAnd(){var firstInteger,secondInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),secondInteger=interpreterProxy.stackValue(0),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),firstInteger=interpreterProxy.stackValue(1),interpreterProxy.failed()?null:(_return_value=digitBitLogicwithopIndex(firstInteger,secondInteger,andOpIndex),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null)}function primDigitBitLogicWithOp(){var firstInteger,secondInteger,opIndex,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(2))),firstInteger=interpreterProxy.stackValue(2),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),secondInteger=interpreterProxy.stackValue(1),opIndex=interpreterProxy.stackIntegerValue(0),interpreterProxy.failed()?null:(_return_value=digitBitLogicwithopIndex(firstInteger,secondInteger,opIndex),interpreterProxy.failed()||interpreterProxy.popthenPush(4,_return_value),null)}function primDigitBitOr(){var firstInteger,secondInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),secondInteger=interpreterProxy.stackValue(0),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),firstInteger=interpreterProxy.stackValue(1),interpreterProxy.failed()?null:(_return_value=digitBitLogicwithopIndex(firstInteger,secondInteger,orOpIndex),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null)}function primDigitBitShift(){var aLarge,anInteger,shiftCount,_return_value;return shiftCount=interpreterProxy.stackIntegerValue(0),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),anInteger=interpreterProxy.stackValue(1),interpreterProxy.failed()?null:(aLarge="number"==typeof anInteger?createLargeFromSmallInteger(anInteger):anInteger,shiftCount>=0?(_return_value=digitLshift(aLarge,shiftCount),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null):(_return_value=normalize(digitRshiftlookfirst(aLarge,0-shiftCount,BYTESIZEOF(aLarge))),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null))}function primDigitBitShiftMagnitude(){var aLarge,anInteger,shiftCount,_return_value;return shiftCount=interpreterProxy.stackIntegerValue(0),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),anInteger=interpreterProxy.stackValue(1),interpreterProxy.failed()?null:(aLarge="number"==typeof anInteger?createLargeFromSmallInteger(anInteger):anInteger,shiftCount>=0?(_return_value=digitLshift(aLarge,shiftCount),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null):(_return_value=normalize(digitRshiftlookfirst(aLarge,0-shiftCount,BYTESIZEOF(aLarge))),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null))}function primDigitBitXor(){var firstInteger,secondInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),secondInteger=interpreterProxy.stackValue(0),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),firstInteger=interpreterProxy.stackValue(1),interpreterProxy.failed()?null:(_return_value=digitBitLogicwithopIndex(firstInteger,secondInteger,xorOpIndex),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null)}function primDigitCompare(){var firstVal,firstInteger,secondVal,secondInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),secondInteger=interpreterProxy.stackValue(0),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),firstInteger=interpreterProxy.stackValue(1),interpreterProxy.failed()?null:"number"==typeof firstInteger?"number"==typeof secondInteger?(firstVal=firstInteger)>(secondVal=secondInteger)?(_return_value=1,interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null):firstVal<secondVal?(_return_value=-1,interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null):(_return_value=0,interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null):(_return_value=-1,interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null):"number"==typeof secondInteger?(_return_value=1,interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null):(_return_value=digitCompareLargewith(firstInteger,secondInteger),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null)}function primDigitCompareWith(){var firstVal,secondVal,firstInteger,secondInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),firstInteger=interpreterProxy.stackValue(1),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),secondInteger=interpreterProxy.stackValue(0),interpreterProxy.failed()?null:"number"==typeof firstInteger?"number"==typeof secondInteger?(firstVal=firstInteger)>(secondVal=secondInteger)?(_return_value=1,interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null):firstVal<secondVal?(_return_value=-1,interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null):(_return_value=0,interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null):(_return_value=-1,interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null):"number"==typeof secondInteger?(_return_value=1,interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null):(_return_value=digitCompareLargewith(firstInteger,secondInteger),interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null)}function primDigitDivNegative(){var firstAsLargeInteger,firstInteger,secondAsLargeInteger,secondInteger,neg,_return_value;if(interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),secondInteger=interpreterProxy.stackValue(1),neg=interpreterProxy.booleanValueOf(interpreterProxy.stackValue(0)),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(2))),firstInteger=interpreterProxy.stackValue(2),interpreterProxy.failed())return null;if(!isNormalized(firstInteger))return interpreterProxy.primitiveFail(),null;if(!isNormalized(secondInteger))return interpreterProxy.primitiveFail(),null;if(firstAsLargeInteger="number"==typeof firstInteger?createLargeFromSmallInteger(firstInteger):firstInteger,"number"==typeof secondInteger){if(0===secondInteger)return interpreterProxy.primitiveFail(),null;secondAsLargeInteger=createLargeFromSmallInteger(secondInteger)}else secondAsLargeInteger=secondInteger;return _return_value=digitDivLargewithnegative(firstAsLargeInteger,secondAsLargeInteger,neg),interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null}function primDigitDivWithNegative(){var firstAsLargeInteger,secondAsLargeInteger,firstInteger,secondInteger,neg,_return_value;if(interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(2))),firstInteger=interpreterProxy.stackValue(2),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),secondInteger=interpreterProxy.stackValue(1),neg=interpreterProxy.booleanValueOf(interpreterProxy.stackValue(0)),interpreterProxy.failed())return null;if(firstAsLargeInteger="number"==typeof firstInteger?createLargeFromSmallInteger(firstInteger):firstInteger,"number"==typeof secondInteger){if(0===secondInteger)return interpreterProxy.primitiveFail(),null;secondAsLargeInteger=createLargeFromSmallInteger(secondInteger)}else secondAsLargeInteger=secondInteger;return _return_value=digitDivLargewithnegative(firstAsLargeInteger,secondAsLargeInteger,neg),interpreterProxy.failed()||interpreterProxy.popthenPush(4,_return_value),null}function primDigitMultiplyNegative(){var firstInteger,secondInteger,neg,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),secondInteger=interpreterProxy.stackValue(1),neg=interpreterProxy.booleanValueOf(interpreterProxy.stackValue(0)),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(2))),firstInteger=interpreterProxy.stackValue(2),interpreterProxy.failed()?null:(_return_value=digitMultiplyLargewithnegative("number"==typeof firstInteger?createLargeFromSmallInteger(firstInteger):firstInteger,"number"==typeof secondInteger?createLargeFromSmallInteger(secondInteger):secondInteger,neg),interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null)}function primDigitMultiplyWithNegative(){var firstInteger,secondInteger,neg,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(2))),firstInteger=interpreterProxy.stackValue(2),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),secondInteger=interpreterProxy.stackValue(1),neg=interpreterProxy.booleanValueOf(interpreterProxy.stackValue(0)),interpreterProxy.failed()?null:(_return_value=digitMultiplyLargewithnegative("number"==typeof firstInteger?createLargeFromSmallInteger(firstInteger):firstInteger,"number"==typeof secondInteger?createLargeFromSmallInteger(secondInteger):secondInteger,neg),interpreterProxy.failed()||interpreterProxy.popthenPush(4,_return_value),null)}function primDigitSubtract(){var firstInteger,secondInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),secondInteger=interpreterProxy.stackValue(0),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),firstInteger=interpreterProxy.stackValue(1),interpreterProxy.failed()?null:(_return_value=digitSubLargewith("number"==typeof firstInteger?createLargeFromSmallInteger(firstInteger):firstInteger,"number"==typeof secondInteger?createLargeFromSmallInteger(secondInteger):secondInteger),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null)}function primDigitSubtractWith(){var firstInteger,secondInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),firstInteger=interpreterProxy.stackValue(1),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),secondInteger=interpreterProxy.stackValue(0),interpreterProxy.failed()?null:(_return_value=digitSubLargewith("number"==typeof firstInteger?createLargeFromSmallInteger(firstInteger):firstInteger,"number"==typeof secondInteger?createLargeFromSmallInteger(secondInteger):secondInteger),interpreterProxy.failed()||interpreterProxy.popthenPush(3,_return_value),null)}function primGetModuleName(){var strPtr,strLen,i,strOop;for(strLen=getModuleName().length,strPtr=(strOop=interpreterProxy.instantiateClassindexableSize(interpreterProxy.classString(),strLen)).bytes,i=0;i<=strLen-1;i++)strPtr[i]=getModuleName()[i];return interpreterProxy.failed()||interpreterProxy.popthenPush(1,strOop),null}function primMontgomeryTimesModulo(){var firstInteger,secondOperandInteger,thirdModuloInteger,smallInverseInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(2))),secondOperandInteger=interpreterProxy.stackValue(2),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(1))),thirdModuloInteger=interpreterProxy.stackValue(1),smallInverseInteger=interpreterProxy.stackIntegerValue(0),interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(3))),firstInteger=interpreterProxy.stackValue(3),interpreterProxy.failed()?null:(_return_value=digitMontgomerytimesmodulomInvModB("number"==typeof firstInteger?createLargeFromSmallInteger(firstInteger):firstInteger,"number"==typeof secondOperandInteger?createLargeFromSmallInteger(secondOperandInteger):secondOperandInteger,"number"==typeof thirdModuloInteger?createLargeFromSmallInteger(thirdModuloInteger):thirdModuloInteger,smallInverseInteger),interpreterProxy.failed()||interpreterProxy.popthenPush(4,_return_value),null)}function primNormalize(){var anInteger,_return_value;return interpreterProxy.success(interpreterProxy.isKindOfInteger(interpreterProxy.stackValue(0))),anInteger=interpreterProxy.stackValue(0),interpreterProxy.failed()?null:"number"==typeof anInteger?(interpreterProxy.failed()||interpreterProxy.popthenPush(2,anInteger),null):(_return_value=normalize(anInteger),interpreterProxy.failed()||interpreterProxy.popthenPush(2,_return_value),null)}function primNormalizeNegative(){var rcvr,_return_value;return interpreterProxy.success(interpreterProxy.stackValue(0).sqClass===interpreterProxy.classLargeNegativeInteger()),rcvr=interpreterProxy.stackValue(0),interpreterProxy.failed()?null:(_return_value=normalizeNegative(rcvr),interpreterProxy.failed()||interpreterProxy.popthenPush(1,_return_value),null)}function primNormalizePositive(){var rcvr,_return_value;return interpreterProxy.success(interpreterProxy.stackValue(0).sqClass===interpreterProxy.classLargePositiveInteger()),rcvr=interpreterProxy.stackValue(0),interpreterProxy.failed()?null:(_return_value=normalizePositive(rcvr),interpreterProxy.failed()||interpreterProxy.popthenPush(1,_return_value),null)}function setInterpreter(anInterpreter){return!1!=((interpreterProxy=anInterpreter).majorVersion()==VM_PROXY_MAJOR)&&interpreterProxy.minorVersion()>=VM_PROXY_MINOR}function unsafeByteOfat(bytesOop,ix){return bytesOop.bytes[ix-1]}!function registerPlugin(){"object"==typeof Squeak&&Squeak.registerExternalModule?Squeak.registerExternalModule("LargeIntegers",{primDigitAddWith,primDigitBitShiftMagnitude,primGetModuleName,primDigitBitLogicWithOp,primCheckIfCModuleExists,primDigitCompare,primDigitMultiplyNegative,primDigitBitShift,primNormalizePositive,primDigitSubtractWith,_primDigitBitShift,primDigitMultiplyWithNegative,primDigitSubtract,primDigitDivNegative,primNormalizeNegative,primDigitBitOr,primMontgomeryTimesModulo,primDigitBitAnd,primDigitDivWithNegative,setInterpreter,primNormalize,primDigitBitXor,primDigitCompareWith,primDigitAdd,getModuleName,primAsLargeInteger,primAnyBitFromTo}):self.setTimeout(registerPlugin,100)}()}(),registerCpSystemPlugin(),module.exports=node_app;