-
Notifications
You must be signed in to change notification settings - Fork 0
/
cp-node.min.js
14 lines (14 loc) · 284 KB
/
cp-node.min.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-2024 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:e}=requireConstants();function t(t,s){if(0===t.length)return e;if(1===t.length)return t[0];const i=Buffer.allocUnsafe(s);let r=0;for(let e=0;e<t.length;e++){const s=t[e];i.set(s,r),r+=s.length}return i}function s(e,t,s,i,r){for(let n=0;n<r;n++)s[i+n]=e[n]^t[3&n]}function i(e,t){const s=e.length;for(let i=0;i<s;i++)e[i]^=t[3&i]}function r(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function n(e){if(n.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=Buffer.from(e):ArrayBuffer.isView(e)?t=function(e){const t=Buffer.from(e.buffer);if(e.byteLength!==e.buffer.byteLength)return t.slice(e.byteOffset,e.byteOffset+e.byteLength);return t}(e):(t=Buffer.from(e),n.readOnly=!1),t}try{const e=require("bufferutil"),a=e.BufferUtil||e;bufferUtil.exports={concat:t,mask(e,t,i,r,n){n<48?s(e,t,i,r,n):a.mask(e,t,i,r,n)},toArrayBuffer:r,toBuffer:n,unmask(e,t){e.length<32?i(e,t):a.unmask(e,t)}}}catch(e){bufferUtil.exports={concat:t,mask:s,toArrayBuffer:r,toBuffer:n,unmask:i}}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 e=require("utf-8-validate");validation.isValidUTF8="object"==typeof e?e.Validation.isValidUTF8:e}catch(e){validation.isValidUTF8=()=>!0}return validation.isValidStatusCode=e=>e>=1e3&&e<=1013&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999,validation}function requireReceiver(){if(hasRequiredReceiver)return receiver;hasRequiredReceiver=1;const{Writable:e}=require$$0,t=requirePermessageDeflate(),{BINARY_TYPES:s,EMPTY_BUFFER:i,kStatusCode:r,kWebSocket:n}=requireConstants(),{concat:a,toArrayBuffer:o,unmask:c}=requireBufferUtil(),{isValidStatusCode:h,isValidUTF8:u}=requireValidation();function l(e,t,s,i){const n=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(n,l),n[r]=i,n}return receiver=class Receiver extends e{constructor(e,t,i){super(),this._binaryType=e||s[0],this[n]=void 0,this._extensions=t||{},this._maxPayload=0|i,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(e,t,s){if(8===this._opcode&&0==this._state)return s();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(s)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];return this._buffers[0]=t.slice(e),t.slice(0,e)}const t=Buffer.allocUnsafe(e);do{const s=this._buffers[0],i=t.length-e;e>=s.length?t.set(this._buffers.shift(),i):(t.set(new Uint8Array(s.buffer,s.byteOffset,e),i),this._buffers[0]=s.slice(e)),e-=s.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do{switch(this._state){case 0:t=this.getInfo();break;case 1:t=this.getPayloadLength16();break;case 2:t=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:t=this.getData(e);break;default:return void(this._loop=!1)}}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const e=this.consume(2);if(0!=(48&e[0]))return this._loop=!1,l(RangeError,"RSV2 and RSV3 must be clear",!0,1002);const s=64==(64&e[0]);if(s&&!this._extensions[t.extensionName])return this._loop=!1,l(RangeError,"RSV1 must be clear",!0,1002);if(this._fin=128==(128&e[0]),this._opcode=15&e[0],this._payloadLength=127&e[1],0===this._opcode){if(s)return this._loop=!1,l(RangeError,"RSV1 must be clear",!0,1002);if(!this._fragmented)return this._loop=!1,l(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,l(RangeError,`invalid opcode ${this._opcode}`,!0,1002);this._compressed=s}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,l(RangeError,`invalid opcode ${this._opcode}`,!0,1002);if(!this._fin)return this._loop=!1,l(RangeError,"FIN must be set",!0,1002);if(s)return this._loop=!1,l(RangeError,"RSV1 must be clear",!0,1002);if(this._payloadLength>125)return this._loop=!1,l(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002)}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&e[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 e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,l(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009)):(this._payloadLength=t*Math.pow(2,32)+e.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,l(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(e){let t=i;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);t=this.consume(this._payloadLength),this._masked&&c(t,this._mask)}return this._opcode>7?this.controlMessage(t):this._compressed?(this._state=5,void this.decompress(t,e)):(t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage())}decompress(e,s){this._extensions[t.extensionName].decompress(e,this._fin,((e,t)=>{if(e)return s(e);if(t.length){if(this._messageLength+=t.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return s(l(RangeError,"Max payload size exceeded",!1,1009));this._fragments.push(t)}const i=this.dataMessage();if(i)return s(i);this.startLoop(s)}))}dataMessage(){if(this._fin){const e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let s;s="nodebuffer"===this._binaryType?a(t,e):"arraybuffer"===this._binaryType?o(a(t,e)):t,this.emit("message",s)}else{const s=a(t,e);if(!u(s))return this._loop=!1,l(Error,"invalid UTF-8 sequence",!0,1007);this.emit("message",s.toString())}}this._state=0}controlMessage(e){if(8===this._opcode)if(this._loop=!1,0===e.length)this.emit("conclude",1005,""),this.end();else{if(1===e.length)return l(RangeError,"invalid payload length 1",!0,1002);{const t=e.readUInt16BE(0);if(!h(t))return l(RangeError,`invalid status code ${t}`,!0,1002);const s=e.slice(2);if(!u(s))return l(Error,"invalid UTF-8 sequence",!0,1007);this.emit("conclude",t,s.toString()),this.end()}}else 9===this._opcode?this.emit("ping",e):this.emit("pong",e);this._state=0}}}function requireSender(){if(hasRequiredSender)return sender;hasRequiredSender=1;const{randomFillSync:e}=require$$0$1,t=requirePermessageDeflate(),{EMPTY_BUFFER:s}=requireConstants(),{isValidStatusCode:i}=requireValidation(),{mask:r,toBuffer:n}=requireBufferUtil(),a=Buffer.alloc(4);class Sender{constructor(e,t){this._extensions=t||{},this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(t,s){const i=s.mask&&s.readOnly;let n=s.mask?6:2,o=t.length;t.length>=65536?(n+=8,o=127):t.length>125&&(n+=2,o=126);const c=Buffer.allocUnsafe(i?t.length+n:n);return c[0]=s.fin?128|s.opcode:s.opcode,s.rsv1&&(c[0]|=64),c[1]=o,126===o?c.writeUInt16BE(t.length,2):127===o&&(c.writeUInt32BE(0,2),c.writeUInt32BE(t.length,6)),s.mask?(e(a,0,4),c[1]|=128,c[n-4]=a[0],c[n-3]=a[1],c[n-2]=a[2],c[n-1]=a[3],i?(r(t,a,c,n,t.length),[c]):(r(t,a,t,0,t.length),[c,t])):[c,t]}close(e,t,r,n){let a;if(void 0===e)a=s;else{if("number"!=typeof e||!i(e))throw new TypeError("First argument must be a valid error code number");void 0===t||""===t?(a=Buffer.allocUnsafe(2),a.writeUInt16BE(e,0)):(a=Buffer.allocUnsafe(2+Buffer.byteLength(t)),a.writeUInt16BE(e,0),a.write(t,2))}this._deflating?this.enqueue([this.doClose,a,r,n]):this.doClose(a,r,n)}doClose(e,t,s){this.sendFrame(Sender.frame(e,{fin:!0,rsv1:!1,opcode:8,mask:t,readOnly:!1}),s)}ping(e,t,s){const i=n(e);this._deflating?this.enqueue([this.doPing,i,t,n.readOnly,s]):this.doPing(i,t,n.readOnly,s)}doPing(e,t,s,i){this.sendFrame(Sender.frame(e,{fin:!0,rsv1:!1,opcode:9,mask:t,readOnly:s}),i)}pong(e,t,s){const i=n(e);this._deflating?this.enqueue([this.doPong,i,t,n.readOnly,s]):this.doPong(i,t,n.readOnly,s)}doPong(e,t,s,i){this.sendFrame(Sender.frame(e,{fin:!0,rsv1:!1,opcode:10,mask:t,readOnly:s}),i)}send(e,s,i){const r=n(e),a=this._extensions[t.extensionName];let o=s.binary?2:1,c=s.compress;if(this._firstFragment?(this._firstFragment=!1,c&&a&&(c=r.length>=a._threshold),this._compress=c):(c=!1,o=0),s.fin&&(this._firstFragment=!0),a){const e={fin:s.fin,rsv1:c,opcode:o,mask:s.mask,readOnly:n.readOnly};this._deflating?this.enqueue([this.dispatch,r,this._compress,e,i]):this.dispatch(r,this._compress,e,i)}else this.sendFrame(Sender.frame(r,{fin:s.fin,rsv1:!1,opcode:o,mask:s.mask,readOnly:n.readOnly}),i)}dispatch(e,s,i,r){if(!s)return void this.sendFrame(Sender.frame(e,i),r);const n=this._extensions[t.extensionName];this._deflating=!0,n.compress(e,i.fin,((e,t)=>{this._deflating=!1,i.readOnly=!1,this.sendFrame(Sender.frame(t,i),r),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[1].length,Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[1].length,this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}return sender=Sender}function requireEventTarget(){if(hasRequiredEventTarget)return eventTarget;hasRequiredEventTarget=1;class Event{constructor(e,t){this.target=t,this.type=e}}class MessageEvent extends Event{constructor(e,t){super("message",t),this.data=e}}class CloseEvent extends Event{constructor(e,t,s){super("close",s),this.wasClean=s._closeFrameReceived&&s._closeFrameSent,this.reason=t,this.code=e}}class OpenEvent extends Event{constructor(e){super("open",e)}}class ErrorEvent extends Event{constructor(e,t){super("error",t),this.message=e.message,this.error=e}}return eventTarget={addEventListener(e,t){function s(e){t.call(this,new MessageEvent(e,this))}function i(e,s){t.call(this,new CloseEvent(e,s,this))}function r(e){t.call(this,new ErrorEvent(e,this))}function n(){t.call(this,new OpenEvent(this))}"function"==typeof t&&("message"===e?(s._listener=t,this.on(e,s)):"close"===e?(i._listener=t,this.on(e,i)):"error"===e?(r._listener=t,this.on(e,r)):"open"===e?(n._listener=t,this.on(e,n)):this.on(e,t))},removeEventListener(e,t){const s=this.listeners(e);for(let i=0;i<s.length;i++)s[i]!==t&&s[i]._listener!==t||this.removeListener(e,s[i])}}}function requireExtension(){if(hasRequiredExtension)return extension;hasRequiredExtension=1;const e=[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 t(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}return extension={format:function(e){return Object.keys(e).map((t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map((e=>[t].concat(Object.keys(e).map((t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map((e=>!0===e?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(s){const i=Object.create(null);if(void 0===s||""===s)return i;let r,n,a=Object.create(null),o=!1,c=!1,h=!1,u=-1,l=-1,p=0;for(;p<s.length;p++){const m=s.charCodeAt(p);if(void 0===r)if(-1===l&&1===e[m])-1===u&&(u=p);else if(32===m||9===m)-1===l&&-1!==u&&(l=p);else{if(59!==m&&44!==m)throw new SyntaxError(`Unexpected character at index ${p}`);{if(-1===u)throw new SyntaxError(`Unexpected character at index ${p}`);-1===l&&(l=p);const e=s.slice(u,l);44===m?(t(i,e,a),a=Object.create(null)):r=e,u=l=-1}}else if(void 0===n)if(-1===l&&1===e[m])-1===u&&(u=p);else if(32===m||9===m)-1===l&&-1!==u&&(l=p);else if(59===m||44===m){if(-1===u)throw new SyntaxError(`Unexpected character at index ${p}`);-1===l&&(l=p),t(a,s.slice(u,l),!0),44===m&&(t(i,r,a),a=Object.create(null),r=void 0),u=l=-1}else{if(61!==m||-1===u||-1!==l)throw new SyntaxError(`Unexpected character at index ${p}`);n=s.slice(u,p),u=l=-1}else if(c){if(1!==e[m])throw new SyntaxError(`Unexpected character at index ${p}`);-1===u?u=p:o||(o=!0),c=!1}else if(h)if(1===e[m])-1===u&&(u=p);else if(34===m&&-1!==u)h=!1,l=p;else{if(92!==m)throw new SyntaxError(`Unexpected character at index ${p}`);c=!0}else if(34===m&&61===s.charCodeAt(p-1))h=!0;else if(-1===l&&1===e[m])-1===u&&(u=p);else if(-1===u||32!==m&&9!==m){if(59!==m&&44!==m)throw new SyntaxError(`Unexpected character at index ${p}`);{if(-1===u)throw new SyntaxError(`Unexpected character at index ${p}`);-1===l&&(l=p);let e=s.slice(u,l);o&&(e=e.replace(/\\/g,""),o=!1),t(a,n,e),44===m&&(t(i,r,a),a=Object.create(null),r=void 0),n=void 0,u=l=-1}}else-1===l&&(l=p)}if(-1===u||h)throw new SyntaxError("Unexpected end of input");-1===l&&(l=p);const m=s.slice(u,l);return void 0===r?t(i,m,a):(void 0===n?t(a,m,!0):t(a,n,o?m.replace(/\\/g,""):m),t(i,r,a)),i}}}function requireWebsocket(){if(hasRequiredWebsocket)return websocket;hasRequiredWebsocket=1;const e=require$$0$2,t=require$$1,s=require$$2,i=require$$3,r=require$$4,{randomBytes:n,createHash:a}=require$$0$1,{URL:o}=require$$6,c=requirePermessageDeflate(),h=requireReceiver(),u=requireSender(),{BINARY_TYPES:l,EMPTY_BUFFER:p,GUID:m,kStatusCode:d,kWebSocket:f,NOOP:v}=requireConstants(),{addEventListener:g,removeEventListener:b}=requireEventTarget(),{format:k,parse:S}=requireExtension(),{toBuffer:C}=requireBufferUtil(),y=["CONNECTING","OPEN","CLOSING","CLOSED"],O=[8,13];class WebSocket extends e{constructor(e,t,s){super(),this.readyState=WebSocket.CONNECTING,this.protocol="",this._binaryType=l[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!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,Array.isArray(t)?t=t.join(", "):"object"==typeof t&&null!==t&&(s=t,t=void 0),I(this,e,t,s)):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(e){l.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?(this._socket.bufferSize||0)+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}setSocket(e,t,s){const i=new h(this._binaryType,this._extensions,s);this._sender=new u(e,this._extensions),this._receiver=i,this._socket=e,i[f]=this,e[f]=this,i.on("conclude",w),i.on("drain",j),i.on("error",N),i.on("message",A),i.on("ping",V),i.on("pong",B),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",L),e.on("data",R),e.on("end",T),e.on("error",M),this.readyState=WebSocket.OPEN,this.emit("open")}emitClose(){this.readyState=WebSocket.CLOSED,this._socket?(this._extensions[c.extensionName]&&this._extensions[c.extensionName].cleanup(),this._receiver.removeAllListeners(),this.emit("close",this._closeCode,this._closeMessage)):this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==WebSocket.CLOSED){if(this.readyState===WebSocket.CONNECTING){const e="WebSocket was closed before the connection was established";return x(this,this._req,e)}this.readyState!==WebSocket.CLOSING?(this.readyState=WebSocket.CLOSING,this._sender.close(e,t,!this._isServer,(e=>{e||(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(e,t,s){if(this.readyState===WebSocket.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===WebSocket.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||p,t,s)):q(this,e,s)}pong(e,t,s){if(this.readyState===WebSocket.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===WebSocket.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||p,t,s)):q(this,e,s)}send(e,t,s){if(this.readyState===WebSocket.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(s=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==WebSocket.OPEN)return void q(this,e,s);const i={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[c.extensionName]||(i.compress=!1),this._sender.send(e||p,i,s)}terminate(){if(this.readyState!==WebSocket.CLOSED){if(this.readyState===WebSocket.CONNECTING){const e="WebSocket was closed before the connection was established";return x(this,this._req,e)}this._socket&&(this.readyState=WebSocket.CLOSING,this._socket.destroy())}}}function I(e,i,r,h){const u={protocolVersion:O[1],maxPayload:104857600,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...h,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(!O.includes(u.protocolVersion))throw new RangeError(`Unsupported protocol version: ${u.protocolVersion} (supported versions: ${O.join(", ")})`);let l;i instanceof o?(l=i,e.url=i.href):(l=new o(i),e.url=i);const p="ws+unix:"===l.protocol;if(!(l.host||p&&l.pathname))throw new Error(`Invalid URL: ${e.url}`);const d="wss:"===l.protocol||"https:"===l.protocol,f=d?443:80,v=n(16).toString("base64"),g=d?t.get:s.get;let b;if(u.createConnection=d?_:P,u.defaultPort=u.defaultPort||f,u.port=l.port||f,u.host=l.hostname.startsWith("[")?l.hostname.slice(1,-1):l.hostname,u.headers={"Sec-WebSocket-Version":u.protocolVersion,"Sec-WebSocket-Key":v,Connection:"Upgrade",Upgrade:"websocket",...u.headers},u.path=l.pathname+l.search,u.timeout=u.handshakeTimeout,u.perMessageDeflate&&(b=new c(!0!==u.perMessageDeflate?u.perMessageDeflate:{},!1,u.maxPayload),u.headers["Sec-WebSocket-Extensions"]=k({[c.extensionName]:b.offer()})),r&&(u.headers["Sec-WebSocket-Protocol"]=r),u.origin&&(u.protocolVersion<13?u.headers["Sec-WebSocket-Origin"]=u.origin:u.headers.Origin=u.origin),(l.username||l.password)&&(u.auth=`${l.username}:${l.password}`),p){const e=u.path.split(":");u.socketPath=e[0],u.path=e[1]}let C=e._req=g(u);u.timeout&&C.on("timeout",(()=>{x(e,C,"Opening handshake has timed out")})),C.on("error",(t=>{e._req.aborted||(C=e._req=null,e.readyState=WebSocket.CLOSING,e.emit("error",t),e.emitClose())})),C.on("response",(t=>{const s=t.headers.location,n=t.statusCode;if(s&&u.followRedirects&&n>=300&&n<400){if(++e._redirects>u.maxRedirects)return void x(e,C,"Maximum redirects exceeded");C.abort();const t=new o(s,i);I(e,t,r,h)}else e.emit("unexpected-response",C,t)||x(e,C,`Unexpected server response: ${t.statusCode}`)})),C.on("upgrade",((t,s,i)=>{if(e.emit("upgrade",t),e.readyState!==WebSocket.CONNECTING)return;C=e._req=null;const n=a("sha1").update(v+m).digest("base64");if(t.headers["sec-websocket-accept"]!==n)return void x(e,s,"Invalid Sec-WebSocket-Accept header");const o=t.headers["sec-websocket-protocol"],h=(r||"").split(/, */);let l;if(!r&&o?l="Server sent a subprotocol but none was requested":r&&!o?l="Server sent no subprotocol":o&&!h.includes(o)&&(l="Server sent an invalid subprotocol"),l)x(e,s,l);else{if(o&&(e.protocol=o),b)try{const s=S(t.headers["sec-websocket-extensions"]);s[c.extensionName]&&(b.accept(s[c.extensionName]),e._extensions[c.extensionName]=b)}catch(t){return void x(e,s,"Invalid Sec-WebSocket-Extensions header")}e.setSocket(s,i,u.maxPayload)}}))}function P(e){return e.path=e.socketPath,i.connect(e)}function _(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=e.host),r.connect(e)}function x(e,t,s){e.readyState=WebSocket.CLOSING;const i=new Error(s);Error.captureStackTrace(i,x),t.setHeader?(t.abort(),t.once("abort",e.emitClose.bind(e)),e.emit("error",i)):(t.destroy(i),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function q(e,t,s){if(t){const s=C(t).length;e._socket?e._sender._bufferedBytes+=s:e._bufferedAmount+=s}if(s){s(new Error(`WebSocket is not open: readyState ${e.readyState} (${y[e.readyState]})`))}}function w(e,t){const s=this[f];s._socket.removeListener("data",R),s._socket.resume(),s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,1005===e?s.close():s.close(e,t)}function j(){this[f]._socket.resume()}function N(e){const t=this[f];t._socket.removeListener("data",R),t.readyState=WebSocket.CLOSING,t._closeCode=e[d],t.emit("error",e),t._socket.destroy()}function F(){this[f].emitClose()}function A(e){this[f].emit("message",e)}function V(e){const t=this[f];t.pong(e,!t._isServer,v),t.emit("ping",e)}function B(e){this[f].emit("pong",e)}function L(){const e=this[f];this.removeListener("close",L),this.removeListener("end",T),e.readyState=WebSocket.CLOSING,e._socket.read(),e._receiver.end(),this.removeListener("data",R),this[f]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",F),e._receiver.on("finish",F))}function R(e){this[f]._receiver.write(e)||this.pause()}function T(){const e=this[f];e.readyState=WebSocket.CLOSING,e._receiver.end(),this.end()}function M(){const e=this[f];this.removeListener("error",M),this.on("error",v),e&&(e.readyState=WebSocket.CLOSING,this.destroy())}return y.forEach(((e,t)=>{WebSocket[e]=t})),["open","error","close","message"].forEach((e=>{Object.defineProperty(WebSocket.prototype,`on${e}`,{get(){const t=this.listeners(e);for(let e=0;e<t.length;e++)if(t[e]._listener)return t[e]._listener},set(t){const s=this.listeners(e);for(let t=0;t<s.length;t++)s[t]._listener&&this.removeListener(e,s[t]);this.addEventListener(e,t)}})})),WebSocket.prototype.addEventListener=g,WebSocket.prototype.removeEventListener=b,websocket=WebSocket}function requireWebSocket(){if(hasRequiredWebSocket)return WebSocket_1;hasRequiredWebSocket=1;var e=requireWebsocket();return WebSocket_1=class SafeWebSocketClient extends e{constructor(e,t){super(e,t,{perMessageDeflate:!1})}}}var sha1={exports:{}},hasRequiredSha1;
/*
* [js-sha1]{@link https://github.com/emn178/js-sha1}
*
* @version 0.6.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @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(e){return function(t){return new Sha1(!0).update(t)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.create=function(){return new Sha1},e.update=function(t){return e.create().update(t)};for(var t=0;t<OUTPUT_TYPES.length;++t){var s=OUTPUT_TYPES[t];e[s]=createOutputMethod(s)}return e},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(e){if("string"==typeof e)return crypto.createHash("sha1").update(e,"utf8").digest("hex");if(e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(void 0===e.length)return method(e);return crypto.createHash("sha1").update(new Buffer(e)).digest("hex")};return nodeMethod};function Sha1(e){e?(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(e){if(!this.finalized){var t="string"!=typeof e;t&&e.constructor===root.ArrayBuffer&&(e=new Uint8Array(e));for(var s,i,r=0,n=e.length||0,a=this.blocks;r<n;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)for(i=this.start;r<n&&i<64;++r)a[i>>2]|=e[r]<<SHIFT[3&i++];else for(i=this.start;r<n&&i<64;++r)(s=e.charCodeAt(r))<128?a[i>>2]|=s<<SHIFT[3&i++]:s<2048?(a[i>>2]|=(192|s>>6)<<SHIFT[3&i++],a[i>>2]|=(128|63&s)<<SHIFT[3&i++]):s<55296||s>=57344?(a[i>>2]|=(224|s>>12)<<SHIFT[3&i++],a[i>>2]|=(128|s>>6&63)<<SHIFT[3&i++],a[i>>2]|=(128|63&s)<<SHIFT[3&i++]):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++r)),a[i>>2]|=(240|s>>18)<<SHIFT[3&i++],a[i>>2]|=(128|s>>12&63)<<SHIFT[3&i++],a[i>>2]|=(128|s>>6&63)<<SHIFT[3&i++],a[i>>2]|=(128|63&s)<<SHIFT[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=a[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 e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=EXTRA[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},Sha1.prototype.hash=function(){var e,t,s=this.h0,i=this.h1,r=this.h2,n=this.h3,a=this.h4,o=this.blocks;for(e=16;e<80;++e)t=o[e-3]^o[e-8]^o[e-14]^o[e-16],o[e]=t<<1|t>>>31;for(e=0;e<20;e+=5)s=(t=(i=(t=(r=(t=(n=(t=(a=(t=s<<5|s>>>27)+(i&r|~i&n)+a+1518500249+o[e]<<0)<<5|a>>>27)+(s&(i=i<<30|i>>>2)|~s&r)+n+1518500249+o[e+1]<<0)<<5|n>>>27)+(a&(s=s<<30|s>>>2)|~a&i)+r+1518500249+o[e+2]<<0)<<5|r>>>27)+(n&(a=a<<30|a>>>2)|~n&s)+i+1518500249+o[e+3]<<0)<<5|i>>>27)+(r&(n=n<<30|n>>>2)|~r&a)+s+1518500249+o[e+4]<<0,r=r<<30|r>>>2;for(;e<40;e+=5)s=(t=(i=(t=(r=(t=(n=(t=(a=(t=s<<5|s>>>27)+(i^r^n)+a+1859775393+o[e]<<0)<<5|a>>>27)+(s^(i=i<<30|i>>>2)^r)+n+1859775393+o[e+1]<<0)<<5|n>>>27)+(a^(s=s<<30|s>>>2)^i)+r+1859775393+o[e+2]<<0)<<5|r>>>27)+(n^(a=a<<30|a>>>2)^s)+i+1859775393+o[e+3]<<0)<<5|i>>>27)+(r^(n=n<<30|n>>>2)^a)+s+1859775393+o[e+4]<<0,r=r<<30|r>>>2;for(;e<60;e+=5)s=(t=(i=(t=(r=(t=(n=(t=(a=(t=s<<5|s>>>27)+(i&r|i&n|r&n)+a-1894007588+o[e]<<0)<<5|a>>>27)+(s&(i=i<<30|i>>>2)|s&r|i&r)+n-1894007588+o[e+1]<<0)<<5|n>>>27)+(a&(s=s<<30|s>>>2)|a&i|s&i)+r-1894007588+o[e+2]<<0)<<5|r>>>27)+(n&(a=a<<30|a>>>2)|n&s|a&s)+i-1894007588+o[e+3]<<0)<<5|i>>>27)+(r&(n=n<<30|n>>>2)|r&a|n&a)+s-1894007588+o[e+4]<<0,r=r<<30|r>>>2;for(;e<80;e+=5)s=(t=(i=(t=(r=(t=(n=(t=(a=(t=s<<5|s>>>27)+(i^r^n)+a-899497514+o[e]<<0)<<5|a>>>27)+(s^(i=i<<30|i>>>2)^r)+n-899497514+o[e+1]<<0)<<5|n>>>27)+(a^(s=s<<30|s>>>2)^i)+r-899497514+o[e+2]<<0)<<5|r>>>27)+(n^(a=a<<30|a>>>2)^s)+i-899497514+o[e+3]<<0)<<5|i>>>27)+(r^(n=n<<30|n>>>2)^a)+s-899497514+o[e+4]<<0,r=r<<30|r>>>2;this.h0=this.h0+s<<0,this.h1=this.h1+i<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+a<<0},Sha1.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,s=this.h2,i=this.h3,r=this.h4;return HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]},Sha1.prototype.toString=Sha1.prototype.hex,Sha1.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,s=this.h2,i=this.h3,r=this.h4;return[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,s>>24&255,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,r>>24&255,r>>16&255,r>>8&255,255&r]},Sha1.prototype.array=Sha1.prototype.digest,Sha1.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(20),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),e};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 e;try{if((e=self.localStorage)["squeak-foo:"]="bar","bar"!==e["squeak-foo:"])throw Error();delete e["squeak-foo:"]}catch(t){e={}}Squeak.Settings=e}return Object.extend||(Object.extend=function(e){for(var t=1;t<arguments.length;t++)if("object"==typeof arguments[t])for(var s in arguments[t])e[s]=arguments[t][s]}),Function.prototype.subclass||(Function.prototype.subclass=function(e){var t=function(){if(this.initialize){var e=this.initialize.apply(this,arguments);if(void 0!==e)return e}return this},s=function(){};s.prototype=this.prototype,t.prototype=new s;for(var i=1;i<arguments.length;i++)Object.extend(t.prototype,arguments[i]);var r=e.split("."),n=r.pop();return r.reduce((function(e,t){return e[t]||(e[t]={}),e[t]}),self)[n]=t,t}),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-202411-21",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,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(e,t){this.externalModules[e]=t}},"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(e){for(var t=[],s=0;s<e.length;)t.push(String.fromCharCode.apply(null,e.subarray(s,s+=16348)));return t.join("")},word64FromUint32:function(e,t){return e<2097152?4294967296*e+t:e>4292870144?4294967296*(e>>0)+t:[e,t]}})),vm}var vm_object={},hasRequiredVm_object;function requireVm_object(){return hasRequiredVm_object||(hasRequiredVm_object=1,Object.subclass("Squeak.Object","initialization",{initInstanceOf:function(e,t,s,i){this.sqClass=e,this.hash=s;var r=e.pointers[Squeak.Class_format],n=(r>>1&63)+(r>>10&192)-1;this._format=r>>7&15,this._format<8?6!=this._format?n+t>0&&(this.pointers=this.fillArray(n+t,i)):t>0&&(e.isFloatClass?(this.isFloat=!0,this.float=0):this.words=new Uint32Array(t)):t>0&&(this.bytes=new Uint8Array(t))},initAsClone:function(e,t){this.sqClass=e.sqClass,this.hash=t,this._format=e._format,e.isFloat?(this.isFloat=e.isFloat,this.float=e.float):(e.pointers&&(this.pointers=e.pointers.slice(0)),e.words&&(this.words=new Uint32Array(e.words)),e.bytes&&(this.bytes=new Uint8Array(e.bytes)))},initFromImage:function(e,t,s,i){this.oop=e,this.sqClass=t,this._format=s,this.hash=i},classNameFromImage:function(e,t){var s=e[t[this.oop][Squeak.Class_name]];if(s&&s._format>=8&&s._format<12){var i=t[s.oop],r=s.decodeBytes(i.length,i,0,3&s._format);return Squeak.bytesAsString(r)}return"Class"},renameFromImage:function(e,t,s){var i=this.sqClass<32?e[s[this.sqClass-1]]:e[this.sqClass];if(!i)return this;var r=i.instProto||i.classInstProto(i.classNameFromImage(e,t));if(!r)return this;var n=new r;return n.oop=this.oop,n.sqClass=this.sqClass,n._format=this._format,n.hash=this.hash,n},installFromImage:function(e,t,s,i,r,n){var a=this.sqClass;this.sqClass=a>0&&a<32?e[s[a-1]]:e[a];var o=t[this.oop],c=o.length;if(this._format<5){if(c>0){var h=o;this.pointers=this.decodePointers(c,h,e)}}else if(this._format>=12){var u=this.decodeWords(1,o,r)[0]>>10&255;h=this.decodeWords(u+1,o,r);this.pointers=this.decodePointers(u+1,h,e),this.bytes=this.decodeBytes(c-(u+1),o,u+1,3&this._format)}else this._format>=8?c>0&&(this.bytes=this.decodeBytes(c,o,0,3&this._format)):this.sqClass==i?(this.isFloat=!0,this.float=this.decodeFloat(o,r,n)):c>0&&(this.words=this.decodeWords(c,o,r));this.mark=!1},decodePointers:function(e,t,s){for(var i=new Array(e),r=0;r<e;r++){var n=t[r];i[r]=1==(1&n)?n>>1:s[n]||42424242}return i},decodeWords:function(e,t,s){for(var i=new DataView(t.buffer,t.byteOffset),r=new Uint32Array(e),n=0;n<e;n++)r[n]=i.getUint32(4*n,s);return r},decodeBytes:function(e,t,s,i){var r=4*e-i,n=new Uint8Array(t.buffer,t.byteOffset+4*s,r),a=new Uint8Array(r);return a.set(n),a},decodeFloat:function(e,t,s){var i=new DataView(e.buffer,e.byteOffset);if(!t)return i.getFloat64(0,!1);if(s)return i.getFloat64(0,!0);var r=new ArrayBuffer(8),n=new DataView(r);return n.setUint32(0,i.getUint32(4)),n.setUint32(4,i.getUint32(0)),n.getFloat64(0,!0)},fillArray:function(e,t){var s=new Array(e);return s.fill(t),s}},"testing",{isWords:function(){return 6===this._format},isBytes:function(){var e=this._format;return e>=8&&e<=11},isWordsOrBytes:function(){var e=this._format;return 6==e||e>=8&&e<=11},isPointers:function(){return this._format<=4},isWeak:function(){return 4===this._format},isMethod:function(){return this._format>=12},sameFormats:function(e,t){return e<8?e===t:(12&e)==(12&t)},sameFormatAs:function(e){return this.sameFormats(this._format,e._format)}},"printing",{toString:function(){return this.sqInstName()},bytesAsString:function(){return this.bytes?Squeak.bytesAsString(this.bytes):""},bytesAsNumberString:function(e){if(!this.bytes)return"";for(var t="0123456789ABCDEF",s=[],i=0,r=this.bytes.length-1;r>=0;r--)s.push(t[this.bytes[r]>>4]),s.push(t[15&this.bytes[r]]),i=256*i+this.bytes[r];var n=e?"-":"",a=i>9007199254740991?"≈":"";return n+"16r"+s.join("")+" ("+a+n+i+"L)"},assnKeyAsString:function(){return this.pointers[Squeak.Assn_key].bytesAsString()},slotNameAt:function(e){var t=this.instSize();return e<=t?this.sqClass.allInstVarNames()[e-1]||"ivar"+(e-1):(e-t).toString()},sqInstName:function(){if(this.isNil)return"nil";if(this.isTrue)return"true";if(this.isFalse)return"false";if(this.isFloat){var e=this.float.toString();return/\./.test(e)||(e+=".0"),e}var t=this.sqClass.className();if(/ /.test(t))return"the "+t;switch(t){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 s=this.pointers?this.pointers[0]:this.hash;return"$"+String.fromCharCode(s)+" ("+s.toString()+")";case"CompiledMethod":return this.methodAsString();case"CompiledBlock":return"[] in "+this.blockOuterCode().sqInstName()}return/^[aeiou]/i.test(t)?"an"+t:"a"+t}},"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 e=this._format;return e>4||2===e?0:e<2?this.pointersSize():this.sqClass.classInstSize()},indexableSize:function(e){var t=this._format;return t<2?-1:3===t&&e.vm.isContext(this)&&!e.allowAccessBeyondSP?this.pointers[Squeak.Context_stackPointer]:t<6?this.pointersSize()-this.instSize():t<8?this.wordsSize():t<12?this.bytesSize():this.bytesSize()+4*this.pointersSize()},floatData:function(){var e=new ArrayBuffer(8),t=new DataView(e);return t.setFloat64(0,this.float,!1),t},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(e){var t=this.snapshotSize();return this.oop=e+4*t.header,e+4*(t.header+t.body)},snapshotSize:function(){var e=this.isFloat?2:this.words?this.words.length:this.pointers?this.pointers.length:0;return this.bytes&&(e+=this.bytes.length+3>>>2),{header:++e>63?2:this.sqClass.isCompact?0:1,body:e}},addr:function(){return this.oop-4*this.snapshotSize().header},totalBytes:function(){var e=this.snapshotSize();return 4*(e.header+e.body)},writeTo:function(e,t,s){this.bytes&&(this._format|=3&-this.bytes.length);var i=t,r=this.snapshotSize(),n=(15&this._format)<<8|(4095&this.hash)<<17;switch(r.header){case 2:e.setUint32(t,r.body<<2|Squeak.HeaderTypeSizeAndClass),t+=4,e.setUint32(t,this.sqClass.oop|Squeak.HeaderTypeSizeAndClass),t+=4,e.setUint32(t,n|Squeak.HeaderTypeSizeAndClass),t+=4;break;case 1:e.setUint32(t,this.sqClass.oop|Squeak.HeaderTypeClass),t+=4,e.setUint32(t,n|r.body<<2|Squeak.HeaderTypeClass),t+=4;break;case 0:var a=s.compactClasses.indexOf(this.sqClass)+1;e.setUint32(t,n|a<<12|r.body<<2|Squeak.HeaderTypeShort),t+=4}if(this.isFloat)e.setFloat64(t,this.float),t+=8;else if(this.words)for(var o=0;o<this.words.length;o++)e.setUint32(t,this.words[o]),t+=4;else if(this.pointers)for(o=0;o<this.pointers.length;o++)e.setUint32(t,s.objectToOop(this.pointers[o])),t+=4;if(this.bytes){for(o=0;o<this.bytes.length;o++)e.setUint8(t++,this.bytes[o]);t+=3&-this.bytes.length}if(t!==i+this.totalBytes())throw Error("written size does not match");return t}},"as class",{classInstFormat:function(){return this.pointers[Squeak.Class_format]>>7&15},classInstSize:function(){var e=this.pointers[Squeak.Class_format];return(e>>10&192)+(e>>1&63)-1},classInstIsBytes:function(){var e=this.classInstFormat();return e>=8&&e<=11},classInstIsPointers:function(){return this.classInstFormat()<=4},instVarNames:function(){for(var e=3;e<=4;e++){var t=this.pointers[e].pointers;if(t&&t.length&&t[0].bytes)return t.map((function(e){return e.bytesAsString()}))}return[]},allInstVarNames:function(){var e=this.superclass();return e.isNil?this.instVarNames():e.allInstVarNames().concat(this.instVarNames())},superclass:function(){return this.pointers[0]},className:function(){if(!this.pointers)return"_NOTACLASS_";for(var e=6;e<=7;e++){if((i=this.pointers[e])&&i.bytes)return i.bytesAsString()}for(var t=3;t<=6;t++){var s=this.pointers[t];if(s&&s.pointers)for(e=6;e<=7;e++){var i;if((i=s.pointers[e])&&i.bytes)return i.bytesAsString()+" class"}}return"_SOMECLASS_"},defaultInst:function(){return Squeak.Object},classInstProto:function(e){if(this.instProto)return this.instProto;var t=this.defaultInst();try{e||(e=this.className());var s=e.replace(/[^A-Za-z0-9]/g,"_");s="UndefinedObject"===s?"nil":"True"===s?"true_":"False"===s?"false_":(/^[AEIOU]/.test(s)?"an":"a")+s,(t=new Function("return function "+s+"() {};")()).prototype=this.defaultInst().prototype}catch(e){}return Object.defineProperty(this,"instProto",{value:t}),t}},"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 e=805306879&this.pointers[0];return e>511?(511&e)+(e>>19):e},methodClassForSuper:function(){return this.pointers[this.methodNumLits()].pointers[Squeak.Assn_value]},methodNeedsLargeFrame:function(){return(131072&this.pointers[0])>0},methodAddPointers:function(e){this.pointers=e},methodTempCount:function(){return this.pointers[0]>>18&63},methodGetLiteral:function(e){return this.pointers[1+e]},methodGetSelector:function(e){return this.pointers[1+e]},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(e){if(e&&e.activeContext===this)return e.sp+1;var t=this.pointers[Squeak.Context_stackPointer];return Squeak.Context_tempFrameStart+("number"==typeof t?t: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(e,t,s,i){this.sqClass=e,this.hash=s;var r=e.pointers[Squeak.Class_format],n=65535&r,a=r>>16&31;this._format=a,a<12?a<10?n+t>0&&(this.pointers=this.fillArray(n+t,i)):t>0&&(e.isFloatClass?(this.isFloat=!0,this.float=0):this.words=new Uint32Array(t)):t>0&&(this.bytes=new Uint8Array(t))},installFromImage:function(e,t,s,i,r,n,a){var o=this.sqClass;if(o<32)throw Error("Invalid class ID: "+o);if(this.sqClass=s[o],!this.sqClass)throw Error("Class ID not in class table: "+o);var c=t[this.oop],h=c.length;switch(this._format){case 0:case 1:case 2:case 3:case 4:case 5:if(h>0){var u=c;this.pointers=this.decodePointers(h,u,e,n,a)}break;case 11:h--,this._format=10;case 10:this.sqClass===i?(this.isFloat=!0,this.float=this.decodeFloat(c,r,!0)):h>0&&(this.words=this.decodeWords(h,c,r));break;case 12:case 13:throw Error("16 bit arrays not supported yet");case 20:case 21:case 22:case 23:h--,this._format-=4;case 16:case 17:case 18:case 19:h>0&&(this.bytes=this.decodeBytes(h,c,0,3&this._format));break;case 28:case 29:case 30:case 31:h--,this._format-=4;case 24:case 25:case 26:case 27:var l=this.decodeWords(1,c,r)[0]>>(a?3:1),p=32767&l,m=(u=a?this.decodeWords64(p+1,c,r):this.decodeWords(p+1,c,r),a?2*(p+1):p+1);this.pointers=this.decodePointers(p+1,u,e,n,a),this.bytes=this.decodeBytes(h-m,c,m,3&this._format),a&&(this.pointers[0]=2147483648&c[1]|l);break;default:throw Error("Unknown object format: "+this._format)}this.mark=!1},decodeWords64:function(e,t,s){for(var i=new Array(e),r=0;r<e;r++){var n=t[2*r],a=t[2*r+1];i[r]=Squeak.word64FromUint32(a,n)}return i},decodePointers:function(e,t,s,i,r){for(var n=new Array(e),a=0;a<e;a++){var o=t[a];if("number"!=typeof o)if(4==(7&o[1]))n[a]=this.decodeSmallFloat(o[0],o[1],r);else{if(1!=(7&o[1]))throw 2==(7&o[1])?Error("Large Immediate Characters not implemented yet"):Error("Large OOPs not implemented yet");n[a]=r.makeLargeFromSmall(o[0],o[1])}else if(1==(1&o))n[a]=r?(o>=0?o<=8589934591:o>=-8589934592)?o/4>>1:r.makeLargeFromSmall((o-(o>>>0))/4294967296>>>0,o>>>0):o>>1;else if(2==(3&o)){if(o<0||o>8589934591)throw Error("Large Immediate Characters not implemented yet");n[a]=i(o>>>(r?3:2))}else if(r&&4==(7&o))n[a]=this.decodeSmallFloat((o-(o>>>0))/4294967296>>>0,o>>>0,r);else if(n[a]=s[o]||42424242,42424242===n[a])debugger}return n},decodeSmallFloat:function(e,t,s){var i=0,r=0,n=(8&t)<<28;return 0==(e|4294967280&t)?i=n:(i=939524096+(e>>>4)|n,r=t>>>4|(15&e)<<28),s.makeFloat(new Uint32Array([r,i]))},overhead64:function(e){var t=0,s=0,i=0;if(this._format<=5)t=-2&e.length;else if(this._format>=24){var r=1==(1&(t=(e[0]>>3&32767)+1)),n=this._format>=28;r&&(t+=n?1:-1),i=e.length/2,s=e.length-t}else i=(s=e.length)/2;return{bytes:4*t,sizeHeader:s>=255&&i<255}},initInstanceOfChar:function(e,t){this.oop=t<<2|2,this.sqClass=e,this.hash=t,this._format=7,this.mark=!0},initInstanceOfFloat:function(e,t){this.sqClass=e,this.hash=0,this._format=10,this.isFloat=!0,this.float=this.decodeFloat(t,!0,!0)},initInstanceOfLargeInt:function(e,t){this.sqClass=e,this.hash=0,this._format=16,this.bytes=new Uint8Array(t)},classNameFromImage:function(e,t){var s=e[t[this.oop][Squeak.Class_name]];if(s&&s._format>=16&&s._format<24){var i=t[s.oop],r=s.decodeBytes(i.length,i,0,7&s._format);return Squeak.bytesAsString(r)}return"Class"},renameFromImage:function(e,t,s){var i=s[this.sqClass];if(!i)return this;var r=i.instProto||i.classInstProto(i.classNameFromImage(e,t));if(!r)return this;var n=new r;return n.oop=this.oop,n.sqClass=this.sqClass,n._format=this._format,n.hash=this.hash,n}},"accessing",{instSize:function(){return this._format<2?this.pointersSize():this.sqClass.classInstSize()},indexableSize:function(e){var t=this._format;return t<2?-1:3===t&&e.vm.isContext(this)?this.pointers[Squeak.Context_stackPointer]:t<6?this.pointersSize()-this.instSize():t<12?this.wordsSize():t<16?this.shortsSize():t<24?this.bytesSize():4*this.pointersSize()+this.bytesSize()},snapshotSize:function(){var e=this.isFloat?2:this.words?this.words.length:this.pointers?this.pointers.length:0;this.bytes&&(e+=this.bytes.length+3>>>2);var t=e>=255?2:0;return e+=1&e,(e+=2)<4&&(e=4),{header:t,body:e}},writeTo:function(e,t,s,i){var r=this.isFloat?2:this.words?this.words.length:this.pointers?this.pointers.length:0;this.bytes&&(r+=this.bytes.length+3>>>2,this._format|=3&-this.bytes.length);var n=t,a=this._format<<24|4194303&this.sqClass.hash,o=r<<24|4194303&this.hash;if(r>=255&&(e.setUint32(t,r,s),t+=4,o=255<<24|4194303&this.hash,e.setUint32(t,o,s),t+=4),e.setUint32(t,a,s),t+=4,e.setUint32(t,o,s),t+=4,this.isFloat)e.setFloat64(t,this.float,s),t+=8;else if(this.words)for(var c=0;c<this.words.length;c++)e.setUint32(t,this.words[c],s),t+=4;else if(this.pointers){var h=0;if(this._format>=24){var u=this.methodSignFlag()?2147483648:0,l=this.pointers[0]<<1|1|u;e.setUint32(t,l,s),t+=4,h=1}for(c=h;c<this.pointers.length;c++)e.setUint32(t,i(this.pointers[c]),s),t+=4}if(this.bytes){for(c=0;c<this.bytes.length;c++)e.setUint8(t++,this.bytes[c]);t+=3&-this.bytes.length}if((t+=0===r?8:4*(1&r))!==n+this.totalBytes())throw Error("written size does not match");return t}},"testing",{isBytes:function(){var e=this._format;return e>=16&&e<=23},isPointers:function(){return this._format<=6},isWords:function(){return 10===this._format},isWordsOrBytes:function(){var e=this._format;return 10===e||e>=16&&e<=23},isWeak:function(){return 4===this._format},isMethod:function(){return this._format>=24},sameFormats:function(e,t){return e<16?e===t:(248&e)==(248&t)}},"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 e=this.classInstFormat();return e>=16&&e<=23},classInstIsPointers:function(){return this.classInstFormat()<=6},classByteSizeOfInstance:function(e){var t=this.classInstFormat(),s=this.classInstSize();return s+=t<9?e:t>=16?(e+3)/4|0:t>=12?(e+1)/2|0:t>=10?e:2*e,s+=1&s,(s+=s>=255?4:2)<4&&(s=4),4*s}},"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 e=this.pointers[this.pointers.length-1].pointers[Squeak.ClassBinding_value],t=this.pointers[this.pointers.length-2];return t.pointers&&(t=t.pointers[Squeak.AdditionalMethodState_selector]),e.className()+">>"+t.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(e){this.headRoom=1e8,this.totalMemory=0,this.headerFlags=0,this.name=e,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(e,t,s){console.log("squeak: reading "+this.name+" ("+e.byteLength+" bytes)"),this.startupTime=Date.now();for(var i=new DataView(e),r=!1,n=0,a=function(){var e=i.getUint32(n,r);return n+=4,e},o=a,c=4,h=function(t,s){if(s){for(var i=[];i.length<t;)i.push(o());return i}var r=new Uint32Array(e,n,t*c/4);return n+=t*c,r},u=[6501,6502,6504,68e3,68002,68004],l=0,p=0;r=!r,n=p,l=o(),!(u.indexOf(72174&l)>=0);)if(r||(p+=512),p>512)throw Error("bad image version");this.version=l;var m=0!=(1&l);this.hasClosures=!([6501,6502,68e3].indexOf(l)>=0),this.isSpur=0!=(16&l);var d=l>=68e3;if(d&&!this.isSpur)throw Error("64 bit non-spur images not supported yet");d&&(o=function(){var e=i.getUint32(n,!0),t=i.getUint32(n+4,!0);return n+=8,Squeak.word64FromUint32(t,e)},c=8),this.is64Bit=d,console.log(`squeak: Image Spur: ${this.isSpur} is64Bit: ${d} hasClosures: ${this.hasClosures} version: ${l}`);var f=a(),v=o(),g=o(),b=o(),k=a();d&&a();var S=o();this.headerFlags=o(),this.savedHeaderWords=[k,S,this.headerFlags];for(var C=0;C<4;C++)this.savedHeaderWords.push(a());var y,O=o(),I={},P={},_=p+f;if(n=_,this.isSpur){this.oldSpaceBytes=O-16;for(var x=n+O,q=0,w=null,j=0,N={};n<x;){for(;n<x-16;){var F=n,A=a(),V=a(),B=V>>>24;255===B&&(B=A,A=a(),V=a());G=q+n-8-_;var L=4194303&A;$=4194303&V,J=h(B,(H=A>>>24&31)<10&&L>0);if(n+=d?8*(B<1?1-B:0):4*(B<2?2-B:1&B),L>=32){if((U=new Squeak.ObjectSpur).initFromImage(G,L,H,$),y&&(y.nextObject=U),this.oldSpaceCount++,y=U,I[g+G]=U,P[G]=J,N[G]=j,d){var R=U.overhead64(J);j+=R.bytes,R.sizeHeader&&(N[G]-=8,j-=8)}}else j+=n-F,16!==L||w||(w=J),L&&(I[g+G]=J)}if(n!==x-16)throw Error("invalid segment");var T=a(),M=a(),E=a();if(a(),0!==E){var D=4278190080&M?4*(16777215&T):0;x+=E,q+=D,j+=16+D,this.oldSpaceBytes+=D+E}}this.oldSpaceBytes-=j,this.firstOldObject=I[g],this.lastOldObject=U,this.lastOldObject.nextObject=null}else{for(;n<_+v;){var W=0,z=0,K=o();switch(K&Squeak.HeaderTypeMask){case Squeak.HeaderTypeSizeAndClass:W=K>>>2,z=o(),K=o();break;case Squeak.HeaderTypeClass:z=K-Squeak.HeaderTypeClass,W=(K=o())>>>2&63;break;case Squeak.HeaderTypeShort:W=K>>>2&63,z=K>>>12&31;break;case Squeak.HeaderTypeFree:throw Error("Unexpected free block")}W--;var H,U,G=n-4-_,$=K>>>17&4095,J=h(W,(H=K>>>8&15)<5);(U=new Squeak.Object).initFromImage(G,z,H,$),z<32&&(U.hash|=268435456),y&&(y.nextObject=U),this.oldSpaceCount++,y=U,I[g+G]=U,P[G]=J}this.firstOldObject=I[g+4],this.lastOldObject=U,this.lastOldObject.nextObject=null,this.oldSpaceBytes=v}this.totalMemory=this.oldSpaceBytes+this.headRoom,this.totalMemory=1e6*Math.ceil(this.totalMemory/1e6);var X=I[b],Y=this.isSpur?this.spurClassTable(I,P,w,X):P[I[P[X.oop][Squeak.splOb_CompactClasses]].oop],Q=null;for(U=this.firstOldObject,y=null;U;)y=Q,Q=U.renameFromImage(I,P,Y),y?y.nextObject=Q:this.firstOldObject=Q,I[g+U.oop]=Q,U=U.nextObject;this.lastOldObject=Q,this.lastOldObject.nextObject=null;var Z=I[b],ee=P[I[P[Z.oop][Squeak.splOb_CompactClasses]].oop],te=I[P[Z.oop][Squeak.splOb_ClassFloat]];this.isSpur&&(this.initImmediateClasses(I,P,Z),ee=this.spurClassTable(I,P,w,Z),m=this.getCharacter.bind(this),this.initSpurOverrides());var se=this.firstOldObject,ie=0;te.hash=34;var re=function(){if(se){for(var e=ie+(this.oldSpaceCount/20|0);se&&ie<e;)se.installFromImage(I,P,ee,te,r,m,d&&{makeFloat:function(e){return this.instantiateFloat(e)}.bind(this),makeLargeFromSmall:function(e,t){return this.instantiateLargeFromSmall(e,t)}.bind(this)}),se=se.nextObject,ie++;return s&&s(ie/this.oldSpaceCount),!0}return this.specialObjectsArray=Z,this.decorateKnownObjects(),this.isSpur?(this.fixSkippedOops(N),d&&this.fixPCs(),this.ensureFullBlockClosureClass(this.specialObjectsArray,ee)):(this.fixCompiledMethods(),this.fixCompactOops()),!1}.bind(this);if(s)self.setTimeout((function e(){re()?self.setTimeout(e,0):t&&t()}),0);else{for(;re(););t&&t()}},decorateKnownObjects:function(){var e=this.specialObjectsArray.pointers;if(e[Squeak.splOb_NilObject].isNil=!0,e[Squeak.splOb_TrueObject].isTrue=!0,e[Squeak.splOb_FalseObject].isFalse=!0,e[Squeak.splOb_ClassFloat].isFloatClass=!0,!this.isSpur){this.compactClasses=this.specialObjectsArray.pointers[Squeak.splOb_CompactClasses].pointers;for(var t=0;t<this.compactClasses.length;t++)this.compactClasses[t].isNil||(this.compactClasses[t].isCompact=!0)}Number.prototype.sqInstName||Object.defineProperty(Number.prototype,"sqInstName",{enumerable:!1,value:function(){return this.toString()}})},fixCompactOops:function(){if(!this.isSpur){for(var e=this.firstOldObject,t=0;e;){var s=e.hash>268435455;if(s!==!!e.sqClass.isCompact){var i=0===e.snapshotSize().header;s!==i&&(t+=i?-4:4)}e.hash&=268435455,e.oop+=t,e=e.nextObject}this.oldSpaceBytes+=t}},fixCompiledMethods:function(){if(!(this.version>=6502))for(var e=this.firstOldObject,t=this.specialObjectsArray.pointers[Squeak.splOb_ClassCompiledMethod];e;)e.isMethod()&&(e.sqClass=t),e=e.nextObject},fixSkippedOops:function(e){for(var t=this.firstOldObject;t;)t.oop-=e[t.oop],t=t.nextObject;if((t=this.lastOldObject).addr()+t.totalBytes()!==this.oldSpaceBytes)throw Error("image size doesn't match object sizes")},fixPCs:function(){for(var e=this.specialObjectsArray.pointers[Squeak.splOb_ClassMethodContext],t=Squeak.Context_instructionPointer,s=Squeak.Context_method,i=this.specialObjectsArray.pointers[Squeak.splOb_ClassBlockClosure],r=Squeak.Closure_startpc,n=Squeak.Closure_outerContext,a=this.firstOldObject;a;)a.sqClass===e?a.pointers[t]-=4*a.pointers[s].pointers.length:a.sqClass===i&&(a.pointers[r]-=4*a.pointers[n].pointers[s].pointers.length),a=a.nextObject},ensureFullBlockClosureClass:function(e,t){e.pointers[Squeak.splOb_ClassFullBlockClosure].isNil&&t[38]&&(e.pointers[Squeak.splOb_ClassFullBlockClosure]=t[38])}},"garbage collection - full",{fullGC:function(e){this.vm.addMessage("fullGC: "+e);var t=Date.now(),s=this.newSpaceCount,i=this.oldSpaceCount,r=this.markReachableObjects();this.removeUnmarkedOldObjects(),this.appendToOldObjects(r),this.finalizeWeakReferences(),this.allocationCount+=this.newSpaceCount,this.newSpaceCount=0,this.youngSpaceCount=0,this.hasNewInstances={},this.gcCount++,this.gcMilliseconds+=Date.now()-t;var n=i-this.oldSpaceCount,a=r.length,o=this.oldSpaceCount-a,c=s-a,h=i-o;return console.log("Full GC ("+e+"): "+(Date.now()-t)+" ms; before: "+i.toLocaleString()+" old objects; allocated "+s.toLocaleString()+" new; surviving "+o.toLocaleString()+" old; tenuring "+a.toLocaleString()+" new; gc'ed "+h.toLocaleString()+" old and "+c.toLocaleString()+" new; total now: "+this.oldSpaceCount.toLocaleString()+" ("+(n>0?"+":"")+n.toLocaleString()+", "+this.oldSpaceBytes.toLocaleString()+" bytes)"),r.length>0?r[0]:null},gcRoots:function(){return this.vm.storeContextRegisters(),[this.specialObjectsArray,this.vm.activeContext]},markReachableObjects:function(){var e=this.gcRoots(),t=[];for(this.weakObjects=[];e.length>0;){var s=e.pop();if(!s.mark){s.oop<0&&t.push(s),s.mark=!0,s.sqClass.mark||e.push(s.sqClass);var i=s.pointers;if(i){var r=i.length;if(s.isWeak()&&(r=s.sqClass.classInstSize(),this.weakObjects.push(s)),this.vm.isContext(s))for(var n=r=s.contextSizeWithStack();n<i.length;n++)i[n]=this.vm.nilObj;for(n=0;n<r;n++)"object"!=typeof i[n]||i[n].mark||e.push(i[n])}}}return this.isSpur?t:t.sort((function(e,t){return t.oop-e.oop}))},removeUnmarkedOldObjects:function(){var e=0,t=0,s=this.firstOldObject;for(s.mark=!1;;){var i=s.nextObject;if(!i)return this.lastOldObject=s,this.lastOldObject.nextObject=null,this.oldSpaceBytes-=t,void(this.oldSpaceCount-=e);if(i.dirty&&(i.dirty=!1),i.mark)(s=i).mark=!1,s.oop-=t;else{var r=i;s.nextObject=r.nextObject,r.oop=-++this.newSpaceCount,t+=r.totalBytes(),e++}}},appendToOldObjects:function(e){for(var t=this.lastOldObject,s=0;s<e.length;s++){var i=e[s];i.mark=!1,this.oldSpaceBytes=i.setAddr(this.oldSpaceBytes),t.nextObject=i,t=i}t.nextObject=null,this.lastOldObject=t,this.lastOldObject.nextObject=null,this.oldSpaceCount+=e.length,this.gcTenured+=e.length,this.vm.signalLowSpaceIfNecessary(this.bytesLeft())},tenureIfYoung:function(e){e.oop<0&&this.appendToOldObjects([e])},finalizeWeakReferences:function(){var e=this.weakObjects;this.weakObjects=null;for(var t=0;t<e.length;t++){for(var s=e[t],i=s.pointers,r=s.sqClass.classInstSize(),n=!1,a=r;a<i.length;a++)i[a].oop<0&&(i[a]=this.vm.nilObj,n=!0);if(n&&(this.vm.pendingFinalizationSignals++,r>=2)){var o=s.pointers[Squeak.WeakFinalizerItem_list];if(o.sqClass==this.vm.specialObjects[Squeak.splOb_ClassWeakFinalizer]){var c=o.pointers[Squeak.WeakFinalizationList_first];s.pointers[Squeak.WeakFinalizerItem_next]=c,o.pointers[Squeak.WeakFinalizationList_first]=s}}}this.vm.pendingFinalizationSignals>0&&this.vm.forceInterruptCheck()}},"garbage collection - partial",{partialGC:function(e){this.vm.addMessage("partialGC: "+e);var t=Date.now(),s=this.newSpaceCount,i=this.findYoungObjects();return this.appendToYoungSpace(i),this.finalizeWeakReferences(),this.cleanupYoungSpace(i),this.allocationCount+=this.newSpaceCount-i.length,this.youngSpaceCount=i.length,this.newSpaceCount=this.youngSpaceCount,this.pgcCount++,this.pgcMilliseconds+=Date.now()-t,console.log("Partial GC ("+e+"): "+(Date.now()-t)+" ms, found "+this.youngRootsCount.toLocaleString()+" roots in "+this.oldSpaceCount.toLocaleString()+" old, kept "+this.youngSpaceCount.toLocaleString()+" young ("+(s-this.youngSpaceCount).toLocaleString()+" gc'ed)"),i[0]},youngRoots:function(){for(var e=this.gcRoots().filter((function(e){return e.oop<0})),t=this.firstOldObject;t;){if(t.dirty){for(var s=t.pointers,i=!1,r=0;r<s.length;r++){var n=s[r];"object"==typeof n&&n.oop<0&&(e.push(n),i=!0)}i||(t.dirty=!1)}t=t.nextObject}return e},findYoungObjects:function(){var e=this.youngRoots(),t=[];for(this.youngRootsCount=e.length,this.weakObjects=[];e.length>0;){var s=e.pop();if(!s.mark){t.push(s),s.mark=!0,s.sqClass.oop<0&&e.push(s.sqClass);var i=s.pointers;if(i){var r=i.length;if(s.isWeak()&&(r=s.sqClass.classInstSize(),this.weakObjects.push(s)),this.vm.isContext(s))for(var n=r=s.contextSizeWithStack();n<i.length;n++)i[n]=this.vm.nilObj;for(n=0;n<r;n++){var a=i[n];"object"==typeof a&&a.oop<0&&e.push(a)}}}}return this.isSpur?t:t.sort((function(e,t){return t.oop-e.oop}))},appendToYoungSpace:function(e){for(var t=this.lastOldObject.oop+1,s=0;s<e.length;s++){var i=e[s];this.hasNewInstances[i.oop]&&(delete this.hasNewInstances[i.oop],this.hasNewInstances[t]=!0),i.oop=t,i.nextObject=e[s+1],t++}},cleanupYoungSpace:function(e){for(var t=e[0],s=-1;t;)this.hasNewInstances[t.oop]&&(delete this.hasNewInstances[t.oop],this.hasNewInstances[s]=!0),t.oop=s,t.mark=!1,t=t.nextObject,s--}},"creating",{registerObject:function(e){return e.oop=-++this.newSpaceCount,this.lastHash=13849+27181*this.lastHash&4294967295,4095&this.lastHash},registerObjectSpur:function(e){return e.oop=-++this.newSpaceCount,0},instantiateClass:function(e,t,s){var i=new(e.classInstProto()),r=this.registerObject(i);return i.initInstanceOf(e,t,r,s),this.hasNewInstances[e.oop]=!0,i},clone:function(e){var t=new(e.sqClass.classInstProto()),s=this.registerObject(t);return t.initAsClone(e,s),this.hasNewInstances[t.sqClass.oop]=!0,t}},"operations",{bulkBecome:function(e,t,s,i){if(!e)return!t;var r=e.length;if(r!==t.length)return!1;var n=null;this.newSpaceCount>0?n=this.partialGC("become"):this.vm.storeContextRegisters();for(var a={},o=0;o<r;o++){if(!(m=e[o]).sqClass)return!1;if(a[m.oop])return!1;a[m.oop]=t[o]}if(s)for(o=0;o<r;o++){if(!(m=t[o]).sqClass)return!1;if(a[m.oop])return!1;a[m.oop]=e[o]}if(i)for(o=0;o<r;o++){if(!t[o].sqClass)return!1;var c=e[o].hash;if(e[o].hash=t[o].hash,t[o].hash=c,this.isSpur&&this.classTable[c]===e[o]&&(this.classTable[c]=t[o]),s&&this.isSpur&&this.classTable[t[o].hash]===t[o]){var h=e[o],u=h.className?h.className():h.sqClass.className(),l=t[o],p=l.className?l.className():l.sqClass.className();console.warn("Unexpected two way class become",u,p),this.classTable[t[o].hash]=e[o]}}this.lastOldObject.nextObject=n;for(var m=this.firstOldObject;m;){var d=a[m.sqClass.oop];d&&(m.sqClass=d,d.oop<0&&(m.dirty=!0));var f=m.pointers;if(f)for(var v=0;v<f.length;v++)(d=a[f[v].oop])&&(f[v]=d,d.oop<0&&(m.dirty=!0));m=m.nextObject}return this.lastOldObject.nextObject=null,this.vm.flushMethodCacheAfterBecome(a),!0},objectAfter:function(e){return e.nextObject||this.nextObjectWithGC("nextObject",e)},someInstanceOf:function(e){for(var t=this.firstOldObject;t;){if(t.sqClass===e)return t;t=t.nextObject||this.nextObjectWithGCFor(t,e)}return null},nextInstanceAfter:function(e){for(var t=e.sqClass;;){if(!(e=e.nextObject||this.nextObjectWithGCFor(e,t)))return null;if(e.sqClass===t)return e}},nextObjectWithGC:function(e,t){var s=t.oop>0?0:this.youngSpaceCount;return this.newSpaceCount<=s?null:(t.oop<0&&this.fullGC(e),this.partialGC(e))},nextObjectWithGCFor:function(e,t){return this.hasNewInstances[t.oop]?this.nextObjectWithGC("instance of "+t.className(),e):null},allInstancesOf:function(e){for(var t=this.firstOldObject,s=[];t;)t.sqClass===e&&s.push(t),t=t.nextObject||this.nextObjectWithGCFor(t,e);return s},writeToBuffer:function(){var e=new DataView(new ArrayBuffer(64+this.oldSpaceBytes)),t=0,s=function(s){e.setUint32(t,s),t+=4};for(s(this.formatVersion()),s(64),s(this.oldSpaceBytes),s(this.firstOldObject.addr()),s(this.objectToOop(this.specialObjectsArray)),s(this.lastHash),s(52429400);t<64;)s(0);for(var i=this.firstOldObject,r=0;i;)t=i.writeTo(e,t,this),i=i.nextObject,r++;if(t!==e.byteLength)throw Error("wrong image size");if(r!==this.oldSpaceCount)throw Error("wrong object count");return e.buffer},objectToOop:function(e){if("number"==typeof e)return e<<1|1;if(e.oop<0)throw Error("temporary oop");return e.oop},bytesLeft:function(){return this.totalMemory-this.oldSpaceBytes},formatVersion:function(){return this.isSpur?6521:this.hasClosures?6504:6502},segmentVersion:function(){var e=this.isSpur?"seod":"does";return this.formatVersion()|e.charCodeAt(0)<<24},storeImageSegment:function(e,t,s){var i=new DataView(e.words.buffer),r=0,n=t.pointers,a=0;i.setUint32(r,this.segmentVersion()),r+=4,this.fullGC("storeImageSegment"),s.mark=!0;for(var o=0;o<s.pointers.length;o++)"object"==typeof s.pointers[o]&&(s.pointers[o].mark=!0);this.markReachableObjects(),s.mark=!1;for(o=0;o<s.pointers.length;o++)"object"==typeof s.pointers[o]&&(s.pointers[o].mark=!1);var c={},h=[];function u(e){var t=c[e.oop];if(!t){if(e.mark){if(a>=n.length)return 0;t=2147483652+4*a,n[a++]=e}else{if(r+e.totalBytes()>i.byteLength)return 0;t=r+4*(e.snapshotSize().header+1),r=e.writeTo(i,r,this),h.push(e)}c[e.oop]=t}return t}function l(){for(var e=this.firstOldObject;e;)e.mark=!1,e=e.nextObject;return this.weakObjects=null,!1}for(u=u.bind(this),l=l.bind(this),u(s);h.length>0;){var p=h.shift(),m=c[p.oop],d=p.snapshotSize().header,f=p.pointers;if(d>0){var v=u(p.sqClass);if(!v)return l();var g=1===d?Squeak.HeaderTypeClass:Squeak.HeaderTypeSizeAndClass;i.setUint32(m-8,v|g)}if(f)for(o=0;o<f.length;o++){var b=f[o];if("object"==typeof b){var k=u(b);if(!k)return l();i.setUint32(m+4*o,k)}}}p=e.oop<t.oop?e:t;for(var S=0;p;)p.oop-=S,p===e?(S+=4*p.words.length-r,p.words=new Uint32Array(p.words.buffer.slice(0,r))):p===t&&(S+=4*(p.pointers.length-a),p.pointers.length=a),p=p.nextObject;return this.oldSpaceBytes-=S,l(),!0},loadImageSegment:function(e,t){if(1===e.words.length)return e.nextObject;var s=new DataView(e.words.buffer),i=!1,r=0,n=function(){var e=s.getUint32(r,i);return r+=4,e},a=function(e,t){if(t<5){for(var i=[];i.length<e;)i.push(n());return i}var a=new Uint32Array(s.buffer,r,e);return r+=4*e,a},o=n();if(!0&o&&(i=!0,r=0,!0&(o=n())))return console.error("image segment format not supported"),null;this.tenureIfYoung(e);for(var c=e,h=c.nextObject,u=e.oop,l={},p={};r<s.byteLength;){var m=0,d=0,f=n();switch(f&Squeak.HeaderTypeMask){case Squeak.HeaderTypeSizeAndClass:m=f>>>2,d=n(),f=n();break;case Squeak.HeaderTypeClass:d=f-Squeak.HeaderTypeClass,m=(f=n())>>>2&63;break;case Squeak.HeaderTypeShort:m=f>>>2&63,d=f>>>12&31;break;case Squeak.HeaderTypeFree:throw Error("Unexpected free block")}m--;var v=r,g=f>>>8&15,b=f>>>17&4095,k=a(m,g),S=new Squeak.Object;S.initFromImage(v+u,d,g,b),c.nextObject=S,this.oldSpaceCount++,c=S,l[v]=S,p[v+u]=k}S.nextObject=h;for(var C=0;C<t.pointers.length;C++)l[2147483652+4*C]=t.pointers[C];var y=this.specialObjectsArray.pointers[Squeak.splOb_CompactClasses].pointers,O=0,I=y.map((function(e){return l[--O]=e,O}));e.words=new Uint32Array([e.words[0]]),delete e.uint8Array;var P=e.nextObject,_=this.specialObjectsArray.pointers[Squeak.splOb_ClassFloat],x=P;do{x.installFromImage(l,p,I,_,i,false),x=x.nextObject}while(x!==h);return P}},"spur support",{initSpurOverrides:function(){this.registerObject=this.registerObjectSpur,this.writeToBuffer=this.writeToBufferSpur,this.storeImageSegment=this.storeImageSegmentSpur,this.loadImageSegment=this.loadImageSegmentSpur},spurClassTable:function(e,t,s,i){for(var r={},n=this.firstOldObject,a=0;a<4096;a++){var o=e[s[a]];if(o.oop&&(o=t[o.oop]),1024===o.length)for(var c=0;c<1024;c++){var h=e[o[c]];if(!h)throw Error("Invalid class table entry (oop "+o[c]+")");if(h!==n)r[l=1024*a+c]=h}}for(var u in Squeak)if(/^splOb_Class/.test(u)){var l,p=e[t[i.oop][Squeak[u]]];if(p!==n)(l=p.hash)>0&&l<1024&&(r[l]=p)}return r[3]=r[1],this.classTable=r,this.classTableIndex=1024,r},enterIntoClassTable:function(e){for(var t=this.classTableIndex,s=this.classTable;t<=4194303;){if(!s[t])return s[t]=e,e.hash=t,this.classTableIndex=t,t;t++}return console.error("class table full?"),null},initImmediateClasses:function(e,t,s){var i=t[s.oop];this.characterClass=e[i[Squeak.splOb_ClassCharacter]],this.floatClass=e[i[Squeak.splOb_ClassFloat]],this.largePosIntClass=e[i[Squeak.splOb_ClassLargePositiveInteger]],this.largeNegIntClass=e[i[Squeak.splOb_ClassLargeNegativeInteger]],this.characterClass.classInstProto("Character"),this.floatClass.classInstProto("Float"),this.largePosIntClass.classInstProto("LargePositiveInteger"),this.largeNegIntClass.classInstProto("LargeNegativeInteger"),this.characterTable={}},getCharacter:function(e){var t=this.characterTable[e];return t||((t=new this.characterClass.instProto).initInstanceOfChar(this.characterClass,e),this.characterTable[e]=t),t},instantiateFloat:function(e){var t=new this.floatClass.instProto;return this.registerObjectSpur(t),this.hasNewInstances[this.floatClass.oop]=!0,t.initInstanceOfFloat(this.floatClass,e),t},instantiateLargeFromSmall:function(e,t){t=e<<29|t>>>3;var s=(e>>=3)<0;s&&(e=-e,0!==(t=-t)&&e--);var i=0===e?4:e<=255?5:e<=65535?6:e<=16777215?7:8,r=s?this.largeNegIntClass:this.largePosIntClass,n=new r.instProto;this.registerObjectSpur(n),this.hasNewInstances[r.oop]=!0,n.initInstanceOfLargeInt(r,i);for(var a=n.bytes,o=0;o<4;o++)a[o]=255&t,t>>=8;for(o=4;o<i;o++)a[o]=255&e,e>>=8;return n},ensureClassesInTable:function(){for(var e=this.firstOldObject,t=1024;e;){var s=e.sqClass;if(0===s.hash&&this.enterIntoClassTable(s),s.hash>t&&(t=s.hash),this.classTable[s.hash]!==s)throw Error("Class not in class table");e=e.nextObject}return 1+(t>>10)},classTableBytes:function(e){return 4*(4108+1028*e)},writeFreeLists:function(e,t,s,i){return e.setUint32(t,167772178,s),t+=4,e.setUint32(t,536870912,s),t+=4,t+=128},writeClassTable:function(e,t,s,i,r){var n=4104,a=1024;e.setUint32(t,n,s),t+=4,e.setUint32(t,4278190080,s),t+=4,e.setUint32(t,33554448,s),t+=4,e.setUint32(t,4278190080,s),t+=4;for(var o=0;o<r;o++)e.setUint32(t,16624+4112*o,s),t+=4;t+=4*(n-r);var c=0;for(o=0;o<r;o++){e.setUint32(t,a,s),t+=4,e.setUint32(t,4278190080,s),t+=4,e.setUint32(t,33554448,s),t+=4,e.setUint32(t,4278190080,s),t+=4;for(var h=0;h<a;h++){var u=this.classTable[c];if(u&&u.pointers){if(!u.hash)throw Error("class without id");(u.hash!==c&&c>=32||u.oop<0)&&(console.warn("freeing class index "+c+" "+u.className()),u=null,delete this.classTable[c])}u&&e.setUint32(t,i(u),s),t+=4,c++}}return t},writeToBufferSpur:function(){var e=this.ensureClassesInTable(),t=136+this.classTableBytes(e),s=new DataView(new ArrayBuffer(64+t+this.oldSpaceBytes+16)),i=!0,r=Date.now(),n=0;function a(e){s.setUint32(n,e,i),n+=4}function o(e){if("number"==typeof e)return e<<1|1;if(7===e._format){if(e.hash!==e.oop>>2||2!=(3&e.oop))throw Error("Bad immediate char");return e.oop}if(e.oop<0)throw Error("temporary oop");return e.oop<48?e.oop:e.oop+t}for(a(this.formatVersion()),a(64),a(t+this.oldSpaceBytes+16),a(this.firstOldObject.addr()),a(o(this.specialObjectsArray)),this.savedHeaderWords.forEach(a),a(t+this.oldSpaceBytes+16);n<64;)a(0);var c=this.firstOldObject,h=0;for(n=c.writeTo(s,n,i,o),c=c.nextObject,h++,n=c.writeTo(s,n,i,o),c=c.nextObject,h++,n=c.writeTo(s,n,i,o),c=c.nextObject,h++,n=this.writeFreeLists(s,n,i,o),n=this.writeClassTable(s,n,i,o,e);c;)n=c.writeTo(s,n,i,o),c=c.nextObject,h++;if(a(1241513987),a(8388608),a(0),a(0),n!==s.byteLength)throw Error("wrong image size");if(h!==this.oldSpaceCount)throw Error("wrong object count");var u=Date.now()-r;return console.log("Wrote "+h+" objects in "+u+" ms, image size "+n+" bytes"),s.buffer},storeImageSegmentSpur:function(e,t,s){return this.vm.warnOnce("not implemented for Spur yet: primitive 98 (primitiveStoreImageSegment)"),!1},loadImageSegmentSpur:function(e,t){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(e,t,s){console.log("squeak: initializing interpreter "+Squeak.vmVersion+" ("+Squeak.vmDate+")"),this.Squeak=Squeak,this.image=e,this.image.vm=this,this.options=s||{},this.primHandler=new Squeak.Primitives(this,t),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 e=0;e<this.methodCacheSize;e++)this.methodCache[e]={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 e=this.specialObjects[Squeak.splOb_SchedulerAssociation].pointers[Squeak.Assn_value].pointers[Squeak.ProcSched_activeProcess];this.activeContext=e.pointers[Squeak.Proc_suspendedContext],this.activeContext.dirty=!0,this.fetchContextRegisters(this.activeContext),this.reclaimableContextCount=0},globalsGetter:function(){var e=this.specialObjects[Squeak.splOb_SmalltalkDictionary],t=e.sqClass.className();if("Association"===t&&(t=(e=e.pointers[1]).sqClass.className()),"SystemDictionary"===t)return function(){return e.pointers[1].pointers};if("SmalltalkImage"===t){var s=e.pointers[0],i=s.sqClass.className();if("SystemDictionary"===i)return function(){return s.pointers[1].pointers};if("Environment"===i)return function(){return s.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 e=this.image.oldSpaceCount/(this.startupTime-this.image.startupTime);if(e<10)return console.warn("Slow machine detected (loaded "+(1e3*e|0)+" objects/sec), using interpreter only");try{console.log("squeak: initializing JIT compiler");var t=new Squeak.Compiler(this);t.compile&&(this.compiler=t)}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(e){try{var t=e.enabled&&this.findMethod(e.method);if(t){var s=e.primitive,i=e.bytecode,r=e.literal,n=!0;s?t.pointers[0]|=s:i&&t.bytes[i.pc]===i.old?t.bytes[i.pc]=i.hack:i&&t.bytes[i.pc]===i.hack?n=!1:r&&t.pointers[r.index].pointers[1]===r.old?t.pointers[r.index].pointers[1]=r.hack:r&&t.pointers[r.index].pointers[1]===r.hack?n=!1:(n=!1,console.warn("Not hacking "+e.method)),n&&console.warn("Hacking "+e.method)}}catch(t){console.error("Failed to hack "+e.method+" with error "+t)}}),this)}},"interpreting",{interpretOne:function(e){if(!this.method.compiled){if(this.method.methodSignFlag())return this.interpretOneSistaWithExtensions(e,0,0);var t,s,i=this.Squeak;switch(this.byteCodeCount++,t=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&t]);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[i.Context_tempFrameStart+(15&t)]);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&t));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&t).pointers[i.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&t]=this.pop());case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:return void(this.homeContext.pointers[i.Context_tempFrameStart+(7&t)]=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[i.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 s=this.nextByte(),void this.send(this.method.methodGetSelector(31&s),s>>5,!1);case 132:return void this.doubleExtendedDoAnything(this.nextByte());case 133:return s=this.nextByte(),void this.send(this.method.methodGetSelector(31&s),s>>5,!0);case 134:return s=this.nextByte(),void this.send(this.method.methodGetSelector(63&s),s>>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 s=this.nextByte(),void this.push(this.homeContext.pointers[i.Context_tempFrameStart+this.nextByte()].pointers[s]);case 141:return s=this.nextByte(),(r=this.homeContext.pointers[i.Context_tempFrameStart+this.nextByte()]).pointers[s]=this.top(),void(r.dirty=!0);case 142:var r;return s=this.nextByte(),(r=this.homeContext.pointers[i.Context_tempFrameStart+this.nextByte()]).pointers[s]=this.pop(),void(r.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&t));case 152:case 153:case 154:case 155:case 156:case 157:case 158:case 159:return void this.jumpIfFalse(1+(7&t));case 160:case 161:case 162:case 163:case 164:case 165:case 166:case 167:return s=this.nextByte(),this.pc+=256*((7&t)-4)+s,void((7&t)<4&&this.interruptCheckCounter--<=0&&this.checkForInterrupts());case 168:case 169:case 170:case 171:return void this.jumpIfTrue(256*(3&t)+this.nextByte());case 172:case 173:case 174:case 175:return void this.jumpIfFalse(256*(3&t)+this.nextByte());case 176:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)+this.stackIntOrFloat(0))||this.sendSpecial(15&t));case 177:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)-this.stackIntOrFloat(0))||this.sendSpecial(15&t));case 178:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)<this.stackIntOrFloat(0))||this.sendSpecial(15&t));case 179:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)>this.stackIntOrFloat(0))||this.sendSpecial(15&t));case 180:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)<=this.stackIntOrFloat(0))||this.sendSpecial(15&t));case 181:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)>=this.stackIntOrFloat(0))||this.sendSpecial(15&t));case 182:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)===this.stackIntOrFloat(0))||this.sendSpecial(15&t));case 183:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)!==this.stackIntOrFloat(0))||this.sendSpecial(15&t));case 184:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)*this.stackIntOrFloat(0))||this.sendSpecial(15&t));case 185:return this.success=!0,void(this.pop2AndPushIntResult(this.quickDivide(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&t));case 186:return this.success=!0,void(this.pop2AndPushIntResult(this.mod(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&t));case 187:return this.success=!0,void(this.primHandler.primitiveMakePoint(1,!0)||this.sendSpecial(15&t));case 188:return this.success=!0,void(this.pop2AndPushIntResult(this.safeShift(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&t));case 189:return this.success=!0,void(this.pop2AndPushIntResult(this.div(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&t));case 190:return this.success=!0,void(this.pop2AndPushIntResult(this.stackInteger(1)&this.stackInteger(0))||this.sendSpecial(15&t));case 191:return this.success=!0,void(this.pop2AndPushIntResult(this.stackInteger(1)|this.stackInteger(0))||this.sendSpecial(15&t));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&t)||this.sendSpecial(16+(15&t)));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&t),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&t),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&t),2,!1)}throw Error("not a bytecode: "+t)}if(e){if(!this.compiler.enableSingleStepping(this.method))return this.method.compiled=null,this.interpretOne(e);this.breakNow()}this.method.compiled(this)},interpretOneSistaWithExtensions:function(e,t,s){var i,r,n=this.Squeak;switch(this.byteCodeCount++,i=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&i]);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&i).pointers[n.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&i));case 64:case 65:case 66:case 67:case 68:case 69:case 70:case 71:return void this.push(this.homeContext.pointers[n.Context_tempFrameStart+(7&i)]);case 72:case 73:case 74:case 75:return void this.push(this.homeContext.pointers[n.Context_tempFrameStart+(3&i)+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==s?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[n.BlockContext_caller]);case 94:return 0==t?void this.doReturn(this.pop(),this.activeContext.pointers[n.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&i));case 97:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)-this.stackIntOrFloat(0))||this.sendSpecial(15&i));case 98:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)<this.stackIntOrFloat(0))||this.sendSpecial(15&i));case 99:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)>this.stackIntOrFloat(0))||this.sendSpecial(15&i));case 100:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)<=this.stackIntOrFloat(0))||this.sendSpecial(15&i));case 101:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)>=this.stackIntOrFloat(0))||this.sendSpecial(15&i));case 102:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)===this.stackIntOrFloat(0))||this.sendSpecial(15&i));case 103:return this.success=!0,void(this.pop2AndPushBoolResult(this.stackIntOrFloat(1)!==this.stackIntOrFloat(0))||this.sendSpecial(15&i));case 104:return this.success=!0,this.resultIsFloat=!1,void(this.pop2AndPushNumResult(this.stackIntOrFloat(1)*this.stackIntOrFloat(0))||this.sendSpecial(15&i));case 105:return this.success=!0,void(this.pop2AndPushIntResult(this.quickDivide(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&i));case 106:return this.success=!0,void(this.pop2AndPushIntResult(this.mod(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&i));case 107:return this.success=!0,void(this.primHandler.primitiveMakePoint(1,!0)||this.sendSpecial(15&i));case 108:return this.success=!0,void(this.pop2AndPushIntResult(this.safeShift(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&i));case 109:return this.success=!0,void(this.pop2AndPushIntResult(this.div(this.stackInteger(1),this.stackInteger(0)))||this.sendSpecial(15&i));case 110:return this.success=!0,void(this.pop2AndPushIntResult(this.stackInteger(1)&this.stackInteger(0))||this.sendSpecial(15&i));case 111:return this.success=!0,void(this.pop2AndPushIntResult(this.stackInteger(1)|this.stackInteger(0))||this.sendSpecial(15&i));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&i)||this.sendSpecial(16+(15&i)));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&i),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&i),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&i),2,!1);case 176:case 177:case 178:case 179:case 180:case 181:case 182:case 183:return void(this.pc+=1+(7&i));case 184:case 185:case 186:case 187:case 188:case 189:case 190:case 191:return void this.jumpIfTrue(1+(7&i));case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:return void this.jumpIfFalse(1+(7&i));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&i]=this.pop());case 208:case 209:case 210:case 211:case 212:case 213:case 214:case 215:return void(this.homeContext.pointers[n.Context_tempFrameStart+(7&i)]=this.pop());case 216:return void this.pop();case 224:return r=this.nextByte(),void this.interpretOneSistaWithExtensions(e,(t<<8)+r,s);case 225:return r=this.nextByte(),void this.interpretOneSistaWithExtensions(e,t,(s<<8)+(r<128?r:r-256));case 226:return r=this.nextByte(),void this.push(this.receiver.pointers[r+(t<<8)]);case 227:return r=this.nextByte(),void this.push(this.method.methodGetLiteral(r+(t<<8)).pointers[n.Assn_value]);case 228:return r=this.nextByte(),void this.push(this.method.methodGetLiteral(r+(t<<8)));case 229:return r=this.nextByte(),void this.push(this.homeContext.pointers[n.Context_tempFrameStart+r]);case 231:return void this.pushNewArray(this.nextByte());case 232:return r=this.nextByte(),void this.push(r+(s<<8));case 233:return r=this.nextByte(),void this.push(this.image.getCharacter(r+(s<<8)));case 234:return r=this.nextByte(),void this.send(this.method.methodGetSelector((r>>3)+(t<<5)),(7&r)+(s<<3),!1);case 235:r=this.nextByte();var a=this.method.methodGetSelector((r>>3)+(t<<5));return s>=64?void this.sendSuperDirected(a,(7&r)+((63&s)<<3)):void this.send(a,(7&r)+(s<<3),!0);case 237:var o=this.nextByte()+(s<<8);return this.pc+=o,void(o<0&&this.interruptCheckCounter--<=0&&this.checkForInterrupts());case 238:return void this.jumpIfTrue(this.nextByte()+(s<<8));case 239:return void this.jumpIfFalse(this.nextByte()+(s<<8));case 240:return this.receiver.dirty=!0,void(this.receiver.pointers[this.nextByte()+(t<<8)]=this.pop());case 241:return(c=this.method.methodGetLiteral(this.nextByte()+(t<<8))).dirty=!0,void(c.pointers[n.Assn_value]=this.pop());case 242:return void(this.homeContext.pointers[n.Context_tempFrameStart+this.nextByte()]=this.pop());case 243:return this.receiver.dirty=!0,void(this.receiver.pointers[this.nextByte()+(t<<8)]=this.top());case 244:var c;return(c=this.method.methodGetLiteral(this.nextByte()+(t<<8))).dirty=!0,void(c.pointers[n.Assn_value]=this.top());case 245:return void(this.homeContext.pointers[n.Context_tempFrameStart+this.nextByte()]=this.top());case 248:return void this.callPrimBytecode(245);case 249:return void this.pushFullClosure(t);case 250:return void this.pushClosureCopyExtended(t,s);case 251:return r=this.nextByte(),void this.push(this.homeContext.pointers[n.Context_tempFrameStart+this.nextByte()].pointers[r]);case 252:return r=this.nextByte(),(h=this.homeContext.pointers[n.Context_tempFrameStart+this.nextByte()]).pointers[r]=this.top(),void(h.dirty=!0);case 253:var h;return r=this.nextByte(),(h=this.homeContext.pointers[n.Context_tempFrameStart+this.nextByte()]).pointers[r]=this.pop(),void(h.dirty=!0)}throw Error("not a bytecode: "+i)},interpret:function(e,t){if(this.frozen)return"frozen";for(this.isIdle=!1,this.breakOutOfInterpreter=!1,this.breakAfter(e||500);!1===this.breakOutOfInterpreter;)this.method.compiled?this.method.compiled(this):this.interpretOne();if("function"==typeof this.breakOutOfInterpreter)return this.breakOutOfInterpreter(t);var s="break"==this.breakOutOfInterpreter?"break":this.isIdle?this.nextWakeupTick?Math.max(1,this.nextWakeupTick-this.primHandler.millisecondClockValue()):"sleep":0;return t&&t(s),s},goIdle:function(){var e=0!==this.nextWakeupTick;this.forceInterruptCheck(),this.checkForInterrupts();var t=0!==this.nextWakeupTick;this.isIdle=t||!e,this.breakOut()},freeze:function(e){var t;this.frozen=!0,this.breakOutOfInterpreter=function(e){if(!e)throw Error("need function to restart interpreter");return t=e,"frozen"}.bind(this);var s=function(){if(this.frozen=!1,!t)throw Error("no continue function");t(0)}.bind(this);return e&&self.setTimeout((function(){e(s)}),0),s},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 e=this.primHandler.millisecondClockValue();(e<this.lastTick&&(this.nextPollTick=e+(this.nextPollTick-this.lastTick),this.breakOutTick=e+(this.breakOutTick-this.lastTick),0!==this.nextWakeupTick&&(this.nextWakeupTick=e+(this.nextWakeupTick-this.lastTick))),this.interruptCheckCounter>-100&&(e-this.lastTick<this.interruptChecksEveryNms?this.interruptCheckCounterFeedBackReset+=10:this.interruptCheckCounterFeedBackReset<=1e3?this.interruptCheckCounterFeedBackReset=1e3:this.interruptCheckCounterFeedBackReset-=12),this.interruptCheckCounter=this.interruptCheckCounterFeedBackReset,this.lastTick=e,this.signalLowSpace)&&(this.signalLowSpace=!1,(t=this.specialObjects[Squeak.splOb_TheLowSpaceSemaphore]).isNil||this.primHandler.synchronousSignal(t));this.interruptPending&&(this.interruptPending=!1,(t=this.specialObjects[Squeak.splOb_TheInterruptSemaphore]).isNil||this.primHandler.synchronousSignal(t));0!==this.nextWakeupTick&&e>=this.nextWakeupTick&&(this.nextWakeupTick=0,(t=this.specialObjects[Squeak.splOb_TheTimerSemaphore]).isNil||this.primHandler.synchronousSignal(t));if(this.pendingFinalizationSignals>0){var t=this.specialObjects[Squeak.splOb_TheFinalizationSemaphore];this.pendingFinalizationSignals=0,t.isNil||this.primHandler.synchronousSignal(t)}this.primHandler.semaphoresToSignal.length>0&&this.primHandler.signalExternalSemaphores(),this.method.compiled||this.compileIfPossible(this.method),e>=this.breakOutTick&&this.breakOut()},extendedPush:function(e){var t=63&e;switch(e>>6){case 0:this.push(this.receiver.pointers[t]);break;case 1:this.push(this.homeContext.pointers[Squeak.Context_tempFrameStart+t]);break;case 2:this.push(this.method.methodGetLiteral(t));break;case 3:this.push(this.method.methodGetLiteral(t).pointers[Squeak.Assn_value])}},extendedStore:function(e){var t=63&e;switch(e>>6){case 0:this.receiver.dirty=!0,this.receiver.pointers[t]=this.top();break;case 1:this.homeContext.pointers[Squeak.Context_tempFrameStart+t]=this.top();break;case 2:this.nono();break;case 3:var s=this.method.methodGetLiteral(t);s.dirty=!0,s.pointers[Squeak.Assn_value]=this.top()}},extendedStorePop:function(e){var t=63&e;switch(e>>6){case 0:this.receiver.dirty=!0,this.receiver.pointers[t]=this.pop();break;case 1:this.homeContext.pointers[Squeak.Context_tempFrameStart+t]=this.pop();break;case 2:this.nono();break;case 3:var s=this.method.methodGetLiteral(t);s.dirty=!0,s.pointers[Squeak.Assn_value]=this.pop()}},doubleExtendedDoAnything:function(e){var t=this.nextByte();switch(e>>5){case 0:this.send(this.method.methodGetSelector(t),31&e,!1);break;case 1:this.send(this.method.methodGetSelector(t),31&e,!0);break;case 2:this.push(this.receiver.pointers[t]);break;case 3:this.push(this.method.methodGetLiteral(t));break;case 4:this.push(this.method.methodGetLiteral(t).pointers[Squeak.Assn_value]);break;case 5:this.receiver.dirty=!0,this.receiver.pointers[t]=this.top();break;case 6:this.receiver.dirty=!0,this.receiver.pointers[t]=this.pop();break;case 7:var s=this.method.methodGetLiteral(t);s.dirty=!0,s.pointers[Squeak.Assn_value]=this.top()}},jumpIfTrue:function(e){var t=this.pop();t.isTrue?this.pc+=e:t.isFalse||(this.push(t),this.send(this.specialObjects[Squeak.splOb_SelectorMustBeBoolean],0,!1))},jumpIfFalse:function(e){var t=this.pop();t.isFalse?this.pc+=e:t.isTrue||(this.push(t),this.send(this.specialObjects[Squeak.splOb_SelectorMustBeBoolean],0,!1))},sendSpecial:function(e){this.send(this.specialSelectors[2*e],this.specialSelectors[2*e+1],!1)},callPrimBytecode:function(e){this.pc+=2,this.primFailCode&&(this.method.bytes[this.pc]===e&&this.stackTopPut(this.getErrorObjectFromPrimFailCode()),this.primFailCode=0)},getErrorObjectFromPrimFailCode:function(){var e=this.specialObjects[Squeak.splOb_PrimErrTableIndex];if(e&&e.pointers){var t=e.pointers[this.primFailCode-1];if(t)return t}return this.primFailCode}},"closures",{pushNewArray:function(e){var t=e>127,s=127&e,i=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassArray],s);if(t){for(var r=0;r<s;r++)i.pointers[r]=this.stackValue(s-r-1);this.popN(s)}this.push(i)},pushClosureCopy:function(){var e=this.nextByte(),t=15&e,s=e>>4,i=256*this.nextByte()+this.nextByte(),r=this.encodeSqueakPC(this.pc,this.method),n=this.newClosure(t,r,s);if(n.pointers[Squeak.Closure_outerContext]=this.activeContext,this.reclaimableContextCount=0,s>0){for(var a=0;a<s;a++)n.pointers[Squeak.Closure_firstCopiedValue+a]=this.stackValue(s-a-1);this.popN(s)}this.pc+=i,this.push(n)},pushClosureCopyExtended:function(e,t){var s=this.nextByte(),i=this.nextByte(),r=(7&s)+8*this.mod(e,16),n=(s>>3&7)+8*this.div(e,16),a=i+(t<<8),o=this.encodeSqueakPC(this.pc,this.method),c=this.newClosure(r,o,n);if(c.pointers[Squeak.Closure_outerContext]=this.activeContext,this.reclaimableContextCount=0,n>0){for(var h=0;h<n;h++)c.pointers[Squeak.Closure_firstCopiedValue+h]=this.stackValue(n-h-1);this.popN(n)}this.pc+=a,this.push(c)},pushFullClosure:function(e){var t,s=this.nextByte(),i=this.nextByte(),r=s+(e<<8),n=63&i;t=1==(i>>6&1)?this.vm.nilObj:this.activeContext;var a=this.method.methodGetLiteral(r),o=this.newFullClosure(t,n,a);if(1==(i>>7&1))throw Error("on-stack receiver not yet supported");if(o.pointers[Squeak.ClosureFull_receiver]=this.receiver,this.reclaimableContextCount=0,n>0){for(var c=0;c<n;c++)o.pointers[Squeak.ClosureFull_firstCopiedValue+c]=this.stackValue(n-c-1);this.popN(n)}this.push(o)},newClosure:function(e,t,s){var i=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassBlockClosure],s);return i.pointers[Squeak.Closure_startpc]=t,i.pointers[Squeak.Closure_numArgs]=e,i},newFullClosure:function(e,t,s){var i=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassFullBlockClosure],t);return i.pointers[Squeak.Closure_outerContext]=e,i.pointers[Squeak.ClosureFull_method]=s,i.pointers[Squeak.Closure_numArgs]=s.methodNumArgs(),i}},"sending",{send:function(e,t,s){var i,r=this.stackValue(t);i=s?(i=this.method.methodClassForSuper()).pointers[Squeak.Class_superclass]:this.getClass(r);var n=this.findSelectorInClass(e,t,i);n.primIndex&&(this.verifyAtSelector=e,this.verifyAtClass=i),this.executeNewMethod(r,n.method,n.argCount,n.primIndex,n.mClass,e)},sendSuperDirected:function(e,t){var s=this.pop().pointers[Squeak.Class_superclass],i=this.stackValue(t),r=this.findSelectorInClass(e,t,s);r.primIndex&&(this.verifyAtSelector=e,this.verifyAtClass=s),this.executeNewMethod(i,r.method,r.argCount,r.primIndex,r.mClass,e)},sendAsPrimitiveFailure:function(e,t,s){this.executeNewMethod(e,t,s,0)},findSelectorInClass:function(e,t,s,i=t){this.currentSelector=e;var r=this.findMethodCacheEntry(e,s);if(r.method)return r;for(var n,a=s;!a.isNil;){if((n=a.pointers[Squeak.Class_mdict]).isNil){var o=this.specialObjects[Squeak.splOb_SelectorCannotInterpret],c=this.createActualMessage(e,t,s);return this.popNandPush(i+1,c),this.findSelectorInClass(o,1,a.superclass())}var h=this.lookupSelectorInDict(n,e);if(!h.isNil)return r.method=h,h.isMethod()?(r.primIndex=h.methodPrimitiveIndex(),r.argCount=h.methodNumArgs()):(r.primIndex=576,r.argCount=t),r.mClass=a,r;a=a.superclass()}var u=this.specialObjects[Squeak.splOb_SelectorDoesNotUnderstand];if(e===u)throw Error("Recursive not understood error encountered");var l=this.createActualMessage(e,t,s);if(this.breakOnMessageNotUnderstood){var p=this.stackValue(i);this.breakNow("Message not understood: "+p+" "+s.className()+">>"+e.bytesAsString())}return this.popNandPush(i,l),this.findSelectorInClass(u,1,s)},lookupSelectorInDict:function(e,t){for(var s=e.pointersSize(),i=(s-Squeak.MethodDict_selectorStart-1&t.hash)+Squeak.MethodDict_selectorStart,r=!1;;){var n=e.pointers[i];if(n===t)return e.pointers[Squeak.MethodDict_array].pointers[i-Squeak.MethodDict_selectorStart];if(n.isNil)return this.nilObj;if(++i===s){if(r)return this.nilObj;i=Squeak.MethodDict_selectorStart,r=!0}}},executeNewMethod:function(e,t,s,i,r,n){if(this.sendCount++,t===this.breakOnMethod&&this.breakNow("executing method "+this.printMethod(t,r,n)),this.logSends){for(var a=" ",o=this.activeContext;!o.isNil;)a+="| ",o=o.pointers[Squeak.Context_sender];var c=this.activeContext.pointers.slice(this.sp+1-s,this.sp+1);console.log(this.sendCount+a+this.printMethod(t,r,n,c))}if(this.breakOnContextChanged&&(this.breakOnContextChanged=!1,this.breakNow()),!(i>0&&this.tryPrimitive(i,s,t))){var h=this.allocateOrRecycleContext(t.methodNeedsLargeFrame()),u=t.methodTempCount(),l=Squeak.Context_tempFrameStart+u-1;if(h.pointers[Squeak.Context_method]=t,h.pointers[Squeak.BlockContext_initialIP]=this.nilObj,h.pointers[Squeak.Context_sender]=this.activeContext,this.arrayCopy(this.activeContext.pointers,this.sp-s,h.pointers,Squeak.Context_tempFrameStart-1,s+1),this.arrayFill(h.pointers,Squeak.Context_tempFrameStart+s,Squeak.Context_tempFrameStart+u,this.nilObj),this.popN(s+1),this.reclaimableContextCount++,this.storeContextRegisters(),this.activeContext=h,this.activeContext.dirty=!0,this.homeContext=h,this.method=t,this.pc=0,this.sp=l,this.receiver=h.pointers[Squeak.Context_receiver],this.receiver!==e)throw Error("receivers don't match");t.compiled||this.compileIfPossible(t,r,n),this.interruptCheckCounter--<=0&&this.checkForInterrupts()}},compileIfPossible(e,t,s){!e.compiled&&this.compiler&&this.compiler.compile(e,t,s)},doReturn:function(e,t){if(!t){var s=this.homeContext;if(this.hasClosures)for(var i;!(i=s.pointers[Squeak.Context_closure]).isNil;)s=i.pointers[Squeak.Closure_outerContext];t=s.pointers[Squeak.Context_sender]}if(t.isNil||t.pointers[Squeak.Context_instructionPointer].isNil)return this.cannotReturn(e);for(var r,n=this.activeContext.pointers[Squeak.Context_sender];n!==t;){if(n.isNil)return this.cannotReturn(e);if(this.isUnwindMarked(n))return this.aboutToReturnThrough(e,n);n=n.pointers[Squeak.Context_sender]}for(n=this.activeContext;n!==t;)this.breakOnContextReturned===n&&(this.breakOnContextReturned=null,this.breakNow()),r=n.pointers[Squeak.Context_sender],n.pointers[Squeak.Context_sender]=this.nilObj,n.pointers[Squeak.Context_instructionPointer]=this.nilObj,this.reclaimableContextCount>0&&(this.reclaimableContextCount--,this.recycleIfPossible(n)),n=r;this.activeContext=n,this.activeContext.dirty=!0,this.fetchContextRegisters(this.activeContext),this.push(e),this.breakOnContextChanged&&(this.breakOnContextChanged=!1,this.breakNow())},aboutToReturnThrough:function(e,t){this.push(this.exportThisContext()),this.push(e),this.push(t);var s=this.specialObjects[Squeak.splOb_SelectorAboutToReturn];this.send(s,2)},cannotReturn:function(e){this.push(this.exportThisContext()),this.push(e);var t=this.specialObjects[Squeak.splOb_SelectorCannotReturn];this.send(t,1)},tryPrimitive:function(e,t,s){if(e>255&&e<520){if(e>=264)return this.popNandPush(1,this.top().pointers[e-264]),!0;switch(e){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,e-261),!0}var i=this.sp,r=this.activeContext,n=this.primHandler.doPrimitive(e,t,s);return n&&this.sp!==i-t&&r===this.activeContext&&117!==e&&118!==e&&218!==e&&!this.frozen&&this.warnOnce("stack unbalanced after primitive "+e,"error"),n},createActualMessage:function(e,t,s){var i=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassMessage],0),r=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassArray],t);return this.arrayCopy(this.activeContext.pointers,this.sp-t+1,r.pointers,0,t),i.pointers[Squeak.Message_selector]=e,i.pointers[Squeak.Message_arguments]=r,i.pointers.length>Squeak.Message_lookupClass&&(i.pointers[Squeak.Message_lookupClass]=s),i},primitivePerform:function(e){var t=this.stackValue(e-1),s=this.stackValue(e),i=e-1,r=this.findSelectorInClass(t,i,this.getClass(s),e);if(r.selector===t){if(r.argCount!==i)return!1;var n=this.activeContext.pointers,a=this.sp-i;this.arrayCopy(n,a+1,n,a,i),this.sp--}else s=this.stackValue(r.argCount);return this.executeNewMethod(s,r.method,r.argCount,r.primIndex,r.mClass,t),!0},primitivePerformWithArgs:function(e,t){var s=t?3:2,i=this.stackValue(s),r=this.stackValue(s-1),n=this.stackValue(s-2);if(n.sqClass!==this.specialObjects[Squeak.splOb_ClassArray])return!1;var a=t?this.top():this.getClass(i);if(t)for(var o=this.getClass(i);o!==a;)if((o=o.pointers[Squeak.Class_superclass]).isNil)return!1;var c=n.pointersSize(),h=this.findSelectorInClass(r,c,a,e);if(h.selector===r){if(h.argCount!==c)return!1;var u=this.activeContext.pointers,l=this.sp-(e-1);u[l-1]=i,this.arrayCopy(n.pointers,0,u,l,c),this.sp+=c-e}else i=this.stackValue(h.argCount);return this.executeNewMethod(i,h.method,h.argCount,h.primIndex,h.mClass,r),!0},primitiveInvokeObjectAsMethod:function(e,t){for(var s=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassArray],e),i=0;i<e;i++)s.pointers[e-i-1]=this.pop();var r=this.pop(),n=this.currentSelector,a=this.specialObjects[Squeak.splOb_SelectorRunWithIn];return this.push(t),this.push(n),this.push(s),this.push(r),this.send(a,3,!1),!0},findMethodCacheEntry:function(e,t){var s;this.methodCacheRandomish=this.methodCacheRandomish+1&3;for(var i=(e.hash^t.hash)&this.methodCacheMask,r=i,n=0;n<4;n++){if((s=this.methodCache[r]).selector===e&&s.lkupClass===t)return s;n===this.methodCacheRandomish&&(i=r),r=r+e.hash&this.methodCacheMask}return(s=this.methodCache[i]).lkupClass=t,s.selector=e,s.method=null,s},flushMethodCache:function(){for(var e=0;e<this.methodCacheSize;e++)this.methodCache[e].selector=null,this.methodCache[e].method=null;return!0},flushMethodCacheForSelector:function(e){for(var t=0;t<this.methodCacheSize;t++)this.methodCache[t].selector===e&&(this.methodCache[t].selector=null,this.methodCache[t].method=null);return!0},flushMethodCacheForMethod:function(e){for(var t=0;t<this.methodCacheSize;t++)this.methodCache[t].method===e&&(this.methodCache[t].selector=null,this.methodCache[t].method=null);return!0},flushMethodCacheAfterBecome:function(e){this.flushMethodCache()}},"contexts",{isUnwindMarked:function(e){return!!this.isMethodContext(e)&&198==e.pointers[Squeak.Context_method].methodPrimitiveIndex()},newActiveContext:function(e){this.storeContextRegisters(),this.activeContext=e,this.activeContext.dirty=!0,this.fetchContextRegisters(e),this.breakOnContextChanged&&(this.breakOnContextChanged=!1,this.breakNow())},exportThisContext:function(){return this.storeContextRegisters(),this.reclaimableContextCount=0,this.activeContext},fetchContextRegisters:function(e){var t=e.pointers[Squeak.Context_method];this.isSmallInt(t)?(this.homeContext=e.pointers[Squeak.BlockContext_home],t=this.homeContext.pointers[Squeak.Context_method]):this.homeContext=e,this.receiver=this.homeContext.pointers[Squeak.Context_receiver],this.method=t,this.pc=this.decodeSqueakPC(e.pointers[Squeak.Context_instructionPointer],t),this.sp=this.decodeSqueakSP(e.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(e,t){return e+4*t.pointers.length+1},decodeSqueakPC:function(e,t){return e-4*t.pointers.length-1},encodeSqueakSP:function(e){return e-(Squeak.Context_tempFrameStart-1)},decodeSqueakSP:function(e){return e+(Squeak.Context_tempFrameStart-1)},recycleIfPossible:function(e){if(this.isMethodContext(e))if(e.pointersSize()===Squeak.Context_tempFrameStart+Squeak.Context_smallFrameSize)e.pointers[0]=this.freeContexts,this.freeContexts=e;else{if(e.pointersSize()!==Squeak.Context_tempFrameStart+Squeak.Context_largeFrameSize)return;e.pointers[0]=this.freeLargeContexts,this.freeLargeContexts=e}},allocateOrRecycleContext:function(e){var t;return e?this.freeLargeContexts.isNil?(this.nAllocatedContexts++,this.instantiateClass(this.specialObjects[Squeak.splOb_ClassMethodContext],Squeak.Context_largeFrameSize)):(t=this.freeLargeContexts,this.freeLargeContexts=t.pointers[0],this.nRecycledContexts++,t):this.freeContexts.isNil?(this.nAllocatedContexts++,this.instantiateClass(this.specialObjects[Squeak.splOb_ClassMethodContext],Squeak.Context_smallFrameSize)):(t=this.freeContexts,this.freeContexts=t.pointers[0],this.nRecycledContexts++,t)}},"stack access",{pop:function(){return this.activeContext.pointers[this.sp--]},popN:function(e){this.sp-=e},push:function(e){this.activeContext.pointers[++this.sp]=e},popNandPush:function(e,t){this.activeContext.pointers[this.sp-=e-1]=t},top:function(){return this.activeContext.pointers[this.sp]},stackTopPut:function(e){this.activeContext.pointers[this.sp]=e},stackValue:function(e){return this.activeContext.pointers[this.sp-e]},stackInteger:function(e){return this.checkSmallInt(this.stackValue(e))},stackIntOrFloat:function(e){var t=this.stackValue(e);if("number"==typeof t)return t;if(void 0===t)return this.success=!1,0;if(t.isFloat)return this.resultIsFloat=!0,t.float;var s=t.bytes;if(s&&4==s.length){for(var i=0,r=3;r>=0;r--)i=256*i+s[r];if(t.sqClass===this.specialObjects[Squeak.splOb_ClassLargePositiveInteger])return i;if(t.sqClass===this.specialObjects[Squeak.splOb_ClassLargeNegativeInteger])return-i}return this.success=!1,0},pop2AndPushIntResult:function(e){return!(!this.success||!this.canBeSmallInt(e))&&(this.popNandPush(2,e),!0)},pop2AndPushNumResult:function(e){if(this.success){if(this.resultIsFloat)return this.popNandPush(2,this.primHandler.makeFloat(e)),!0;if(e>=Squeak.MinSmallInt&&e<=Squeak.MaxSmallInt)return this.popNandPush(2,e),!0;if(e>=-4294967295&&e<=4294967295){var t=e<0,s=t?-e:e,i=t?Squeak.splOb_ClassLargeNegativeInteger:Squeak.splOb_ClassLargePositiveInteger,r=this.instantiateClass(this.specialObjects[i],4),n=r.bytes;return n[0]=255&s,n[1]=s>>8&255,n[2]=s>>16&255,n[3]=s>>24&255,this.popNandPush(2,r),!0}}return!1},pop2AndPushBoolResult:function(e){return!!this.success&&(this.popNandPush(2,e?this.trueObj:this.falseObj),!0)}},"numbers",{getClass:function(e){return this.isSmallInt(e)?this.specialObjects[Squeak.splOb_ClassInteger]:e.sqClass},canBeSmallInt:function(e){return e>=Squeak.MinSmallInt&&e<=Squeak.MaxSmallInt},isSmallInt:function(e){return"number"==typeof e},checkSmallInt:function(e){return"number"==typeof e?e:(this.success=!1,1)},quickDivide:function(e,t){if(0===t)return Squeak.NonSmallInt;var s=e/t|0;return s*t===e?s:Squeak.NonSmallInt},div:function(e,t){return 0===t?Squeak.NonSmallInt:Math.floor(e/t)},mod:function(e,t){return 0===t?Squeak.NonSmallInt:e-Math.floor(e/t)*t},safeShift:function(e,t){if(t<0)return t<-31?e<0?-1:0:e>>-t;if(t>31)return 0===e?0:Squeak.NonSmallInt;var s=e<<t;return s>>t!==e?Squeak.NonSmallInt:s}},"utils",{isContext:function(e){return e.sqClass===this.specialObjects[Squeak.splOb_ClassMethodContext]||e.sqClass===this.specialObjects[Squeak.splOb_ClassBlockContext]},isMethodContext:function(e){return e.sqClass===this.specialObjects[Squeak.splOb_ClassMethodContext]},instantiateClass:function(e,t){return this.image.instantiateClass(e,t,this.nilObj)},arrayFill:function(e,t,s,i){for(var r=t;r<s;r++)e[r]=i},arrayCopy:function(e,t,s,i,r){if(e===s&&t<i)for(var n=r-1;n>=0;n--)s[i+n]=e[t+n];else for(n=0;n<r;n++)s[i+n]=e[t+n]},signalLowSpaceIfNecessary:function(e){if(e<this.lowSpaceThreshold&&this.lowSpaceThreshold>0){var t=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(t){var s=1e6*parseInt(t,10);this.image.totalMemory+=s,this.signalLowSpaceIfNecessary(this.image.bytesLeft())}else{console.warn("squeak: low memory ("+e+"/"+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(e){return this.messages[e]?++this.messages[e]:this.messages[e]=1},warnOnce:function(e,t){if(1==this.addMessage(e))return console[t||"warn"](e),!0},printMethod:function(e,t,s,i){if(e.sqClass!=this.specialObjects[Squeak.splOb_ClassCompiledMethod])return this.printMethod(e.blockOuterCode(),t,s,i);var r;if(s){var n=t.className()+">>",a=s.bytesAsString();if(i&&i.length)for(var o=a.replace(/(:[a-zA-Z])/g,": $1").split(" :"),c=0;c<i.length;c++)c>0&&(n+=" "),n+=o[c]+" "+i[c];else n+=a;return n}return e||(e=this.activeContext.contextMethod()),this.allMethodsDo((function(t,s,i){if(s===e)return r=t.className()+">>"+i.bytesAsString()})),r||(t?"("+t.pointers[Squeak.Context_receiver]+")>>?":"?>>?")},allInstancesOf:function(e,t){"string"==typeof e&&(e=this.globalNamed(e));for(var s=[],i=this.image.someInstanceOf(e);i;)t?t(i):s.push(i),i=this.image.nextInstanceAfter(i);return s},globalNamed:function(e){return this.allGlobalsDo((function(t,s){if(t.bytesAsString()===e)return s}))},allGlobalsDo:function(e){for(var t=this.getGlobals(),s=0;s<t.length;s++){var i=t[s];if(!i.isNil){var r=e(i.pointers[0],i.pointers[1]);if(r)return r}}},allMethodsDo:function(e){this.allGlobalsDo((function(t,s){if(s.pointers&&s.pointers.length>=9)for(var i=[s,s.sqClass],r=0;r<i.length;r++){var n=i[r],a=n.pointers[1];if(a.pointers&&a.pointers[1]){var o=a.pointers[1].pointers;if(o){var c=a.pointers;if(o.length+2===c.length)for(var h=0;h<o.length;h++){var u=o[h],l=c[2+h];if(u.isMethod&&u.isMethod())if(l.bytesSize&&l.bytesSize())if(e.call(null,n,u,l))return!0}}}}}))},printStack:function(e,t,s){"number"==typeof e&&(t=e,e=null),e||(e=this.activeContext),t||(t=100);for(var i=[],r=Math.max(t,1e6);!e.isNil&&r-- >0;)i.push(e),e=e.pointers[Squeak.Context_sender];i.length>t+200&&(e.isNil||i.push("..."),i=i.slice(0,t).concat(["..."]).concat(i.slice(-200)));var n=[],a=i.length,o="";for(s&&this.logSends&&(o=Array((""+this.sendCount).length+2).join(" "));a-- >0;){if((e=i[a]).pointers){var c="",h=e.pointers[Squeak.Context_method];"number"==typeof h?(h=e.pointers[Squeak.BlockContext_home].pointers[Squeak.Context_method],c="[] in "):e.pointers[Squeak.Context_closure].isNil||(c="[] in ");var u=c+this.printMethod(h,e);s&&(u=o+u),n.push(u+"\n"),s&&(o+=s)}else n.push("...\n")}return n.join("")},findMethod:function(e){var t,s=e.split(">>")[0],i=e.split(">>")[1];return this.allMethodsDo((function(e,r,n){if(i.length==n.bytesSize()&&i==n.bytesAsString()&&s==e.className())return t=r})),t},breakAfter:function(e){this.breakOutTick=this.primHandler.millisecondClockValue()+e},breakNow:function(e){e&&console.log("Break: "+e),this.breakOutOfInterpreter="break"},breakOn:function(e){return this.breakOnMethod=e&&this.findMethod(e)},breakOnReturnFromThisContext:function(){this.breakOnContextChanged=!1,this.breakOnContextReturned=this.activeContext},breakOnSendOrReturn:function(){this.breakOnContextChanged=!0,this.breakOnContextReturned=null},printContext:function(e,t){if(!this.isContext(e))return"NOT A CONTEXT: "+s(e);function s(e){var s="number"==typeof e||"object"==typeof e?e.sqInstName():"<"+e+">";return(s=JSON.stringify(s).slice(1,-1)).length>t-3&&(s=s.slice(0,t-3)+"..."),s}t||(t=72);for(var i="number"==typeof e.pointers[Squeak.BlockContext_argumentCount],r=e.pointers[Squeak.Context_closure],n=!i&&!r.isNil,a=i?e.pointers[Squeak.BlockContext_home]:e,o=n?r.pointers[Squeak.Closure_numArgs]:a.pointers[Squeak.Context_method].methodTempCount(),c=this.decodeSqueakSP(0),h=a.contextSizeWithStack(this)-1,u=c+1,l=u+o-1,p=u+a.pointers[Squeak.Context_method].methodNumArgs()-1,m="",d=c;d<=h;d++){var f="";d===c?f="=rcvr":(d<=l&&(f="=tmp"+(d-u)),d<=p&&(f+="/arg"+(d-u))),m+="\nctx["+d+"]"+f+": "+s(a.pointers[d])}if(i){m+="\n";var v=e.pointers[Squeak.BlockContext_argumentCount],g=this.decodeSqueakSP(1),b=(p=g+v,e===this.activeContext?this.sp:e.pointers[Squeak.Context_stackPointer]);b<g&&(m+="\nblk <stack empty>");for(d=g;d<=b;d++){f="";d<p&&(f="=arg"+(d-g)),m+="\nblk["+d+"]"+f+": "+s(e.pointers[d])}}return m},printActiveContext:function(e){return this.printContext(this.activeContext,e)},printAllProcesses:function(){for(var e=this.specialObjects[Squeak.splOb_SchedulerAssociation].pointers[Squeak.Assn_value],t=e.pointers[Squeak.ProcSched_activeProcess],s="Active: "+this.printProcess(t,!0),i=e.pointers[Squeak.ProcSched_processLists].pointers,r=i.length-1;r>=0;r--)for(var n=i[r].pointers[Squeak.LinkedList_firstLink];!n.isNil;)s+="\n------------------------------------------",s+="\nRunnable: "+this.printProcess(n),n=n.pointers[Squeak.Link_nextLink];for(var a=this.specialObjects[Squeak.splOb_ClassSemaphore],o=this.image.someInstanceOf(a),c=[];o;){for(n=o.pointers[Squeak.LinkedList_firstLink];!n.isNil;)c.push(n),n=n.pointers[Squeak.Link_nextLink];o=this.image.nextInstanceAfter(o)}c.sort((function(e,t){return t.pointers[Squeak.Proc_priority]-e.pointers[Squeak.Proc_priority]}));for(var h=0;h<c.length;h++)s+="\n------------------------------------------",s+="\nWaiting: "+this.printProcess(c[h]);return s},printProcess:function(e,t,s){e||(e=this.specialObjects[Squeak.splOb_SchedulerAssociation].pointers[Squeak.Assn_value].pointers[Squeak.ProcSched_activeProcess],t=!0);var i=t?this.activeContext:e.pointers[Squeak.Proc_suspendedContext],r=e.pointers[Squeak.Proc_priority],n=this.printStack(i,20,s),a=s&&this.logSends?"":this.printContext(i)+"\n";return e.toString()+" at priority "+r+"\n"+n+a},printByteCodes:function(e,t,s,i){return e||(e=this.method),new Squeak.InstructionPrinter(e,this).printInstructions(t,s,i)},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 e=this.method.bytes[this.pc];if(this.method.methodSignFlag()){if(96<=e&&e<=127)s=this.specialSelectors[2*(e-96)];else if(128<=e&&e<=175)s=this.method.methodGetSelector(15&e);else if(234==e||235==e)this.method.methodGetSelector(this.method.bytes[this.pc+1]>>3);else if(88<=e&&e<=94)return!0}else{if(e>=120&&e<=125)return!0;if(e<131||200==e)return!1;if(e>=176)return!0;if(e<=134){var t;if(132===e){if(this.method.bytes[this.pc+1]>>5>1)return!1;t=this.method.bytes[this.pc+2]}else t=this.method.bytes[this.pc+1]&(134===e?63:31);var s=this.method.methodGetLiteral(t);if("blockCopy:"!==s.bytesAsString())return!0}}return!1},nextSendSelector:function(){var e,t=this.method.bytes[this.pc];if(this.method.methodSignFlag())if(96<=t&&t<=127)e=this.specialSelectors[2*(t-96)];else if(128<=t&&t<=175)e=this.method.methodGetSelector(15&t);else{if(234!=t&&235!=t)return null;this.method.methodGetSelector(this.method.bytes[this.pc+1]>>3)}else{if(t<131||200==t)return null;if(t>=208)e=this.method.methodGetLiteral(15&t);else if(t>=176)e=this.specialSelectors[2*(t-176)];else if(t<=134){var s;if(132===t){if(this.method.bytes[this.pc+1]>>5>1)return null;s=this.method.bytes[this.pc+2]}else s=this.method.bytes[this.pc+1]&(134===t?63:31);e=this.method.methodGetLiteral(s)}}if(e){var i=e.bytesAsString();if("blockCopy:"!==i)return i}}})),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(e){this.vm=e,this.remappableOops=[],Object.defineProperty(this,"successFlag",{get:function(){return e.primHandler.success},set:function(t){e.primHandler.success=t}})},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(e){this.successFlag=!1},success:function(e){e||(this.successFlag=!1)}},"stack access",{pop:function(e){this.vm.popN(e)},popthenPush:function(e,t){this.vm.popNandPush(e,t)},push:function(e){this.vm.push(e)},pushBool:function(e){this.vm.push(e?this.vm.trueObj:this.vm.falseObj)},pushInteger:function(e){this.vm.push(e)},pushFloat:function(e){this.vm.push(this.floatObjectOf(e))},stackValue:function(e){return this.vm.stackValue(e)},stackIntegerValue:function(e){var t=this.vm.stackValue(e);return"number"==typeof t?t:(this.successFlag=!1,0)},stackFloatValue:function(e){this.vm.success=!0;var t=this.vm.stackIntOrFloat(e);return this.vm.success?t:(this.successFlag=!1,0)},stackObjectValue:function(e){var t=this.vm.stackValue(e);return"number"!=typeof t?t:(this.successFlag=!1,this.vm.nilObj)},stackBytes:function(e){var t=this.vm.stackValue(e);return t.bytes?t.bytes:("number"!=typeof t&&t.isBytes()||(this.successFlag=!1),[])},stackWords:function(e){var t=this.vm.stackValue(e);return t.words?t.words:("number"!=typeof t&&t.isWords()||(this.successFlag=!1),[])},stackInt32Array:function(e){var t=this.vm.stackValue(e);return t.words?t.wordsAsInt32Array():("number"!=typeof t&&t.isWords()||(this.successFlag=!1),[])},stackInt16Array:function(e){var t=this.vm.stackValue(e);return t.words?t.wordsAsInt16Array():("number"!=typeof t&&t.isWords()||(this.successFlag=!1),[])},stackUint16Array:function(e){var t=this.vm.stackValue(e);return t.words?t.wordsAsUint16Array():("number"!=typeof t&&t.isWords()||(this.successFlag=!1),[])}},"object access",{isBytes:function(e){return"number"!=typeof e&&e.isBytes()},isWords:function(e){return"number"!=typeof e&&e.isWords()},isWordsOrBytes:function(e){return"number"!=typeof e&&e.isWordsOrBytes()},isPointers:function(e){return"number"!=typeof e&&e.isPointers()},isIntegerValue:function(e){return"number"==typeof e&&e>=-1073741824&&e<=1073741823},isArray:function(e){return e.sqClass===this.vm.specialObjects[Squeak.splOb_ClassArray]},isMemberOf:function(e,t){var s=e.sqClass.pointers[Squeak.Class_name].bytes;if(t.length!==s.length)return!1;for(var i=0;i<t.length;i++)if(t.charCodeAt(i)!==s[i])return!1;return!0},booleanValueOf:function(e){return!!e.isTrue||(e.isFalse||(this.successFlag=!1),!1)},positive32BitValueOf:function(e){return this.vm.primHandler.positive32BitValueOf(e)},positive32BitIntegerFor:function(e){return this.vm.primHandler.pos32BitIntFor(e)},floatValueOf:function(e){return e.isFloat?e.float:(this.successFlag=!1,0)},floatObjectOf:function(e){return this.vm.primHandler.makeFloat(e)},fetchPointerofObject:function(e,t){return t.pointers[e]},fetchBytesofObject:function(e,t){var s=t.pointers[e];return s.bytes?s.bytes:s.words?s.wordsAsUint8Array():("number"!=typeof s&&s.isWordsOrBytes()||(this.successFlag=!1),[])},fetchWordsofObject:function(e,t){var s=t.pointers[e];return s.words?s.words:("number"!=typeof s&&s.isWords()||(this.successFlag=!1),[])},fetchInt32ArrayofObject:function(e,t){var s=t.pointers[e];return s.words?s.wordsAsInt32Array():("number"!=typeof s&&s.isWords()||(this.successFlag=!1),[])},fetchInt16ArrayofObject:function(e,t){var s=t.pointers[e];return s.words?s.wordsAsInt16Array():("number"!=typeof s&&s.isWords()||(this.successFlag=!1),[])},fetchUint16ArrayofObject:function(e,t){var s=t.pointers[e];return s.words?s.wordsAsUint16Array():("number"!=typeof s&&s.isWords()||(this.successFlag=!1),[])},fetchIntegerofObject:function(e,t){var s=t.pointers[e];return"number"==typeof s?s:(this.successFlag=!1,0)},fetchLong32ofObject:function(e,t){return t.words[e]},fetchFloatofObject:function(e,t){return this.floatValueOf(t.pointers[e])},storeIntegerofObjectwithValue:function(e,t,s){"number"==typeof s?t.pointers[e]=s:this.successFlag=!1},storePointerofObjectwithValue:function(e,t,s){t.pointers[e]=s},stObjectatput:function(e,t,s){if(e.sqClass!==this.classArray())throw Error("Array expected");if(t<1||t>e.pointers.length)return this.successFlag=!1;e.pointers[t-1]=s}},"constant access",{isKindOfInteger:function(e){return"number"==typeof e||e.sqClass==this.classLargeNegativeInteger()||e.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(e){return this.vm.image.clone(e)},instantiateClassindexableSize:function(e,t){return this.vm.instantiateClass(e,t)},methodArgumentCount:function(){return this.argCount},makePointwithxValueyValue:function(e,t){return this.vm.primHandler.makePointWithXandY(e,t)},pushRemappableOop:function(e){this.remappableOops.push(e)},popRemappableOop:function(){return this.remappableOops.pop()},showDisplayBitsLeftTopRightBottom:function(e,t,s,i,r){if(t<i&&s<r){var n={left:t,top:s,right:i,bottom:r};this.vm.primHandler.displayDirty(e,n)}},ioLoadFunctionFrom:function(e,t){return this.vm.primHandler.loadFunctionFrom(e,t)}})),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(e,t){this.vm=t,this.method=e,this.pc=0,this.specialConstants=[t.trueObj,t.falseObj,t.nilObj,-1,0,1,2]}},"decoding",{interpretNextInstructionFor:function(e){var t=this.method,s=t.bytes[this.pc++],i=s/16|0,r=s%16;if(0===i)return e.pushReceiverVariable(r);if(1===i)return e.pushTemporaryVariable(r);if(2===i)return e.pushConstant(t.methodGetLiteral(r));if(3===i)return e.pushConstant(t.methodGetLiteral(r+16));if(4===i)return e.pushLiteralVariable(t.methodGetLiteral(r));if(5===i)return e.pushLiteralVariable(t.methodGetLiteral(r+16));if(6===i)return r<8?e.popIntoReceiverVariable(r):e.popIntoTemporaryVariable(r-8);if(7===i){if(0===r)return e.pushReceiver();if(r<8)return e.pushConstant(this.specialConstants[r-1]);if(8===r)return e.methodReturnReceiver();if(r<12)return e.methodReturnConstant(this.specialConstants[r-9]);if(12===r)return e.methodReturnTop();if(13===r)return e.blockReturnTop();if(r>13)throw Error("unusedBytecode")}return 8===i?this.interpretExtension(r,t,e):9===i?r<8?e.jump(r+1):e.jumpIf(!1,r-8+1):10===i?(s=this.method.bytes[this.pc++],r<8?e.jump(256*(r-4)+s):e.jumpIf(r<12,256*(3&r)+s)):11===i?e.send(this.vm.specialSelectors[2*r],this.vm.specialSelectors[2*r+1],!1):12===i?e.send(this.vm.specialSelectors[2*(r+16)],this.vm.specialSelectors[2*(r+16)+1],!1):i>12?e.send(t.methodGetLiteral(r),i-13,!1):void 0},interpretExtension:function(e,t,s){if(e<=6){var i=this.method.bytes[this.pc++];if(e<=2){var r=i/64|0,n=i%64;if(0===e){if(0===r)return s.pushReceiverVariable(n);if(1===r)return s.pushTemporaryVariable(n);if(2===r)return s.pushConstant(this.method.methodGetLiteral(n));if(3===r)return s.pushLiteralVariable(this.method.methodGetLiteral(n))}if(1===e){if(0===r)return s.storeIntoReceiverVariable(n);if(1===r)return s.storeIntoTemporaryVariable(n);if(2===r)throw Error("illegalStore");if(3===r)return s.storeIntoLiteralVariable(this.method.methodGetLiteral(n))}if(2===e){if(0===r)return s.popIntoReceiverVariable(n);if(1===r)return s.popIntoTemporaryVariable(n);if(2===r)throw Error("illegalStore");if(3===r)return s.popIntoLiteralVariable(this.method.methodGetLiteral(n))}}if(3===e)return s.send(this.method.methodGetLiteral(i%32),i/32|0,!1);if(4===e){var a=this.method.bytes[this.pc++];if(0===(r=i/32|0))return s.send(this.method.methodGetLiteral(a),i%32,!1);if(1===r)return s.send(this.method.methodGetLiteral(a),i%32,!0);if(2===r)return s.pushReceiverVariable(a);if(3===r)return s.pushConstant(this.method.methodGetLiteral(a));if(4===r)return s.pushLiteralVariable(this.method.methodGetLiteral(a));if(5===r)return s.storeIntoReceiverVariable(a);if(6===r)return s.popIntoReceiverVariable(a);if(7===r)return s.storeIntoLiteralVariable(this.method.methodGetLiteral(a))}if(5===e)return s.send(this.method.methodGetLiteral(31&i),i>>5,!0);if(6===e)return s.send(this.method.methodGetLiteral(63&i),i>>6,!1)}if(7===e)return s.doPop();if(8===e)return s.doDup();if(9===e)return s.pushActiveContext();i=this.method.bytes[this.pc++];if(10===e)return i<128?s.pushNewArray(i):s.popIntoNewArray(i-128);a=this.method.bytes[this.pc++];if(11===e)return s.callPrimitive(i+256*a);if(12===e)return s.pushRemoteTemp(i,a);if(13===e)return s.storeIntoRemoteTemp(i,a);if(14===e)return s.popIntoRemoteTemp(i,a);var o=this.method.bytes[this.pc++];return s.pushClosureCopy(i>>4,15&i,256*a+o)}})),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(e){return this.interpretNextInstructionExtFor(e,0,0)},interpretNextInstructionExtFor:function(e,t,s){this.Squeak;var i=this.method.bytes[this.pc++];switch(i){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 e.pushReceiverVariable(15&i);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 e.pushLiteralVariable(this.method.methodGetLiteral(15&i));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 e.pushConstant(this.method.methodGetLiteral(31&i));case 64:case 65:case 66:case 67:case 68:case 69:case 70:case 71:return e.pushTemporaryVariable(15&i);case 72:case 73:case 74:case 75:return e.pushTemporaryVariable(8+(3&i));case 76:return e.pushReceiver();case 77:return e.pushConstant(this.vm.trueObj);case 78:return e.pushConstant(this.vm.falseObj);case 79:return e.pushConstant(this.vm.nilObj);case 80:return e.pushConstant(0);case 81:return e.pushConstant(1);case 82:return e.pushActiveContext();case 83:return e.doDup();case 88:return e.methodReturnReceiver();case 89:return e.methodReturnConstant(this.vm.trueObj);case 90:return e.methodReturnConstant(this.vm.falseObj);case 91:return e.methodReturnConstant(this.vm.nilObj);case 92:return e.methodReturnTop();case 93:return e.blockReturnConstant(this.vm.nilObj);case 94:if(0===t)return e.blockReturnTop();break;case 95:return e.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 e.send(this.vm.specialSelectors[2*(i-96)],this.vm.specialSelectors[2*(i-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 e.send(this.method.methodGetLiteral(15&i),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 e.send(this.method.methodGetLiteral(15&i),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 e.send(this.method.methodGetLiteral(15&i),2,!1);case 176:case 177:case 178:case 179:case 180:case 181:case 182:case 183:return e.jump(1+(7&i));case 184:case 185:case 186:case 187:case 188:case 189:case 190:case 191:return e.jumpIf(!0,1+(7&i));case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:return e.jumpIf(!1,1+(7&i));case 200:case 201:case 202:case 203:case 204:case 205:case 206:case 207:return e.popIntoReceiverVariable(7&i);case 208:case 209:case 210:case 211:case 212:case 213:case 214:case 215:return e.popIntoTemporaryVariable(i-208);case 216:return e.doPop()}var r=this.method.bytes[this.pc++];switch(i){case 224:return this.interpretNextInstructionExtFor(e,(t<<8)+r,s);case 225:return this.interpretNextInstructionExtFor(e,t,(s<<8)+(r<128?r:r-256));case 226:return e.pushReceiverVariable(r+(t<<8));case 227:return e.pushLiteralVariable(this.method.methodGetLiteral(r+(t<<8)));case 228:return e.pushConstant(this.method.methodGetLiteral(r+(t<<8)));case 229:return e.pushTemporaryVariable(r);case 231:return r<128?e.pushNewArray(r):e.popIntoNewArray(r-128);case 232:return e.pushConstant(r+(s<<8));case 233:var n=r+(s<<8);return e.pushConstant("$"+String.fromCodePoint(n)+" ("+n+")");case 234:return e.send(this.method.methodGetSelector((r>>3)+(t<<5)),(7&r)+(s<<3),!1);case 235:var a=this.method.methodGetSelector((r>>3)+(t<<5));return s>=64?e.sendSuperDirected(a):e.send(a,(7&r)+(s<<3),!0);case 237:return e.jump(r+(s<<8));case 238:return e.jumpIf(!0,r+(s<<8));case 239:return e.jumpIf(!1,r+(s<<8));case 240:return e.popIntoReceiverVariable(r+(t<<8));case 241:return e.popIntoLiteralVariable(this.method.methodGetLiteral(r+(t<<8)));case 242:return e.popIntoTemporaryVariable(r);case 243:return e.storeIntoReceiverVariable(r+(t<<8));case 244:return e.storeIntoLiteralVariable(this.method.methodGetLiteral(r+(t<<8)));case 245:return e.storeIntoTemporaryVariable(r)}var o=this.method.bytes[this.pc++];switch(i){case 248:return e.callPrimitive(r+(o<<8));case 249:var c=r+(t<<8),h=63&o,u=this.method.methodGetLiteral(c);return e.pushFullClosure(c,h,u.methodNumArgs());case 250:var l=(7&r)+8*this.mod(t,16),p=(h=(r>>3&7)+8*this.div(t,16),o+(s<<8));return e.pushClosureCopy(h,l,p);case 251:return e.pushRemoteTemp(r,o);case 252:return e.storeIntoRemoteTemp(r,o);case 253:return e.popIntoRemoteTemp(r,o)}throw Error("Unknown bytecode: "+i)}})),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(e,t){this.method=e,this.vm=t}},"printing",{printInstructions:function(e,t,s){this.indent=e,this.highlight=t,this.highlightPC=s,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(e){this.print("!!! "+e.message)}return this.result},print:function(e){this.oldPC===this.highlightPC?this.highlight&&(this.result+=this.highlight):this.indent&&(this.result+=this.indent),this.result+=this.oldPC;for(var t=0;t<this.innerIndents[this.oldPC];t++)this.result+=" ";this.result+=" <";for(t=this.oldPC;t<this.scanner.pc;t++)t>this.oldPC&&(this.result+=" "),this.result+=(this.method.bytes[t]+256).toString(16).substr(-2).toUpperCase();this.result+="> "+e+"\n",this.oldPC=this.scanner.pc}},"decoding",{blockReturnConstant:function(e){this.print("blockReturn: "+e.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(e){this.print("jumpTo: "+(this.scanner.pc+e)),this.scanner.pc+e>this.endPC&&(this.endPC=this.scanner.pc+e)},jumpIf:function(e,t){this.print((e?"jumpIfTrue: ":"jumpIfFalse: ")+(this.scanner.pc+t)),this.scanner.pc+t>this.endPC&&(this.endPC=this.scanner.pc+t)},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(e){this.print("returnConst: "+e.toString()),this.done=this.scanner.pc>this.endPC},nop:function(){this.print("nop")},popIntoLiteralVariable:function(e){this.print("popIntoBinding: "+e.assnKeyAsString())},popIntoReceiverVariable:function(e){this.print("popIntoInstVar: "+e)},popIntoTemporaryVariable:function(e){this.print("popIntoTemp: "+e)},pushActiveContext:function(){this.print("push: thisContext")},pushConstant:function(e){var t=e.sqInstName?e.sqInstName():e.toString();this.print("pushConst: "+t)},pushLiteralVariable:function(e){this.print("pushBinding: "+e.assnKeyAsString())},pushReceiver:function(){this.print("push: self")},pushReceiverVariable:function(e){this.print("pushInstVar: "+e)},pushTemporaryVariable:function(e){this.print("pushTemp: "+e)},send:function(e,t,s){this.print((s?"superSend: #":"send: #")+(e.bytesAsString?e.bytesAsString():e))},sendSuperDirected:function(e){this.print("directedSuperSend: #"+(e.bytesAsString?e.bytesAsString():e))},storeIntoLiteralVariable:function(e){this.print("storeIntoBinding: "+e.assnKeyAsString())},storeIntoReceiverVariable:function(e){this.print("storeIntoInstVar: "+e)},storeIntoTemporaryVariable:function(e){this.print("storeIntoTemp: "+e)},pushNewArray:function(e){this.print("push: (Array new: "+e+")")},popIntoNewArray:function(e){this.print("pop: "+e+" into: (Array new: "+e+")")},pushRemoteTemp:function(e,t){this.print("push: "+e+" ofTemp: "+t)},storeIntoRemoteTemp:function(e,t){this.print("storeInto: "+e+" ofTemp: "+t)},popIntoRemoteTemp:function(e,t){this.print("popInto: "+e+" ofTemp: "+t)},pushClosureCopy:function(e,t,s){var i=this.scanner.pc,r=i+s;this.print("closure("+i+"-"+(r-1)+"): "+e+" copied, "+t+" args");for(var n=i;n<r;n++)this.innerIndents[n]=(this.innerIndents[n]||0)+1;r>this.endPC&&(this.endPC=r)},pushFullClosure:function(e,t,s){this.print("pushFullClosure: (self literalAt: "+(e+1)+") numCopied: "+t+" numArgs: "+s)},callPrimitive:function(e){this.print("primitive: "+e)}})),vm_instruction_printer}var vm_primitives={},hasRequiredVm_primitives;function requireVm_primitives(){return hasRequiredVm_primitives||(hasRequiredVm_primitives=1,Object.subclass("Squeak.Primitives","initialization",{initialize:function(e,t){this.vm=e,this.oldPrims=!this.vm.image.hasClosures,this.allowAccessBeyondSP=this.oldPrims,this.deferDisplayUpdates=!1,this.semaphoresToSignal=[],this.initDisplay(t),this.initAtCache(),this.initModules(),this.initPlugins(),e.image.isSpur&&(this.charFromInt=this.charFromIntSpur,this.charToInt=this.charToIntSpur,this.identityHash=this.identityHashSpur)},initDisplay:function(e){this.display=e},initModules:function(){this.loadedModules={},this.builtinModules={},this.patchModules={},this.interpreterProxy=new Squeak.InterpreterProxy(this.vm)},initPlugins:function(){}},"dispatch",{quickSendOther:function(e,t){switch(this.success=!0,t){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(e,t,s){switch(this.success=!0,e){case 1:return this.popNandPushIntIfOK(t+1,this.stackInteger(1)+this.stackInteger(0));case 2:return this.popNandPushIntIfOK(t+1,this.stackInteger(1)-this.stackInteger(0));case 3:return this.popNandPushBoolIfOK(t+1,this.stackInteger(1)<this.stackInteger(0));case 4:return this.popNandPushBoolIfOK(t+1,this.stackInteger(1)>this.stackInteger(0));case 5:return this.popNandPushBoolIfOK(t+1,this.stackInteger(1)<=this.stackInteger(0));case 6:return this.popNandPushBoolIfOK(t+1,this.stackInteger(1)>=this.stackInteger(0));case 7:return this.popNandPushBoolIfOK(t+1,this.stackInteger(1)===this.stackInteger(0));case 8:return this.popNandPushBoolIfOK(t+1,this.stackInteger(1)!==this.stackInteger(0));case 9:return this.popNandPushIntIfOK(t+1,this.stackInteger(1)*this.stackInteger(0));case 10:return this.popNandPushIntIfOK(t+1,this.vm.quickDivide(this.stackInteger(1),this.stackInteger(0)));case 11:return this.popNandPushIntIfOK(t+1,this.vm.mod(this.stackInteger(1),this.stackInteger(0)));case 12:return this.popNandPushIntIfOK(t+1,this.vm.div(this.stackInteger(1),this.stackInteger(0)));case 13:return this.popNandPushIntIfOK(t+1,this.stackInteger(1)/this.stackInteger(0)|0);case 14:return this.popNandPushIfOK(t+1,this.doBitAnd());case 15:return this.popNandPushIfOK(t+1,this.doBitOr());case 16:return this.popNandPushIfOK(t+1,this.doBitXor());case 17:return this.popNandPushIfOK(t+1,this.doBitShift());case 18:return this.primitiveMakePoint(t,!1);case 19:return!1;case 20:return this.primitiveRemLargeIntegers(t);case 21:return this.primitiveAddLargeIntegers(t);case 22:return this.primitiveSubtractLargeIntegers(t);case 23:return this.primitiveLessThanLargeIntegers(t);case 24:return this.primitiveGreaterThanLargeIntegers(t);case 25:return this.primitiveLessOrEqualLargeIntegers(t);case 26:return this.primitiveGreaterOrEqualLargeIntegers(t);case 27:return this.primitiveEqualLargeIntegers(t);case 28:return this.primitiveNotEqualLargeIntegers(t);case 29:return this.primitiveMultiplyLargeIntegers(t);case 30:return this.primitiveDivideLargeIntegers(t);case 31:return this.primitiveModLargeIntegers(t);case 32:return this.primitiveDivLargeIntegers(t);case 33:return this.primitiveQuoLargeIntegers(t);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(t+1,this.objectAt(!1,!1,!1));case 39:return this.popNandPushIfOK(t+1,this.objectAtPut(!1,!1,!1));case 40:return this.popNandPushFloatIfOK(t+1,this.stackInteger(0));case 41:return this.popNandPushFloatIfOK(t+1,this.stackFloat(1)+this.stackFloat(0));case 42:return this.popNandPushFloatIfOK(t+1,this.stackFloat(1)-this.stackFloat(0));case 43:return this.popNandPushBoolIfOK(t+1,this.stackFloat(1)<this.stackFloat(0));case 44:return this.popNandPushBoolIfOK(t+1,this.stackFloat(1)>this.stackFloat(0));case 45:return this.popNandPushBoolIfOK(t+1,this.stackFloat(1)<=this.stackFloat(0));case 46:return this.popNandPushBoolIfOK(t+1,this.stackFloat(1)>=this.stackFloat(0));case 47:return this.popNandPushBoolIfOK(t+1,this.stackFloat(1)===this.stackFloat(0));case 48:return this.popNandPushBoolIfOK(t+1,this.stackFloat(1)!==this.stackFloat(0));case 49:return this.popNandPushFloatIfOK(t+1,this.stackFloat(1)*this.stackFloat(0));case 50:return this.popNandPushFloatIfOK(t+1,this.safeFDiv(this.stackFloat(1),this.stackFloat(0)));case 51:return this.popNandPushIfOK(t+1,this.floatAsSmallInt(this.stackFloat(0)));case 52:return this.popNandPushFloatIfOK(t+1,this.floatFractionPart(this.stackFloat(0)));case 53:return this.popNandPushIntIfOK(t+1,this.frexp_exponent(this.stackFloat(0))-1);case 54:return this.popNandPushFloatIfOK(t+1,this.ldexp(this.stackFloat(1),this.stackFloat(0)));case 55:return this.popNandPushFloatIfOK(t+1,Math.sqrt(this.stackFloat(0)));case 56:return this.popNandPushFloatIfOK(t+1,Math.sin(this.stackFloat(0)));case 57:return this.popNandPushFloatIfOK(t+1,Math.atan(this.stackFloat(0)));case 58:return this.popNandPushFloatIfOK(t+1,Math.log(this.stackFloat(0)));case 59:return this.popNandPushFloatIfOK(t+1,Math.exp(this.stackFloat(0)));case 60:return this.popNandPushIfOK(t+1,this.objectAt(!1,!1,!1));case 61:return this.popNandPushIfOK(t+1,this.objectAtPut(!1,!1,!1));case 62:return this.popNandPushIfOK(t+1,this.objectSize(!1));case 63:return this.popNandPushIfOK(t+1,this.objectAt(!1,!0,!1));case 64:return this.popNandPushIfOK(t+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(t+1,this.objectAt(!1,!1,!0));case 69:return this.popNandPushIfOK(t+1,this.objectAtPut(!1,!1,!0));case 70:return this.popNandPushIfOK(t+1,this.instantiateClass(this.stackNonInteger(0),0));case 71:return this.popNandPushIfOK(t+1,this.instantiateClass(this.stackNonInteger(1),this.stackPos32BitInt(0)));case 72:return this.primitiveArrayBecome(t,!1,!0);case 73:return this.popNandPushIfOK(t+1,this.objectAt(!1,!1,!0));case 74:return this.popNandPushIfOK(t+1,this.objectAtPut(!1,!1,!0));case 75:return this.popNandPushIfOK(t+1,this.identityHash(this.stackNonInteger(0)));case 76:return this.primitiveStoreStackp(t);case 77:return this.popNandPushIfOK(t+1,this.someInstanceOf(this.stackNonInteger(0)));case 78:return this.popNandPushIfOK(t+1,this.nextInstanceAfter(this.stackNonInteger(0)));case 79:return this.primitiveNewMethod(t);case 80:return this.popNandPushIfOK(t+1,this.doBlockCopy());case 81:return this.primitiveBlockValue(t);case 82:return this.primitiveBlockValueWithArgs(t);case 83:return this.vm.primitivePerform(t);case 84:return this.vm.primitivePerformWithArgs(t,!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(t);case 91:return this.primitiveTestDisplayDepth(t);case 92:return this.vm.warnOnce("missing primitive: 92 (primitiveSetDisplayMode)"),!1;case 93:return this.primitiveInputSemaphore(t);case 94:return this.primitiveGetNextEvent(t);case 95:return this.primitiveInputWord(t);case 96:return this.namedPrimitive("BitBltPlugin","primitiveCopyBits",t);case 97:return this.primitiveSnapshot(t);case 98:return this.primitiveStoreImageSegment(t);case 99:return this.primitiveLoadImageSegment(t);case 100:return this.vm.primitivePerformWithArgs(t,!0);case 101:return this.primitiveBeCursor(t);case 102:return this.primitiveBeDisplay(t);case 103:return this.primitiveScanCharacters(t);case 104:return this.vm.warnOnce("missing primitive: 104 (primitiveDrawLoop)"),!1;case 105:return this.popNandPushIfOK(t+1,this.doStringReplace());case 106:return this.primitiveScreenSize(t);case 107:return this.primitiveMouseButtons(t);case 108:return this.primitiveKeyboardNext(t);case 109:return this.primitiveKeyboardPeek(t);case 110:return this.popNandPushBoolIfOK(t+1,this.vm.stackValue(1)===this.vm.stackValue(0));case 111:return this.popNandPushIfOK(t+1,this.vm.getClass(this.vm.top()));case 112:return this.popNandPushIfOK(t+1,this.vm.image.bytesLeft());case 113:return this.primitiveQuit(t);case 114:return this.primitiveExitToDebugger(t);case 115:return this.primitiveChangeClass(t);case 116:return this.vm.flushMethodCacheForMethod(this.vm.top());case 117:return this.doNamedPrimitive(t,s);case 118:return this.primitiveDoPrimitiveWithArgs(t);case 119:return this.vm.flushMethodCacheForSelector(this.vm.top());case 120:return this.primitiveCalloutToFFI(t,s);case 121:return this.primitiveImageName(t);case 122:return this.primitiveReverseDisplay(t);case 123:return this.vm.warnOnce("missing primitive: 123 (primitiveValueUninterruptably)"),!1;case 124:return this.popNandPushIfOK(t+1,this.registerSemaphore(Squeak.splOb_TheLowSpaceSemaphore));case 125:return this.popNandPushIfOK(t+1,this.setLowSpaceThreshold());case 126:return this.primitiveDeferDisplayUpdates(t);case 127:return this.primitiveShowDisplayRect(t);case 128:return this.primitiveArrayBecome(t,!0,!0);case 129:return this.popNandPushIfOK(t+1,this.vm.image.specialObjectsArray);case 130:return this.primitiveFullGC(t);case 131:return this.primitivePartialGC(t);case 132:return this.popNandPushBoolIfOK(t+1,this.pointsTo(this.stackNonInteger(1),this.vm.top()));case 133:return this.popNIfOK(t);case 134:return this.popNandPushIfOK(t+1,this.registerSemaphore(Squeak.splOb_TheInterruptSemaphore));case 135:return this.popNandPushIfOK(t+1,this.millisecondClockValue());case 136:return this.primitiveSignalAtMilliseconds(t);case 137:return this.popNandPushIfOK(t+1,this.secondClock());case 138:return this.popNandPushIfOK(t+1,this.someObject());case 139:return this.popNandPushIfOK(t+1,this.nextObject(this.vm.top()));case 140:return this.primitiveBeep(t);case 141:return this.primitiveClipboardText(t);case 142:return this.popNandPushIfOK(t+1,this.makeStString(this.filenameToSqueak(Squeak.vmPath)));case 143:case 144:return this.primitiveShortAtAndPut(t);case 145:return this.primitiveConstantFill(t);case 146:return this.namedPrimitive("JoystickTabletPlugin","primitiveReadJoystick",t);case 147:return this.namedPrimitive("BitBltPlugin","primitiveWarpBits",t);case 148:return this.popNandPushIfOK(t+1,this.vm.image.clone(this.vm.top()));case 149:return this.primitiveGetAttribute(t);case 150:if(this.oldPrims)return this.primitiveFileAtEnd(t);case 151:if(this.oldPrims)return this.primitiveFileClose(t);case 152:if(this.oldPrims)return this.primitiveFileGetPosition(t);case 153:if(this.oldPrims)return this.primitiveFileOpen(t);case 154:if(this.oldPrims)return this.primitiveFileRead(t);case 155:if(this.oldPrims)return this.primitiveFileSetPosition(t);case 156:if(this.oldPrims)return this.primitiveFileDelete(t);case 157:if(this.oldPrims)return this.primitiveFileSize(t);break;case 158:return this.oldPrims?this.primitiveFileWrite(t):(this.vm.warnOnce("missing primitive: 158 (primitiveCompareWith)"),!1);case 159:return this.oldPrims?this.primitiveFileRename(t):this.popNandPushIntIfOK(t+1,1664525*this.stackSigned53BitInt(0)&268435455);case 160:return this.oldPrims?this.primitiveDirectoryCreate(t):this.primitiveAdoptInstance(t);case 161:return this.oldPrims?this.primitiveDirectoryDelimitor(t):(this.vm.warnOnce("missing primitive: 161 (primitiveSetIdentityHash)"),!1);case 162:if(this.oldPrims)return this.primitiveDirectoryLookup(t);break;case 163:return this.oldPrims?this.primitiveDirectoryDelete(t):(this.vm.warnOnce("missing primitive: 163 (primitiveGetImmutability)"),!1);case 164:return this.popNandPushIfOK(t+1,this.vm.trueObj);case 165:case 166:return this.primitiveIntegerAtAndPut(t);case 167:return!1;case 168:return this.primitiveCopyObject(t);case 169:return this.oldPrims?this.primitiveDirectorySetMacTypeAndCreator(t):this.popNandPushBoolIfOK(t+1,this.vm.stackValue(1)!==this.vm.stackValue(0));case 170:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundStart",t):this.primitiveAsCharacter(t);case 171:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundStartWithSemaphore",t):this.popNandPushIfOK(t+1,this.stackNonInteger(0).hash);case 172:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundStop",t):(this.vm.warnOnce("missing primitive: 172 (primitiveFetchMourner)"),this.popNandPushIfOK(t,this.vm.nilObj));case 173:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundAvailableSpace",t):this.popNandPushIfOK(t+1,this.objectAt(!1,!1,!0));case 174:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundPlaySamples",t):this.popNandPushIfOK(t+1,this.objectAtPut(!1,!1,!0));case 175:return this.oldPrims?this.namedPrimitive("SoundPlugin","primitiveSoundPlaySilence",t):this.vm.image.isSpur?this.popNandPushIfOK(t+1,this.behaviorHash(this.stackNonInteger(0))):(this.vm.warnOnce("primitive 175 called in non-spur image"),this.popNandPushIfOK(t+1,this.identityHash(this.stackNonInteger(0))));case 176:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primWaveTableSoundmixSampleCountintostartingAtpan",t):this.popNandPushIfOK(t+1,this.vm.image.isSpur?4194303:4095);case 177:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primFMSoundmixSampleCountintostartingAtpan",t):this.popNandPushIfOK(t+1,this.allInstancesOf(this.stackNonInteger(0)));case 178:return!!this.oldPrims&&this.namedPrimitive("SoundGenerationPlugin","primPluckedSoundmixSampleCountintostartingAtpan",t);case 179:if(this.oldPrims)return this.namedPrimitive("SoundGenerationPlugin","primSampledSoundmixSampleCountintostartingAtpan",t);break;case 180:return!!this.oldPrims&&this.namedPrimitive("SoundGenerationPlugin","primitiveMixFMSound",t);case 181:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primitiveMixPluckedSound",t):this.primitiveSizeInBytesOfInstance(t);case 182:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","oldprimSampledSoundmixSampleCountintostartingAtleftVolrightVol",t):this.primitiveSizeInBytes(t);case 183:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primitiveApplyReverb",t):this.primitiveIsPinned(t);case 184:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primitiveMixLoopedSampledSound",t):this.primitivePin(t);case 185:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primitiveMixSampledSound",t):this.primitiveExitCriticalSection(t);case 186:if(this.oldPrims)break;return this.primitiveEnterCriticalSection(t);case 187:if(this.oldPrims)break;return this.primitiveTestAndSetOwnershipOfCriticalSection(t);case 188:if(this.oldPrims)break;return this.primitiveExecuteMethodArgsArray(t);case 189:return!!this.oldPrims&&this.namedPrimitive("SoundPlugin","primitiveSoundInsertSamples",t);case 190:if(this.oldPrims)return this.namedPrimitive("SoundPlugin","primitiveSoundStartRecording",t);case 191:if(this.oldPrims)return this.namedPrimitive("SoundPlugin","primitiveSoundStopRecording",t);case 192:if(this.oldPrims)return this.namedPrimitive("SoundPlugin","primitiveSoundGetRecordingSampleRate",t);case 193:if(this.oldPrims)return this.namedPrimitive("SoundPlugin","primitiveSoundRecordSamples",t);case 194:if(this.oldPrims)return this.namedPrimitive("SoundPlugin","primitiveSoundSetRecordLevel",t);break;case 195:case 196:case 197:case 198:case 199:return!1;case 200:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveInitializeNetwork",t):this.primitiveClosureCopyWithCopiedValues(t);case 201:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverStartNameLookup",t):this.primitiveClosureValue(t);case 202:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverNameLookupResult",t):this.primitiveClosureValue(t);case 203:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverStartAddressLookup",t):this.primitiveClosureValue(t);case 204:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverAddressLookupResult",t):this.primitiveClosureValue(t);case 205:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverAbortLookup",t):this.primitiveClosureValue(t);case 206:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverLocalAddress",t):this.primitiveClosureValueWithArgs(t);case 207:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverStatus",t):this.primitiveFullClosureValue(t);case 208:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveResolverError",t):this.primitiveFullClosureValueWithArgs(t);case 209:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketCreate",t):this.primitiveFullClosureValueNoContextSwitch(t);case 210:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketDestroy",t):this.popNandPushIfOK(t+1,this.objectAt(!1,!1,!1));case 211:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketConnectionStatus",t):this.popNandPushIfOK(t+1,this.objectAtPut(!1,!1,!1));case 212:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketError",t):this.popNandPushIfOK(t+1,this.objectSize(!1));case 213:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketLocalAddress",t);case 214:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketLocalPort",t);case 215:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketRemoteAddress",t);case 216:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketRemotePort",t);case 217:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketConnectToPort",t);case 218:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketListenWithOrWithoutBacklog",t):this.primitiveDoNamedPrimitive(t);case 219:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketCloseConnection",t);case 220:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketAbortConnection",t);break;case 221:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketReceiveDataBufCount",t):this.primitiveClosureValueNoContextSwitch(t);case 222:return this.oldPrims?this.namedPrimitive("SocketPlugin","primitiveSocketReceiveDataAvailable",t):this.primitiveClosureValueNoContextSwitch(t);case 223:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketSendDataBufCount",t);case 224:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketSendDone",t);case 225:if(this.oldPrims)return this.namedPrimitive("SocketPlugin","primitiveSocketAccept",t);break;case 230:return this.primitiveRelinquishProcessorForMicroseconds(t);case 231:return this.primitiveForceDisplayUpdate(t);case 232:return this.vm.warnOnce("missing primitive: 232 (primitiveFormPrint)"),!1;case 233:return this.primitiveSetFullScreen(t);case 234:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveDecompressFromByteArray",t);case 235:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveCompareString",t);case 236:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveConvert8BitSigned",t);case 237:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveCompressToByteArray",t);break;case 238:return this.oldPrims?this.namedPrimitive("SerialPlugin","primitiveSerialPortOpen",t):this.namedPrimitive("FloatArrayPlugin","primitiveAt",t);case 239:return this.oldPrims?this.namedPrimitive("SerialPlugin","primitiveSerialPortClose",t):this.namedPrimitive("FloatArrayPlugin","primitiveAtPut",t);case 240:return this.oldPrims?this.namedPrimitive("SerialPlugin","primitiveSerialPortWrite",t):this.popNandPushIfOK(t+1,this.microsecondClockUTC());case 241:return this.oldPrims?this.namedPrimitive("SerialPlugin","primitiveSerialPortRead",t):this.popNandPushIfOK(t+1,this.microsecondClockLocal());case 242:if(this.oldPrims)break;return this.primitiveSignalAtUTCMicroseconds(t);case 243:return this.oldPrims?this.namedPrimitive("MiscPrimitivePlugin","primitiveTranslateStringWithTable",t):(this.vm.warnOnce("missing primitive: 243 (primitiveUpdateTimeZone)"),!1);case 244:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveFindFirstInString",t);case 245:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveIndexOfAsciiInString",t);case 246:if(this.oldPrims)return this.namedPrimitive("MiscPrimitivePlugin","primitiveFindSubstring",t);break;case 248:return this.primitiveArrayBecome(t,!1,!1);case 249:return this.primitiveArrayBecome(t,!1,!0);case 254:return this.primitiveVMParameter(t);case 521:return this.namedPrimitive("MIDIPlugin","primitiveMIDIClosePort",t);case 522:return this.namedPrimitive("MIDIPlugin","primitiveMIDIGetClock",t);case 523:return this.namedPrimitive("MIDIPlugin","primitiveMIDIGetPortCount",t);case 524:return this.namedPrimitive("MIDIPlugin","primitiveMIDIGetPortDirectionality",t);case 525:return this.namedPrimitive("MIDIPlugin","primitiveMIDIGetPortName",t);case 526:return this.namedPrimitive("MIDIPlugin","primitiveMIDIOpenPort",t);case 527:return this.namedPrimitive("MIDIPlugin","primitiveMIDIParameterGetOrSet",t);case 528:return this.namedPrimitive("MIDIPlugin","primitiveMIDIRead",t);case 529:return this.namedPrimitive("MIDIPlugin","primitiveMIDIWrite",t);case 550:return this.namedPrimitive("ADPCMCodecPlugin","primitiveDecodeMono",t);case 551:return this.namedPrimitive("ADPCMCodecPlugin","primitiveDecodeStereo",t);case 552:return this.namedPrimitive("ADPCMCodecPlugin","primitiveEncodeMono",t);case 553:return this.namedPrimitive("ADPCMCodecPlugin","primitiveEncodeStereo",t);case 571:return this.primitiveUnloadModule(t);case 572:return this.primitiveListBuiltinModule(t);case 573:return this.primitiveListLoadedModule(t);case 575:return this.vm.warnOnce("missing primitive: 575 (primitiveHighBit)"),!1;case 576:return this.vm.primitiveInvokeObjectAsMethod(t,s);case 578:return this.vm.warnOnce("missing primitive: 578 (primitiveSuspendAndBackupPC)"),!1}return console.error("primitive "+e+" not implemented yet"),!1},namedPrimitive:function(e,t,s){var i=""===e?this:this.loadedModules[e],r=!1;void 0===i&&(i=this.loadModule(e),this.loadedModules[e]=i,r=!0);var n=!1,a=this.vm.sp;if(i){this.interpreterProxy.argCount=s,this.interpreterProxy.primitiveName=t;var o=i[t];"function"==typeof o?n=i[t](s):"string"==typeof o?n=this[o](s):this.vm.warnOnce("missing primitive: "+e+"."+t)}else r&&(this.success?this.vm.warnOnce("missing module: "+e+" ("+t+")"):this.vm.warnOnce("failed to load module: "+e+" ("+t+")"));return(!0===n||!1!==n&&this.success)&&this.vm.sp!==a-s&&!this.vm.frozen&&this.vm.warnOnce("stack unbalanced after primitive "+e+"."+t,"error"),!0===n||!1===n?n:this.success},doNamedPrimitive:function(e,t){if(!t.primFunction){if(t.pointersSize()<2)return!1;if(4!==(a=t.pointers[1]).pointersSize())return!1;this.primMethod=t;var s=a.pointers[0].bytesAsString(),i=a.pointers[1].bytesAsString();if(t.primFunction=this.loadFunctionFrom(i,s),!t.primFunction)return!1}this.interpreterProxy.argCount=e;var r=this.vm.sp,n=t.primFunction(e);if((!0===n||!1!==n&&this.success)&&this.vm.sp!==r-e&&!this.vm.frozen){var a;s=(a=t.pointers[1]).pointers[0].bytesAsString(),i=a.pointers[1].bytesAsString();this.vm.warnOnce("stack unbalanced after primitive "+s+"."+i,"error")}return!0===n||!1===n?n:this.success},fakePrimitive:function(e,t,s){return this.vm.warnOnce("faking primitive: "+e),void 0===t?this.vm.popN(s):this.vm.popNandPush(s+1,this.makeStObject(t)),!0}},"modules",{loadModule:function(e){var t=Squeak.externalModules[e]||this.builtinModules[e]||this.loadModuleDynamically(e);if(!t)return null;if(this.patchModules[e]&&this.patchModule(t,e),t.setInterpreter&&!t.setInterpreter(this.interpreterProxy))return console.log("Wrong interpreter proxy version: "+e),null;var s=t.initialiseModule;return"function"==typeof s?t.initialiseModule():"string"==typeof s&&this[s](),this.interpreterProxy.failed()?(console.log("Module initialization failed: "+e),null):(t.getModuleName&&(e=t.getModuleName()),console.log("Loaded module: "+e),t)},loadModuleDynamically:function(e){},patchModule:function(e,t){var s=this.patchModules[t];for(var i in s)e[i]=s[i]},unloadModule:function(e){var t=this.loadedModules[e];if(!e||!t||t===this)return null;delete this.loadedModules[e];var s=t.unloadModule;return"function"==typeof s?t.unloadModule(this):"string"==typeof s&&this[s](this),console.log("Unloaded module: "+e),t},loadFunctionFrom:function(e,t){var s=""===t?this:this.loadedModules[t];if(void 0===s&&(s=this.loadModule(t),this.loadedModules[t]=s),!s)return null;var i=s[e];return"function"==typeof i?i.bind(s):"string"==typeof i?this[i].bind(this):(this.vm.warnOnce("missing primitive: "+t+"."+e),null)},primitiveUnloadModule:function(e){var t=this.stackNonInteger(0).bytesAsString();return!!t&&(this.unloadModule(t),this.popNIfOK(e))},primitiveListBuiltinModule:function(e){var t=this.stackInteger(0)-1;if(!this.success)return!1;var s=Object.keys(this.builtinModules);return this.popNandPushIfOK(e+1,this.makeStObject(s[t]))},primitiveListLoadedModule:function(e){var t=this.stackInteger(0)-1;if(!this.success)return!1;var s=[];for(var i in this.loadedModules){var r=this.loadedModules[i];if(r){var n=r.getModuleName?r.getModuleName():i;s.push(n)}}return this.popNandPushIfOK(e+1,this.makeStObject(s[t]))}},"stack access",{popNIfOK:function(e){return!!this.success&&(this.vm.popN(e),!0)},pop2andPushBoolIfOK:function(e){return this.vm.success=this.success,this.vm.pop2AndPushBoolResult(e)},popNandPushBoolIfOK:function(e,t){return!!this.success&&(this.vm.popNandPush(e,t?this.vm.trueObj:this.vm.falseObj),!0)},popNandPushIfOK:function(e,t){return!(!this.success||null==t)&&(this.vm.popNandPush(e,t),!0)},popNandPushIntIfOK:function(e,t){return!(!this.success||!this.vm.canBeSmallInt(t))&&(this.vm.popNandPush(e,t),!0)},popNandPushFloatIfOK:function(e,t){return!!this.success&&(this.vm.popNandPush(e,this.makeFloat(t)),!0)},stackNonInteger:function(e){return this.checkNonInteger(this.vm.stackValue(e))},stackInteger:function(e){return this.checkSmallInt(this.vm.stackValue(e))},stackPos32BitInt:function(e){return this.positive32BitValueOf(this.vm.stackValue(e))},pos32BitIntFor:function(e){if(e>=0&&e<=Squeak.MaxSmallInt)return e;for(var t=this.vm.specialObjects[Squeak.splOb_ClassLargePositiveInteger],s=this.vm.instantiateClass(t,4),i=s.bytes,r=0;r<4;r++)i[r]=e>>>8*r&255;return s},pos53BitIntFor:function(e){if(e<=4294967295)return this.pos32BitIntFor(e);if(e>9007199254740991)return console.warn("Out of range: pos53BitIntFor("+e+")"),this.success=!1,0;for(var t=e<=0xffffffffff?5:e<=0xffffffffffff?6:7,s=this.vm.specialObjects[Squeak.splOb_ClassLargePositiveInteger],i=this.vm.instantiateClass(s,t),r=i.bytes,n=0;n<t;n++)r[n]=255&e,e/=256;return i},stackSigned32BitInt:function(e){var t=this.vm.stackValue(e);if("number"==typeof t)return t;if(4!==t.bytesSize())return this.success=!1,0;for(var s=t.bytes,i=0,r=0,n=1;r<4;r++,n*=256)i+=s[r]*n;return this.isA(t,Squeak.splOb_ClassLargePositiveInteger)&&i<=2147483647?i:this.isA(t,Squeak.splOb_ClassLargeNegativeInteger)&&-i>=-2147483648?-i:(this.success=!1,0)},signed32BitIntegerFor:function(e){if(e>=Squeak.MinSmallInt&&e<=Squeak.MaxSmallInt)return e;for(var t=e<0,s=t?-e:e,i=t?Squeak.splOb_ClassLargeNegativeInteger:Squeak.splOb_ClassLargePositiveInteger,r=this.vm.instantiateClass(this.vm.specialObjects[i],4),n=r.bytes,a=0;a<4;a++)n[a]=s>>>8*a&255;return r},stackFloat:function(e){return this.checkFloat(this.vm.stackValue(e))},stackBoolean:function(e){return this.checkBoolean(this.vm.stackValue(e))},stackSigned53BitInt:function(e){var t=this.vm.stackValue(e);if("number"==typeof t)return t;var s=t.bytesSize();if(s<=7){for(var i=t.bytes,r=0,n=0,a=1;n<s;n++,a*=256)r+=i[n]*a;if(r<=9007199254740991){if(this.isA(t,Squeak.splOb_ClassLargePositiveInteger))return r;if(this.isA(t,Squeak.splOb_ClassLargeNegativeInteger))return-r}}return this.success=!1,0}},"numbers",{doBitAnd:function(){var e=this.stackPos32BitInt(1),t=this.stackPos32BitInt(0);return this.success?this.pos32BitIntFor(e&t):0},doBitOr:function(){var e=this.stackPos32BitInt(1),t=this.stackPos32BitInt(0);return this.success?this.pos32BitIntFor(e|t):0},doBitXor:function(){var e=this.stackPos32BitInt(1),t=this.stackPos32BitInt(0);return this.success?this.pos32BitIntFor(e^t):0},doBitShift:function(){var e,t=this.stackPos32BitInt(1),s=this.stackInteger(0);if(!this.success)return 0;if(s<0){if(s<-31)return 0;e=t>>>-s}else{if(s>31)return this.success=!1,0;if((e=t<<s)>>>s!==t)return this.success=!1,0}return this.pos32BitIntFor(e)},safeFDiv:function(e,t){return 0===t?(this.success=!1,1):e/t},floatAsSmallInt:function(e){var t=e>=0?Math.floor(e):Math.ceil(e);return this.ensureSmallInt(t)},floatFractionPart:function(e){return-9007199254740991<=e&&e<=9007199254740991?e-Math.floor(e):(this.success=!1,0)},frexp_exponent:function(e){if(0==e)return 0;var t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);var s=t.getUint32(0)>>>20&2047;return 0===s&&(t.setFloat64(0,e*Math.pow(2,64)),s=(t.getUint32(0)>>>20&2047)-64),s-1022},ldexp:function(e,t){for(var s=Math.min(3,Math.ceil(Math.abs(t)/1023)),i=e,r=0;r<s;r++)i*=Math.pow(2,Math.floor((t+r)/s));return i},primitiveRemLargeIntegers:function(e){return this.popNandPushIfOK(e+1,this.makeStObject(this.stackSigned53BitInt(1)%this.stackSigned53BitInt(0)))},primitiveAddLargeIntegers:function(e){return this.popNandPushIfOK(e+1,this.makeStObject(this.stackSigned53BitInt(1)+this.stackSigned53BitInt(0)))},primitiveSubtractLargeIntegers:function(e){return this.popNandPushIfOK(e+1,this.makeStObject(this.stackSigned53BitInt(1)-this.stackSigned53BitInt(0)))},primitiveLessThanLargeIntegers:function(e){return this.popNandPushBoolIfOK(e+1,this.stackSigned53BitInt(1)<this.stackSigned53BitInt(0))},primitiveGreaterThanLargeIntegers:function(e){return this.popNandPushBoolIfOK(e+1,this.stackSigned53BitInt(1)>this.stackSigned53BitInt(0))},primitiveLessOrEqualLargeIntegers:function(e){return this.popNandPushBoolIfOK(e+1,this.stackSigned53BitInt(1)<=this.stackSigned53BitInt(0))},primitiveGreaterOrEqualLargeIntegers:function(e){return this.popNandPushBoolIfOK(e+1,this.stackSigned53BitInt(1)>=this.stackSigned53BitInt(0))},primitiveEqualLargeIntegers:function(e){return this.popNandPushBoolIfOK(e+1,this.stackSigned53BitInt(1)===this.stackSigned53BitInt(0))},primitiveNotEqualLargeIntegers:function(e){return this.popNandPushBoolIfOK(e+1,this.stackSigned53BitInt(1)!==this.stackSigned53BitInt(0))},primitiveMultiplyLargeIntegers:function(e){return this.popNandPushIfOK(e+1,this.makeStObject(this.stackSigned53BitInt(1)*this.stackSigned53BitInt(0)))},primitiveDivideLargeIntegers:function(e){return this.popNandPushIfOK(e+1,this.makeStObject(this.stackSigned53BitInt(1)/this.stackSigned53BitInt(0)))},primitiveModLargeIntegers:function(e){return this.popNandPushIfOK(e+1,this.makeStObject(Math.floor(this.stackSigned53BitInt(1)%this.stackSigned53BitInt(0))))},primitiveDivLargeIntegers:function(e){return this.popNandPushIfOK(e+1,this.makeStObject(Math.floor(this.stackSigned53BitInt(1)/this.stackSigned53BitInt(0))))},primitiveQuoLargeIntegers:function(e){return this.popNandPushIfOK(e+1,this.makeStObject(Math.trunc(this.stackSigned53BitInt(1)/this.stackSigned53BitInt(0))))}},"utils",{floatOrInt:function(e){return e.isFloat?e.float:"number"==typeof e?e:0},positive32BitValueOf:function(e){if("number"==typeof e)return e>=0?e:(this.success=!1,0);if(!this.isA(e,Squeak.splOb_ClassLargePositiveInteger)||4!==e.bytesSize())return this.success=!1,0;for(var t=e.bytes,s=0,i=0,r=1;i<4;i++,r*=256)s+=t[i]*r;return s},checkFloat:function(e){return e.isFloat?e.float:"number"==typeof e?e:(this.success=!1,0)},checkSmallInt:function(e){return"number"==typeof e?e:(this.success=!1,0)},checkNonInteger:function(e){return"number"!=typeof e?e:(this.success=!1,this.vm.nilObj)},checkBoolean:function(e){return!!e.isTrue||!e.isFalse&&(this.success=!1)},indexableSize:function(e){return"number"==typeof e?-1:e.indexableSize(this)},isA:function(e,t){return e.sqClass===this.vm.specialObjects[t]},isKindOf:function(e,t){for(var s=e.sqClass,i=this.vm.specialObjects[t];!s.isNil;){if(s===i)return!0;s=s.pointers[Squeak.Class_superclass]}return!1},isAssociation:function(e){return"number"!=typeof e&&2==e.pointersSize()},ensureSmallInt:function(e){return e===(0|e)&&this.vm.canBeSmallInt(e)?e:(this.success=!1,0)},charFromInt:function(e){var t=this.vm.specialObjects[Squeak.splOb_CharacterTable].pointers[e];if(t)return t;var s=this.vm.specialObjects[Squeak.splOb_ClassCharacter];return(t=this.vm.instantiateClass(s,0)).pointers[0]=e,t},charFromIntSpur:function(e){return this.vm.image.getCharacter(e)},charToInt:function(e){return e.pointers[0]},charToIntSpur:function(e){return e.hash},makeFloat:function(e){var t=this.vm.specialObjects[Squeak.splOb_ClassFloat],s=this.vm.instantiateClass(t,2);return s.float=e,s},makeLargeIfNeeded:function(e){return this.vm.canBeSmallInt(e)?e:this.makeLargeInt(e)},makeLargeInt:function(e){if(e<0)throw Error("negative large ints not implemented yet");if(e>4294967295)throw Error("large large ints not implemented yet");return this.pos32BitIntFor(e)},makePointWithXandY:function(e,t){var s=this.vm.specialObjects[Squeak.splOb_ClassPoint],i=this.vm.instantiateClass(s,0);return i.pointers[Squeak.Point_x]=e,i.pointers[Squeak.Point_y]=t,i},makeStArray:function(e,t){for(var s=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassArray],e.length),i=0;i<e.length;i++)s.pointers[i]=this.makeStObject(e[i],t);return s},makeStByteArray:function(e){for(var t=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassByteArray],e.length),s=0;s<e.length;s++)t.bytes[s]=255&e[s];return t},makeStString:function(e){for(var t=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassString],e.length),s=0;s<e.length;++s)t.bytes[s]=255&e.charCodeAt(s);return t},makeStStringFromBytes:function(e,t){var s=e.length;t&&(s=e.indexOf(0))<0&&(s=e.length);for(var i=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassString],s),r=0;r<s;++r)i.bytes[r]=e[r];return i},makeStObject:function(e,t){if(null==e)return this.vm.nilObj;if(!0===e)return this.vm.trueObj;if(!1===e)return this.vm.falseObj;if(e.sqClass)return e;if("number"==typeof e)return e===(0|e)?this.makeLargeIfNeeded(e):this.makeFloat(e);if(t){var s=this.vm.instantiateClass(t,0);return s.jsObject=e,s}if("string"==typeof e||"Uint8Array"===e.constructor.name)return this.makeStString(e);if("Array"===e.constructor.name)return this.makeStArray(e);throw Error("cannot make smalltalk object")},pointsTo:function(e,t){return!!e.pointers&&e.pointers.indexOf(t)>=0},asUint8Array:function(e){if("Uint8Array"===e.constructor.name)return e;if("ArrayBuffer"===e.constructor.name)return new Uint8Array(e);if("string"==typeof e){for(var t=new Uint8Array(e.length),s=0;s<e.length;s++)t[s]=e.charCodeAt(s);return t}throw Error("unknown buffer type")},filenameToSqueak:function(e){var t="/SqueakJS"+("/"!==e[0]?"/":"")+e;return this.emulateMac&&(t=("Macintosh HD"+t).replace(/\//g,"€").replace(/:/g,"/").replace(/€/g,":")),t},filenameFromSqueak:function(e){var t=this.emulateMac?e.replace(/^[^:]*:/,":").replace(/\//g,"€").replace(/:/g,"/").replace(/€/g,":"):e;return t=t.replace(/^\/*SqueakJS\/?/,"/")}},"indexing",{objectAt:function(e,t,s){var i,r=this.stackNonInteger(1),n=this.stackPos32BitInt(0);if(!this.success)return r;if(e){if((i=this.atCache[r.hash&this.atCacheMask]).array!==r)return this.success=!1,r}else{if(r.isFloat){var a=r.floatData();return 1==n?this.pos32BitIntFor(a.getUint32(0,!1)):2==n?this.pos32BitIntFor(a.getUint32(4,!1)):(this.success=!1,r)}i=this.makeAtCacheInfo(this.atCache,this.vm.specialSelectors[32],r,t,s)}if(n<1||n>i.size)return this.success=!1,r;if(s)return r.pointers[n-1];if(r.isPointers())return r.pointers[n-1+i.ivarOffset];if(r.isWords())return i.convertChars?this.charFromInt(1073741823&r.words[n-1]):this.pos32BitIntFor(r.words[n-1]);if(r.isBytes())return i.convertChars?this.charFromInt(255&r.bytes[n-1]):255&r.bytes[n-1];var o=4*r.pointersSize();return n-1-o<0?(this.success=!1,r):255&r.bytes[n-1-o]},objectAtPut:function(e,t,s){var i,r=this.stackNonInteger(2),n=this.stackPos32BitInt(1);if(!this.success)return r;if(e){if((i=this.atPutCache[r.hash&this.atCacheMask]).array!==r)return this.success=!1,r}else{if(r.isFloat){var a=this.stackPos32BitInt(0);if(!this.success||1!=n&&2!=n)this.success=!1;else{var o=r.floatData();o.setUint32(1==n?0:4,a,!1),r.float=o.getFloat64(0)}return this.vm.stackValue(0)}i=this.makeAtCacheInfo(this.atPutCache,this.vm.specialSelectors[34],r,t,s)}if(n<1||n>i.size)return this.success=!1,r;var c,h=this.vm.stackValue(0);if(s)return r.dirty=!0,r.pointers[n-1]=h;if(r.isPointers())return r.dirty=!0,r.pointers[n-1+i.ivarOffset]=h;if(r.isWords()){if(t){if(h.sqClass!==this.vm.specialObjects[Squeak.splOb_ClassCharacter])return this.success=!1,h;if("number"!=typeof(c=this.charToInt(h)))return this.success=!1,h}else c=this.stackPos32BitInt(0);return this.success&&(r.words[n-1]=c),h}if(t){if(h.sqClass!==this.vm.specialObjects[Squeak.splOb_ClassCharacter])return this.success=!1,h;if("number"!=typeof(c=this.charToInt(h)))return this.success=!1,h}else{if("number"!=typeof h)return this.success=!1,h;c=h}if(c<0||c>255)return this.success=!1,h;if(r.isBytes())return r.bytes[n-1]=c,h;var u=4*r.pointersSize();return n-1-u<0?(this.success=!1,r):(r.bytes[n-1-u]=c,h)},objectSize:function(e){var t=this.vm.stackValue(0),s=-1;return e?t.sqClass===this.vm.specialObjects[Squeak.splOb_ClassArray]?s=t.pointersSize():t.sqClass===this.vm.specialObjects[Squeak.splOb_ClassString]&&(s=t.bytesSize()):s=this.indexableSize(t),-1===s?(this.success=!1,-1):this.pos32BitIntFor(s)},initAtCache:function(){this.atCacheSize=32,this.atCacheMask=this.atCacheSize-1,this.atCache=[],this.atPutCache=[],this.nonCachedInfo={};for(var e=0;e<this.atCacheSize;e++)this.atCache.push({}),this.atPutCache.push({})},makeAtCacheInfo:function(e,t,s,i,r){var n;return(n=this.vm.verifyAtSelector===t&&this.vm.verifyAtClass===s.sqClass&&!this.vm.isContext(s)?e[s.hash&this.atCacheMask]:this.nonCachedInfo).array=s,n.convertChars=i,r?(n.size=s.instSize()+Math.max(0,s.indexableSize(this)),n.ivarOffset=0):(n.size=s.indexableSize(this),n.ivarOffset=s.isPointers()?s.instSize():0),n}},"basic",{instantiateClass:function(e,t){return 4*t>this.vm.image.bytesLeft()?(console.warn("squeak: out of memory, failing allocation"),this.success=!1,this.vm.primFailCode=Squeak.PrimErrNoMemory,null):this.vm.instantiateClass(e,t)},someObject:function(){return this.vm.image.firstOldObject},nextObject:function(e){return this.vm.image.objectAfter(e)||0},someInstanceOf:function(e){var t=this.vm.image.someInstanceOf(e);return t||(this.success=!1,0)},nextInstanceAfter:function(e){var t=this.vm.image.nextInstanceAfter(e);return t||(this.success=!1,0)},allInstancesOf:function(e){var t=this.vm.image.allInstancesOf(e),s=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassArray],t.length);return s.pointers=t,s},identityHash:function(e){return e.hash},identityHashSpur:function(e){var t=e.hash;return t>0?t:e.hash=this.newObjectHash()},behaviorHash:function(e){var t=e.hash;return t>0?t:this.vm.image.enterIntoClassTable(e)},newObjectHash:function(e){return Math.floor(4194302*Math.random())+1},primitivePin:function(e){var t=this.stackNonInteger(1),s=this.stackBoolean(0);if(!this.success)return!1;var i=t.pinned;return t.pinned=s,this.popNandPushIfOK(e+1,this.makeStObject(!!i))},primitiveIsPinned:function(e){var t=this.stackNonInteger(0);return!!this.success&&this.popNandPushIfOK(e+1,this.makeStObject(!!t.pinned))},primitiveSizeInBytesOfInstance:function(e){if(e>1)return!1;var t=this.stackNonInteger(e),s=e?this.stackInteger(0):0,i=t.classByteSizeOfInstance(s);return this.popNandPushIfOK(e+1,this.makeLargeIfNeeded(i))},primitiveSizeInBytes:function(e){var t=this.stackNonInteger(0).totalBytes();return this.popNandPushIfOK(e+1,this.makeLargeIfNeeded(t))},primitiveAsCharacter:function(e){var t=this.stackInteger(0);if(t<0||t>1073741823)return!1;var s=this.charFromInt(t);return!!s&&this.popNandPushIfOK(e+1,s)},primitiveFullGC:function(e){this.vm.image.fullGC("primitive");var t=this.vm.image.bytesLeft();return this.popNandPushIfOK(e+1,this.makeLargeIfNeeded(t))},primitivePartialGC:function(e){for(var t=this.vm.image.partialGC("primitive"),s=0;t;)s+=t.totalBytes(),t=t.nextObject;console.log(" old space: "+this.vm.image.oldSpaceBytes.toLocaleString()+" bytes, young space: "+s.toLocaleString()+" bytes, total: "+(this.vm.image.oldSpaceBytes+s).toLocaleString()+" bytes");var i=this.vm.image.bytesLeft()-s;return this.popNandPushIfOK(e+1,this.makeLargeIfNeeded(i))},primitiveMakePoint:function(e,t){var s=this.vm.stackValue(1),i=this.vm.stackValue(0);return!(t&&(this.checkFloat(s),this.checkFloat(i),!this.success))&&(this.vm.popNandPush(1+e,this.makePointWithXandY(s,i)),!0)},primitiveStoreStackp:function(e){var t=this.stackNonInteger(1),s=this.stackInteger(0);if(!this.success||s<0||this.vm.decodeSqueakSP(s)>=t.pointers.length)return!1;for(var i=t.pointers[Squeak.Context_stackPointer];i<s;)t.pointers[this.vm.decodeSqueakSP(++i)]=this.vm.nilObj;return t.pointers[Squeak.Context_stackPointer]=s,this.vm.popN(e),!0},primitiveChangeClass:function(e){if(e>2)return!1;var t=this.stackNonInteger(1),s=this.stackNonInteger(0);return!!this.changeClassTo(t,s.sqClass)&&this.popNIfOK(e)},primitiveAdoptInstance:function(e){if(e>2)return!1;var t=this.stackNonInteger(1),s=this.stackNonInteger(0);return!!this.changeClassTo(s,t)&&this.popNIfOK(e)},changeClassTo:function(e,t){if(e.sqClass.isCompact!==t.isCompact)return!1;var s=t.classInstIsPointers();if(e.isPointers()){if(!s)return!1;if(e.sqClass.classInstSize()!==t.classInstSize())return!1}else{if(s)return!1;var i=e.isBytes(),r=t.classInstIsBytes();if(i&&!r){if(e.bytes){if(3&e.bytes.length)return!1;e.words=new Uint32Array(e.bytes.buffer),delete e.bytes}}else!i&&r&&e.words&&(e.bytes=new Uint8Array(e.words.buffer),delete e.words)}return e._format=t.classInstFormat(),e.sqClass=t,!0},primitiveDoPrimitiveWithArgs:function(e){var t=this.stackNonInteger(0),s=this.stackInteger(1);if(!this.success)return!1;var i=t.pointersSize(),r=this.vm.activeContext.pointersSize();if(this.vm.sp+i>=r)return!1;this.vm.popN(2);for(var n=0;n<i;n++)this.vm.push(t.pointers[n]);return!!this.vm.tryPrimitive(s,i)||(this.vm.popN(i),this.vm.push(s),this.vm.push(t),!1)},primitiveDoNamedPrimitive:function(e){var t=this.stackNonInteger(0),s=this.stackNonInteger(1),i=this.stackNonInteger(2);if(!this.success)return!1;var r=t.pointersSize(),n=this.vm.activeContext.pointersSize();if(this.vm.sp+r>=n)return!1;this.vm.popN(3),this.vm.push(s);for(var a=0;a<r;a++)this.vm.push(t.pointers[a]);return!!this.doNamedPrimitive(r,i)||(this.vm.popN(r+1),this.vm.push(i),this.vm.push(s),this.vm.push(t),!1)},primitiveShortAtAndPut:function(e){var t,s=this.stackNonInteger(e),i=this.stackInteger(e-1)-1,r=s.wordsAsInt16Array();if(!this.success||!r||i<0||i>=r.length)return!1;if(e<2)t=r[i];else{if((t=this.stackInteger(0))<-32768||t>32767)return!1;r[i]=t}return this.popNandPushIfOK(e+1,t),!0},primitiveIntegerAtAndPut:function(e){var t,s=this.stackNonInteger(e),i=this.stackInteger(e-1)-1,r=s.wordsAsInt32Array();if(!this.success||!r||i<0||i>=r.length)return!1;if(e<2)t=this.signed32BitIntegerFor(r[i]);else{if(t=this.stackSigned32BitInt(0),!this.success)return!1;r[i]=t}return this.popNandPushIfOK(e+1,t),!0},primitiveConstantFill:function(e){var t=this.stackNonInteger(1),s=this.stackPos32BitInt(0);if(!this.success||!t.isWordsOrBytes())return!1;var i=t.words||t.bytes;if(i){if(i===t.bytes&&s>255)return!1;for(var r=0;r<i.length;r++)i[r]=s}return this.vm.popN(e),!0},primitiveNewMethod:function(e){var t=this.stackInteger(0),s=this.stackInteger(1);if(!this.success)return 0;var i=this.vm.instantiateClass(this.vm.stackValue(2),s);i.pointers=[t];for(var r=i.methodNumLits(),n=0;n<r;n++)i.pointers.push(this.vm.nilObj);return this.vm.popNandPush(1+e,i),this.vm.breakOnNewMethod&&(this.vm.breakOnMethod=i),!0},primitiveExecuteMethodArgsArray:function(e){var t=this.stackNonInteger(0),s=this.stackNonInteger(1),i=this.vm.stackValue(2);if(!this.success||!t.isMethod()||e>4)return!1;var r=t.methodNumArgs();if(r!==s.pointersSize())return!1;this.vm.popNandPush(e+1,i);for(var n=0;n<r;n++)this.vm.push(s.pointers[n]);return this.vm.executeNewMethod(i,t,r,t.methodPrimitiveIndex(),null,null),!0},primitiveArrayBecome:function(e,t,s){var i=this.stackNonInteger(e),r=this.stackNonInteger(e-1);return e>1&&(s=this.stackBoolean(e-2)),!!this.success&&(this.success=this.vm.image.bulkBecome(i.pointers,r.pointers,t,s),this.popNIfOK(e))},doStringReplace:function(){var e=this.stackNonInteger(4),t=this.stackInteger(3)-1,s=this.stackInteger(2)-t,i=this.stackNonInteger(1),r=this.stackInteger(0)-1;if(!this.success)return e;if(!i.sameFormatAs(e))return this.success=!1,e;if(i.isPointers()){var n=i.pointersSize();if((r+=i.instSize())<0||r+s>n)return this.success=!1,e;if(n=e.pointersSize(),(t+=e.instSize())<0||t+s>n)return this.success=!1,e;for(var a=0;a<s;a++)e.pointers[t+a]=i.pointers[r+a];return e}if(i.isWords()){n=i.wordsSize();if(r<0||r+s>n)return this.success=!1,e;if(n=e.wordsSize(),t<0||t+s>n)return this.success=!1,e;if(i.isFloat&&e.isFloat)e.float=i.float;else if(i.isFloat)e.wordsAsFloat64Array()[t]=i.float;else if(e.isFloat)e.float=i.wordsAsFloat64Array()[r];else for(a=0;a<s;a++)e.words[t+a]=i.words[r+a];return e}n=i.bytesSize();if(r<0||r+s>n)return this.success=!1,e;if(n=e.bytesSize(),t<0||t+s>n)return this.success=!1,e;for(a=0;a<s;a++)e.bytes[t+a]=i.bytes[r+a];return e},primitiveCopyObject:function(e){var t=this.stackNonInteger(1),s=this.stackNonInteger(0),i=t.pointersSize();if(!this.success||t.isWordsOrBytes()||t.sqClass!==s.sqClass||i!==s.pointersSize())return!1;for(var r=0;r<i;r++)t.pointers[r]=s.pointers[r];return t.dirty=s.dirty,this.vm.popN(e),!0},primitiveStoreImageSegment:function(e){var t=this.stackNonInteger(2),s=this.stackNonInteger(1),i=this.stackNonInteger(0);return!!(t.pointers&&s.words&&i.pointers)&&(!!this.vm.image.storeImageSegment(s,i,t)&&(this.vm.popN(e),!0))},primitiveLoadImageSegment:function(e){var t=this.stackNonInteger(1),s=this.stackNonInteger(0);if(!t.words||!s.pointers)return!1;var i=this.vm.image.loadImageSegment(t,s);return!!i&&this.popNandPushIfOK(e+1,i)}},"blocks/closures",{doBlockCopy:function(){var e=this.vm.stackValue(1),t=this.stackInteger(0),s=e;if(this.vm.isContext(s)||(this.success=!1),!this.success)return e;"number"==typeof s.pointers[Squeak.Context_method]&&(s=s.pointers[Squeak.BlockContext_home]);var i=s.pointersSize()-s.instSize(),r=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassBlockContext],i),n=this.vm.encodeSqueakPC(this.vm.pc+2,this.vm.method);return r.pointers[Squeak.BlockContext_initialIP]=n,r.pointers[Squeak.Context_instructionPointer]=n,r.pointers[Squeak.Context_stackPointer]=0,r.pointers[Squeak.BlockContext_argumentCount]=t,r.pointers[Squeak.BlockContext_home]=s,r.pointers[Squeak.Context_sender]=this.vm.nilObj,r},primitiveBlockValue:function(e){var t=this.vm.stackValue(e);if(!this.isA(t,Squeak.splOb_ClassBlockContext))return!1;var s=t,i=s.pointers[Squeak.BlockContext_argumentCount];if("number"!=typeof i)return!1;if(i!=e)return!1;if(!s.pointers[Squeak.BlockContext_caller].isNil)return!1;this.vm.arrayCopy(this.vm.activeContext.pointers,this.vm.sp-e+1,s.pointers,Squeak.Context_tempFrameStart,e);var r=s.pointers[Squeak.BlockContext_initialIP];return s.pointers[Squeak.Context_instructionPointer]=r,s.pointers[Squeak.Context_stackPointer]=e,s.pointers[Squeak.BlockContext_caller]=this.vm.activeContext,this.vm.popN(e+1),this.vm.newActiveContext(s),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0},primitiveBlockValueWithArgs:function(e){var t=this.vm.stackValue(1),s=this.vm.stackValue(0);if(!this.isA(t,Squeak.splOb_ClassBlockContext))return!1;if(!this.isA(s,Squeak.splOb_ClassArray))return!1;var i=t.pointers[Squeak.BlockContext_argumentCount];if("number"!=typeof i)return!1;if(i!=s.pointersSize())return!1;if(!t.pointers[Squeak.BlockContext_caller].isNil)return!1;this.vm.arrayCopy(s.pointers,0,t.pointers,Squeak.Context_tempFrameStart,i);var r=t.pointers[Squeak.BlockContext_initialIP];return t.pointers[Squeak.Context_instructionPointer]=r,t.pointers[Squeak.Context_stackPointer]=i,t.pointers[Squeak.BlockContext_caller]=this.vm.activeContext,this.vm.popN(e+1),this.vm.newActiveContext(t),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0},primitiveClosureCopyWithCopiedValues:function(e){this.vm.breakNow("primitiveClosureCopyWithCopiedValues");debugger;return!1},primitiveClosureValue:function(e){var t=this.vm.stackValue(e);return e===t.pointers[Squeak.Closure_numArgs]&&(this.activateNewClosureMethod(t,e),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0)},primitiveClosureValueWithArgs:function(e){var t=this.vm.top(),s=t.pointersSize(),i=this.vm.stackValue(e);if(s!==i.pointers[Squeak.Closure_numArgs])return!1;this.vm.pop();for(var r=0;r<s;r++)this.vm.push(t.pointers[r]);return this.activateNewClosureMethod(i,s),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0},primitiveClosureValueNoContextSwitch:function(e){var t=this.vm.stackValue(e);return e===t.pointers[Squeak.Closure_numArgs]&&(this.activateNewClosureMethod(t,e),!0)},primitiveFullClosureValue:function(e){var t=this.vm.stackValue(e);return e===t.pointers[Squeak.Closure_numArgs]&&(this.activateNewFullClosure(t,e),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0)},primitiveFullClosureValueWithArgs:function(e){var t=this.vm.top(),s=t.pointersSize(),i=this.vm.stackValue(e);if(s!==i.pointers[Squeak.Closure_numArgs])return!1;this.vm.pop();for(var r=0;r<s;r++)this.vm.push(t.pointers[r]);return this.activateNewFullClosure(i,s),this.vm.interruptCheckCounter--<=0&&this.vm.checkForInterrupts(),!0},primitiveFullClosureValueNoContextSwitch:function(e){var t=this.vm.stackValue(e);return e===t.pointers[Squeak.Closure_numArgs]&&(this.activateNewFullClosure(t,e),!0)},activateNewClosureMethod:function(e,t){var s=e.pointers[Squeak.Closure_outerContext],i=s.pointers[Squeak.Context_method],r=this.vm.allocateOrRecycleContext(i.methodNeedsLargeFrame()),n=e.pointers.length-Squeak.Closure_firstCopiedValue;r.pointers[Squeak.Context_sender]=this.vm.activeContext,r.pointers[Squeak.Context_instructionPointer]=e.pointers[Squeak.Closure_startpc],r.pointers[Squeak.Context_stackPointer]=t+n,r.pointers[Squeak.Context_method]=s.pointers[Squeak.Context_method],r.pointers[Squeak.Context_closure]=e,r.pointers[Squeak.Context_receiver]=s.pointers[Squeak.Context_receiver];for(var a=Squeak.Context_tempFrameStart,o=0;o<t;o++)r.pointers[a++]=this.vm.stackValue(t-o-1);for(o=0;o<n;o++)r.pointers[a++]=e.pointers[Squeak.Closure_firstCopiedValue+o];this.vm.popN(t+1),this.vm.newActiveContext(r)},activateNewFullClosure:function(e,t){var s=e.pointers[Squeak.ClosureFull_method],i=this.vm.allocateOrRecycleContext(s.methodNeedsLargeFrame()),r=e.pointers.length-Squeak.ClosureFull_firstCopiedValue;i.pointers[Squeak.Context_sender]=this.vm.activeContext,i.pointers[Squeak.Context_instructionPointer]=this.vm.encodeSqueakPC(0,s),i.pointers[Squeak.Context_stackPointer]=s.methodTempCount(),i.pointers[Squeak.Context_method]=s,i.pointers[Squeak.Context_closure]=e,i.pointers[Squeak.Context_receiver]=e.pointers[Squeak.ClosureFull_receiver];for(var n=Squeak.Context_tempFrameStart,a=0;a<t;a++)i.pointers[n++]=this.vm.stackValue(t-a-1);for(a=0;a<r;a++)i.pointers[n++]=e.pointers[Squeak.ClosureFull_firstCopiedValue+a];this.vm.popN(t+1),this.vm.newActiveContext(i),s.compiled||this.vm.compileIfPossible(s)}},"scheduling",{primitiveResume:function(){return this.resume(this.vm.top()),!0},primitiveSuspend:function(){var e=this.vm.top();if(e===this.activeProcess())this.vm.popNandPush(1,this.vm.nilObj),this.transferTo(this.wakeHighestPriority());else{var t=e.pointers[Squeak.Proc_myList];if(t.isNil)return!1;if(this.removeProcessFromList(e,t),!this.success)return!1;e.pointers[Squeak.Proc_myList]=this.vm.nilObj,this.vm.popNandPush(1,t)}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(e){var t=this.activeProcess(),s=t.pointers[Squeak.Proc_priority];e.pointers[Squeak.Proc_priority]>s?(this.putToSleep(t),this.transferTo(e)):this.putToSleep(e)},putToSleep:function(e){if(null!==e){var t=e.pointers[Squeak.Proc_priority],s=this.getScheduler().pointers[Squeak.ProcSched_processLists].pointers[t-1];this.linkProcessToList(e,s)}},transferTo:function(e){var t=this.getScheduler(),s=t.pointers[Squeak.ProcSched_activeProcess];t.pointers[Squeak.ProcSched_activeProcess]=e,t.dirty=!0,null!==s&&(s.pointers[Squeak.Proc_suspendedContext]=this.vm.activeContext,s.dirty=!0),null!==e&&(this.vm.newActiveContext(e.pointers[Squeak.Proc_suspendedContext]),e.pointers[Squeak.Proc_suspendedContext]=this.vm.nilObj,this.oldPrims||(e.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(e,!0,this.vm.logSends?"| ":"")+"===============================================")},wakeHighestPriority:function(){var e,t=this.getScheduler().pointers[Squeak.ProcSched_processLists],s=t.pointersSize()-1;do{if(s<0)return null;e=t.pointers[s--]}while(this.isEmptyList(e));return this.removeFirstLinkOfList(e)},linkProcessToList:function(e,t){if(this.isEmptyList(t))t.pointers[Squeak.LinkedList_firstLink]=e;else{var s=t.pointers[Squeak.LinkedList_lastLink];s.pointers[Squeak.Link_nextLink]=e,s.dirty=!0}t.pointers[Squeak.LinkedList_lastLink]=e,t.dirty=!0,e.pointers[Squeak.Proc_myList]=t,e.dirty=!0},isEmptyList:function(e){return e.pointers[Squeak.LinkedList_firstLink].isNil},removeFirstLinkOfList:function(e){var t=e.pointers[Squeak.LinkedList_firstLink];if(t===e.pointers[Squeak.LinkedList_lastLink])e.pointers[Squeak.LinkedList_firstLink]=this.vm.nilObj,e.pointers[Squeak.LinkedList_lastLink]=this.vm.nilObj;else{var s=t.pointers[Squeak.Link_nextLink];e.pointers[Squeak.LinkedList_firstLink]=s,e.dirty=!0}return t.pointers[Squeak.Link_nextLink]=this.vm.nilObj,t},removeProcessFromList:function(e,t){var s=t.pointers[Squeak.LinkedList_firstLink],i=t.pointers[Squeak.LinkedList_lastLink];if(e===s){var r=e.pointers[Squeak.Link_nextLink];t.pointers[Squeak.LinkedList_firstLink]=r,e===i&&(t.pointers[Squeak.LinkedList_lastLink]=this.vm.nilObj)}else{for(var n=s;;){if(n.isNil)return void(this.oldPrims&&(this.success=!1));if((r=n.pointers[Squeak.Link_nextLink])===e)break;n=r}r=e.pointers[Squeak.Link_nextLink],n.pointers[Squeak.Link_nextLink]=r,e===i&&(t.pointers[Squeak.LinkedList_lastLink]=n)}e.pointers[Squeak.Link_nextLink]=this.vm.nilObj},registerSemaphore:function(e){var t=this.vm.top();return this.isA(t,Squeak.splOb_ClassSemaphore)?this.vm.specialObjects[e]=t:this.vm.specialObjects[e]=this.vm.nilObj,this.vm.stackValue(1)},primitiveWait:function(){var e=this.vm.top();if(!this.isA(e,Squeak.splOb_ClassSemaphore))return!1;var t=e.pointers[Squeak.Semaphore_excessSignals];return t>0?e.pointers[Squeak.Semaphore_excessSignals]=t-1:(this.linkProcessToList(this.activeProcess(),e),this.transferTo(this.wakeHighestPriority())),!0},primitiveSignal:function(){var e=this.vm.top();return!!this.isA(e,Squeak.splOb_ClassSemaphore)&&(this.synchronousSignal(e),!0)},synchronousSignal:function(e){this.isEmptyList(e)?e.pointers[Squeak.Semaphore_excessSignals]++:this.resume(this.removeFirstLinkOfList(e))},signalAtMilliseconds:function(e,t){this.isA(e,Squeak.splOb_ClassSemaphore)?(this.vm.specialObjects[Squeak.splOb_TheTimerSemaphore]=e,this.vm.nextWakeupTick=t):(this.vm.specialObjects[Squeak.splOb_TheTimerSemaphore]=this.vm.nilObj,this.vm.nextWakeupTick=0)},primitiveSignalAtMilliseconds:function(e){var t=this.stackInteger(0),s=this.stackNonInteger(1);return!!this.success&&(this.signalAtMilliseconds(s,t),this.vm.popN(e),!0)},primitiveSignalAtUTCMicroseconds:function(e){var t=this.stackSigned53BitInt(0),s=this.stackNonInteger(1);if(!this.success)return!1;var i=t/1e3+Squeak.EpochUTC-this.vm.startupTime&Squeak.MillisecondClockMask;return this.signalAtMilliseconds(s,i),this.vm.popN(e),!0},signalSemaphoreWithIndex:function(e){this.semaphoresToSignal.push(e)},signalExternalSemaphores:function(){for(var e=this.vm.specialObjects[Squeak.splOb_ExternalObjectsArray].pointers,t=this.vm.specialObjects[Squeak.splOb_ClassSemaphore];this.semaphoresToSignal.length;){var s=e[this.semaphoresToSignal.shift()-1];s.sqClass==t&&this.synchronousSignal(s)}},primitiveEnterCriticalSection:function(e){if(e>1)return!1;var t=this.vm.stackValue(e),s=e?this.vm.top():this.activeProcess(),i=t.pointers[Squeak.Mutex_owner];return i.isNil?(t.pointers[Squeak.Mutex_owner]=s,t.dirty=!0,this.popNandPushIfOK(e+1,this.vm.falseObj)):i===s?this.popNandPushIfOK(e+1,this.vm.trueObj):(this.popNandPushIfOK(e+1,this.vm.falseObj),this.linkProcessToList(s,t),this.transferTo(this.wakeHighestPriority())),!0},primitiveExitCriticalSection:function(e){var t=this.vm.top();if(this.isEmptyList(t))t.pointers[Squeak.Mutex_owner]=this.vm.nilObj;else{var s=this.removeFirstLinkOfList(t);t.pointers[Squeak.Mutex_owner]=s,t.dirty=!0,this.resume(s)}return!0},primitiveTestAndSetOwnershipOfCriticalSection:function(e){if(e>1)return!1;var t=this.vm.stackValue(e),s=e?this.vm.top():this.activeProcess(),i=t.pointers[Squeak.Mutex_owner];return i.isNil?(t.pointers[Squeak.Mutex_owner]=s,t.dirty=!0,this.popNandPushIfOK(e+1,this.vm.falseObj)):i===s?this.popNandPushIfOK(e+1,this.vm.trueObj):this.popNandPushIfOK(e+1,this.vm.nilObj),!0}},"vm functions",{primitiveGetAttribute:function(e){var t=this.stackInteger(0);if(!this.success)return!1;var s=this.display.argv,i=this.display.vmOptions,r=null;switch(t){case 0:r=s&&s[0]||this.filenameToSqueak(Squeak.vmPath+Squeak.vmFile);break;case 1:r=s&&s[1]||this.display.documentName;break;case 2:r=s&&s[2]||this.display.documentName;break;case 1001:r=this.vm.options.unix?"unix":Squeak.platformName;break;case 1002:r=Squeak.osVersion;break;case 1003:r=Squeak.platformSubtype;break;case 1004:r=Squeak.vmVersion+" "+Squeak.vmMakerVersion;break;case 1005:r=Squeak.windowSystem;break;case 1006:r=Squeak.vmBuild;break;case 1007:r=Squeak.vmInterpreterVersion;break;case 1009:r=Squeak.vmVersion+" Date: "+Squeak.vmDate;break;default:if(t>=0&&s&&s.length>t)r=s[t];else{if(!(t<0&&i&&i.length>-t-1))return!1;r=i[-t-1]}}return this.vm.popNandPush(e+1,this.makeStObject(r)),!0},setLowSpaceThreshold:function(){var e=this.stackInteger(0);return this.success&&(this.vm.lowSpaceThreshold=e),this.vm.stackValue(1)},primitiveVMParameter:function(e){var t=this.vm.image.isSpur?71:44;switch(e){case 0:for(var s=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassArray],t),i=0;i<t;i++)s.pointers[i]=this.makeStObject(this.vmParameterAt(i+1));return this.popNandPushIfOK(1,s);case 1:var r=this.stackInteger(0);return!(r<1||r>t)&&this.popNandPushIfOK(2,this.makeStObject(this.vmParameterAt(r)));case 2:return this.popNandPushIfOK(3,0)}return!1},vmParameterAt:function(e){switch(e){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(e){return 0==e?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(e),!0)},primitiveSnapshot:function(e){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 t=this.vm.image.writeToBuffer();return Squeak.flushAllFiles&&(Squeak.flushAllFiles(),Squeak.filePut(this.vm.image.name+".image",t)),this.vm.popNandPush(1,this.vm.falseObj),!0},primitiveQuit:function(e){return Squeak.flushAllFiles&&Squeak.flushAllFiles(),this.display.quitFlag=!0,this.vm.breakNow("quit"),!0},primitiveExitToDebugger:function(e){this.vm.breakNow("debugger primitive");debugger;return!0},primitiveSetGCBiasToGrow:function(e){return this.fakePrimitive(".primitiveSetGCBiasToGrow",0,e)},primitiveSetGCBiasToGrowGCLimit:function(e){return this.fakePrimitive(".primitiveSetGCBiasToGrowGCLimit",0,e)}},"time",{primitiveRelinquishProcessorForMicroseconds:function(e){return this.vm.popN(e),this.vm.goIdle(),!0},millisecondClockValue:function(){return Date.now()-this.vm.startupTime&Squeak.MillisecondClockMask},millisecondClockValueSet:function(e){this.vm.startupTime=Date.now()-e},secondClock:function(){return this.pos32BitIntFor(Squeak.totalSeconds())},microsecondClock:function(e){var t=Date.now()-e.epoch;if("object"!=typeof performance)return this.pos53BitIntFor(1e3*t);var s=1e3*performance.now()%1e3|0,i=e.millis,r=e.micros;return i>t&&(t=i),t===i&&s<r&&t++,e.millis=t,e.micros=s,this.pos53BitIntFor(1e3*t+s)},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(e){var t=new Date,s=this.pos53BitIntFor(1e3*t.getTime()),i=-60*t.getTimezoneOffset();if(e>0){var r=this.vm.stackValue(0);return r.pointers[0]=s,r.pointers[1]=i,this.popNandPushIfOK(e+1,r),!0}var n=[s,i];return this.popNandPushIfOK(e+1,this.makeStArray(n)),!0}})),vm_primitives}var jit={},hasRequiredJit;function requireJit(){return hasRequiredJit||(hasRequiredJit=1,Object.subclass("Squeak.Compiler","initialization",{initialize:function(e){this.vm=e,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(e,t,s){if(void 0===e.compiled)e.compiled=!1;else{var i,r,n;if(this.singleStep=!1,this.debug=this.comments,this.debug&&!t){var a=e.sqClass===this.vm.specialObjects[Squeak.splOb_ClassCompiledMethod];this.vm.allMethodsDo((function(i,r,n){if(a?r===e:r.pointers.includes(e))return t=i,s=n,!0}))}if(t)if(i=t.className(),r=s.bytesAsString(),this.debug)(a=e.sqClass===this.vm.specialObjects[Squeak.splOb_ClassCompiledMethod])||(i="[] in "+i),n=t.allInstVarNames();e.compiled=this.generate(e,i,r,n)}},enableSingleStepping:function(e,t,s){if(!e.compiled||!e.compiled.canSingleStep){this.singleStep=!0,this.debug=!0,t||this.vm.allMethodsDo((function(i,r,n){if(r===e)return t=i,s=n,!0}));var i=t&&t.className(),r=s&&s.bytesAsString(),n=t&&t.allInstVarNames();e.compiled=this.generate(e,i,r,n),e.compiled.canSingleStep=!0}return!0},functionNameFor:function(e,t){return void 0===e||"?"===e?this.method.sqClass===this.vm.specialObjects[Squeak.splOb_ClassCompiledMethod]?"DOIT_"+ ++this.doitCounter:"BLOCK_"+ ++this.blockCounter:(e=e.replace(/ /g,"_").replace("[]","Block"),/[^a-zA-Z0-9:_]/.test(t)?e+"__"+t.replace(/./g,(function(e){return{"|":"OR","~":"NOT","<":"LT","=":"EQ",">":"GT","&":"AND","@":"AT","*":"TIMES","+":"PLUS","\\":"MOD","-":"MINUS",",":"COMMA","/":"DIV","?":"IF"}[e]||"OPERATOR"}))+"__":e+"_"+t.replace(/:/g,"ː"))}},"generating",{generate:function(e,t,s,i){this.method=e,this.sista=e.methodSignFlag(),this.pc=0,this.endPC=0,this.prevPC=0,this.source=[],this.sourceLabels={},this.needsLabel={},this.sourcePos={},this.needsVar={},this.needsBreak=!1,t&&s&&this.source.push("// ",t,">>",s,"\n"),this.instVarNames=i,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(e):this.generateV3(e);var r=this.functionNameFor(t,s);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 n="'use strict';\nreturn function "+r+"(vm) {\n"+this.source.join("")+"}";return new Function(n)()},generateV3:function(e){for(this.done=!1;!this.done;){var t=e.bytes[this.pc++],s=0;switch(248&t){case 0:case 8:this.generatePush("inst[",15&t,"]");break;case 16:case 24:this.generatePush("temp[",6+(15&t),"]");break;case 32:case 40:case 48:case 56:this.generatePush("lit[",1+(31&t),"]");break;case 64:case 72:case 80:case 88:this.generatePush("lit[",1+(31&t),"].pointers[1]");break;case 96:this.generatePopInto("inst[",7&t,"]");break;case 104:this.generatePopInto("temp[",6+(7&t),"]");break;case 112:switch(t){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(t){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 "+t)}break;case 128:case 136:this.generateV3Extended(t);break;case 144:this.generateJump(1+(7&t));break;case 152:this.generateJumpIf(!1,1+(7&t));break;case 160:s=e.bytes[this.pc++],this.generateJump(256*((7&t)-4)+s);break;case 168:s=e.bytes[this.pc++],this.generateJumpIf(t<172,256*(3&t)+s);break;case 176:case 184:this.generateNumericOp(t);break;case 192:case 200:this.generateQuickPrim(t);break;case 208:case 216:this.generateSend("lit[",1+(15&t),"]",0,!1);break;case 224:case 232:this.generateSend("lit[",1+(15&t),"]",1,!1);break;case 240:case 248:this.generateSend("lit[",1+(15&t),"]",2,!1)}}},generateV3Extended:function(e){var t,s;switch(e){case 128:switch((t=this.method.bytes[this.pc++])>>6){case 0:return void this.generatePush("inst[",63&t,"]");case 1:return void this.generatePush("temp[",6+(63&t),"]");case 2:return void this.generatePush("lit[",1+(63&t),"]");case 3:return void this.generatePush("lit[",1+(63&t),"].pointers[1]")}return;case 129:switch((t=this.method.bytes[this.pc++])>>6){case 0:return void this.generateStoreInto("inst[",63&t,"]");case 1:return void this.generateStoreInto("temp[",6+(63&t),"]");case 2:throw Error("illegal store into literal");case 3:return void this.generateStoreInto("lit[",1+(63&t),"].pointers[1]")}return;case 130:switch((t=this.method.bytes[this.pc++])>>6){case 0:return void this.generatePopInto("inst[",63&t,"]");case 1:return void this.generatePopInto("temp[",6+(63&t),"]");case 2:throw Error("illegal pop into literal");case 3:return void this.generatePopInto("lit[",1+(63&t),"].pointers[1]")}return;case 131:return t=this.method.bytes[this.pc++],void this.generateSend("lit[",1+(31&t),"]",t>>5,!1);case 132:switch(t=this.method.bytes[this.pc++],s=this.method.bytes[this.pc++],t>>5){case 0:return void this.generateSend("lit[",1+s,"]",31&t,!1);case 1:return void this.generateSend("lit[",1+s,"]",31&t,!0);case 2:return void this.generatePush("inst[",s,"]");case 3:return void this.generatePush("lit[",1+s,"]");case 4:return void this.generatePush("lit[",1+s,"].pointers[1]");case 5:return void this.generateStoreInto("inst[",s,"]");case 6:return void this.generatePopInto("inst[",s,"]");case 7:return void this.generateStoreInto("lit[",1+s,"].pointers[1]")}return;case 133:return t=this.method.bytes[this.pc++],void this.generateSend("lit[",1+(31&t),"]",t>>5,!0);case 134:return t=this.method.bytes[this.pc++],void this.generateSend("lit[",1+(63&t),"]",t>>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 i=(t=this.method.bytes[this.pc++])>127,r=127&t;return void this.generateClosureTemps(r,i);case 139:return t=this.method.bytes[this.pc++],s=this.method.bytes[this.pc++],void this.generateCallPrimitive(t+256*s,129);case 140:return t=this.method.bytes[this.pc++],s=this.method.bytes[this.pc++],void this.generatePush("temp[",6+s,"].pointers[",t,"]");case 141:return t=this.method.bytes[this.pc++],s=this.method.bytes[this.pc++],void this.generateStoreInto("temp[",6+s,"].pointers[",t,"]");case 142:return t=this.method.bytes[this.pc++],s=this.method.bytes[this.pc++],void this.generatePopInto("temp[",6+s,"].pointers[",t,"]");case 143:var n=15&(t=this.method.bytes[this.pc++]),a=t>>4,o=(s=this.method.bytes[this.pc++])<<8|this.method.bytes[this.pc++];return void this.generateClosureCopy(n,a,o)}},generateSista:function(){var e,t,s,i=this.method.bytes,r=0,n=0;for(this.done=!1;!this.done;){switch(e=i[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&e,"]");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&e),"].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&e),"]");break;case 64:case 65:case 66:case 67:case 68:case 69:case 70:case 71:this.generatePush("temp[",6+(7&e),"]");break;case 72:case 73:case 74:case 75:this.generatePush("temp[",6+(3&e)+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 "+e);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(e);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(e);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&e),"]",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&e),"]",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&e),"]",2,!1);break;case 176:case 177:case 178:case 179:case 180:case 181:case 182:case 183:this.generateJump(1+(7&e));break;case 184:case 185:case 186:case 187:case 188:case 189:case 190:case 191:this.generateJumpIf(!0,1+(7&e));break;case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:this.generateJumpIf(!1,1+(7&e));break;case 200:case 201:case 202:case 203:case 204:case 205:case 206:case 207:this.generatePopInto("inst[",7&e,"]");break;case 208:case 209:case 210:case 211:case 212:case 213:case 214:case 215:this.generatePopInto("temp[",6+(7&e),"]");break;case 216:this.generateInstruction("pop","vm.sp--");break;case 217:throw Error("unumplementedBytecode: 0xD9 (unconditional trap)");case 224:r=256*r+(t=i[this.pc++]);continue;case 225:n=256*n+((t=i[this.pc++])<128?t:t-256);continue;case 226:t=i[this.pc++],this.generatePush("inst[",t+256*r,"]");break;case 227:t=i[this.pc++],this.generatePush("lit[",1+t+256*r,"].pointers[1]");break;case 228:t=i[this.pc++],this.generatePush("lit[",1+t+256*r,"]");break;case 229:t=i[this.pc++],this.generatePush("temp[",6+t,"]");break;case 230:throw Error("unusedBytecode 0xE6");case 231:var a=(t=i[this.pc++])>127,o=127&t;this.generateClosureTemps(o,a);break;case 232:t=i[this.pc++],this.generatePush(t+256*n);break;case 233:t=i[this.pc++],this.generatePush("vm.image.getCharacter(",t+256*n,")");break;case 234:t=i[this.pc++],this.generateSend("lit[",1+(t>>3)+(r<<5),"]",(7&t)+(n<<3),!1);break;case 235:var c=((t=i[this.pc++])>>3)+(r<<5),h=(7&t)+((63&n)<<3),u=n>=64;this.generateSend("lit[",1+c,"]",h,!u||"directed");break;case 236:throw Error("unimplemented bytecode: 0xEC (class trap)");case 237:t=i[this.pc++],this.generateJump(t+256*n);break;case 238:t=i[this.pc++],this.generateJumpIf(!0,t+256*n);break;case 239:t=i[this.pc++],this.generateJumpIf(!1,t+256*n);break;case 240:t=i[this.pc++],this.generatePopInto("inst[",t+256*r,"]");break;case 241:t=i[this.pc++],this.generatePopInto("lit[",1+t+256*r,"].pointers[1]");break;case 242:t=i[this.pc++],this.generatePopInto("temp[",6+t,"]");break;case 243:t=i[this.pc++],this.generateStoreInto("inst[",t+256*r,"]");break;case 244:t=i[this.pc++],this.generateStoreInto("lit[",1+t+256*r,"].pointers[1]");break;case 245:t=i[this.pc++],this.generateStoreInto("temp[",6+t,"]");break;case 248:t=i[this.pc++],s=i[this.pc++],this.generateCallPrimitive(t+256*s,245);break;case 249:t=i[this.pc++],s=i[this.pc++],this.generatePushFullClosure(t+255*r,s);break;case 250:h=(7&(t=i[this.pc++]))+8*(15&r);var l=(t>>3&7)+8*(r>>4),p=(s=i[this.pc++])+(n<<8);this.generateClosureCopy(h,l,p);break;case 251:t=i[this.pc++],s=i[this.pc++],this.generatePush("temp[",6+s,"].pointers[",t,"]");break;case 252:t=i[this.pc++],s=i[this.pc++],this.generateStoreInto("temp[",6+s,"].pointers[",t,"]");break;case 253:t=i[this.pc++],s=i[this.pc++],this.generatePopInto("temp[",6+s,"].pointers[",t,"]");break;default:throw Error("illegal bytecode: "+e)}r=0,n=0}},generatePush:function(e,t,s,i,r){this.debug&&this.generateDebugCode("push",e,t,s,i,r),this.generateLabel(),this.needsVar[e]=!0,this.needsVar.stack=!0,this.source.push("stack[++vm.sp] = ",e),void 0!==t&&(this.source.push(t,s),void 0!==i&&this.source.push(i,r)),this.source.push(";\n")},generateStoreInto:function(e,t,s,i,r){this.debug&&this.generateDebugCode("store into",e,t,s,i,r),this.generateLabel(),this.needsVar[e]=!0,this.needsVar.stack=!0,this.source.push(e),void 0!==t&&(this.source.push(t,s),void 0!==i&&this.source.push(i,r)),this.source.push(" = stack[vm.sp];\n"),this.generateDirty(e,t,s)},generatePopInto:function(e,t,s,i,r){this.debug&&this.generateDebugCode("pop into",e,t,s,i,r),this.generateLabel(),this.needsVar[e]=!0,this.needsVar.stack=!0,this.source.push(e),void 0!==t&&(this.source.push(t,s),void 0!==i&&this.source.push(i,r)),this.source.push(" = stack[vm.sp--];\n"),this.generateDirty(e,t,s)},generateReturn:function(e){this.debug&&this.generateDebugCode("return",e),this.generateLabel(),this.needsVar[e]=!0,this.source.push("vm.pc = ",this.pc,"; vm.doReturn(",e,"); return;\n"),this.needsBreak=!1,this.done=this.pc>this.endPC},generateBlockReturn:function(e){this.debug&&this.generateDebugCode("block return"),this.generateLabel(),e||(this.needsVar.stack=!0,e="stack[vm.sp--]"),this.needsVar.context=!0,this.source.push("vm.pc = ",this.pc,"; vm.doReturn(",e,", context.pointers[0]); return;\n"),this.needsBreak=!1,this.done=this.pc>this.endPC},generateJump:function(e){var t=this.pc+e;this.debug&&this.generateDebugCode("jump to "+t),this.generateLabel(),this.needsVar.context=!0,this.source.push("vm.pc = ",t,"; "),e<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[t]=!0,t>this.endPC&&(this.endPC=t)},generateJumpIf:function(e,t){var s=this.pc+t;this.debug&&this.generateDebugCode("jump if "+e+" to "+s),this.generateLabel(),this.needsVar.stack=!0,this.source.push("var cond = stack[vm.sp--]; if (cond === vm.",e,"Obj) {vm.pc = ",s,"; "),this.singleStep&&this.source.push("if (vm.breakOutOfInterpreter) return; else "),this.source.push("continue}\n","else if (cond !== vm.",!e,"Obj) {vm.sp++; vm.pc = ",this.pc,"; vm.send(vm.specialObjects[25], 0, false); return}\n"),this.needsLabel[this.pc]=!0,this.needsLabel[s]=!0,s>this.endPC&&(this.endPC=s)},generateQuickPrim:function(e){switch(this.debug&&this.generateDebugCode("quick send #"+this.specialSelectors[16+(15&e)]),this.generateLabel(),15&e){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&e,")) ","{vm.sendSpecial(",16+(15&e),"); 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&e,")) vm.sendSpecial(",16+(15&e),"); 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&e,"))"," vm.sendSpecial(",16+(15&e),");\n","if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return;\n"),this.needsBreak=!1,this.needsLabel[this.pc]=!0},generateNumericOp:function(e){switch(this.debug&&this.generateDebugCode("quick send #"+this.specialSelectors[15&e]),this.generateLabel(),this.needsLabel[this.pc]=!0,15&e){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(e,t,s,i,r){this.debug&&this.generateDebugCode(("directed"===r?"directed super send ":r?"super send ":"send ")+("lit["===e?this.method.pointers[t].bytesAsString():"...")),this.generateLabel(),this.needsVar[e]=!0,this.needsVar.context=!0,this.source.push("vm.pc = ",this.pc),"directed"===r?this.source.push("; vm.sendSuperDirected(",e,t,s,", ",i,"); "):this.source.push("; vm.send(",e,t,s,", ",i,", ",r,"); "),this.source.push("if (context !== vm.activeContext || vm.breakOutOfInterpreter !== false) return;\n"),this.needsBreak=!1,this.needsLabel[this.pc]=!0},generateClosureTemps:function(e,t){if(this.debug&&this.generateDebugCode("closure temps"),this.generateLabel(),this.needsVar.stack=!0,this.source.push("var array = vm.instantiateClass(vm.specialObjects[7], ",e,");\n"),t){for(var s=0;s<e;s++)this.source.push("array.pointers[",s,"] = stack[vm.sp - ",e-s-1,"];\n");this.source.push("stack[vm.sp -= ",e-1,"] = array;\n")}else this.source.push("stack[++vm.sp] = array;\n")},generateClosureCopy:function(e,t,s){var i=this.pc,r=i+s;if(this.debug&&this.generateDebugCode("push closure("+i+"-"+(r-1)+"): "+t+" copied, "+e+" args"),this.generateLabel(),this.needsVar.stack=!0,this.source.push("var closure = vm.instantiateClass(vm.specialObjects[36], ",t,");\n","closure.pointers[0] = context; vm.reclaimableContextCount = 0;\n","closure.pointers[1] = ",i+4*this.method.pointers.length+1,";\n","closure.pointers[2] = ",e,";\n"),t>0){for(var n=0;n<t;n++)this.source.push("closure.pointers[",n+3,"] = stack[vm.sp - ",t-n-1,"];\n");this.source.push("stack[vm.sp -= ",t-1,"] = closure;\n")}else this.source.push("stack[++vm.sp] = closure;\n");this.source.push("vm.pc = ",r,";\n"),this.singleStep&&this.source.push("if (vm.breakOutOfInterpreter) return;\n"),this.source.push("continue;\n"),this.needsBreak=!1,this.needsLabel[i]=!0,this.needsLabel[r]=!0,r>this.endPC&&(this.endPC=r)},generatePushFullClosure:function(e,t){this.debug&&this.generateDebugCode("push full closure "+(e+1)),this.generateLabel(),this.needsVar["lit["]=!0,this.needsVar.rcvr=!0,this.needsVar.stack=!0;var s,i=63&t;if(s=1==(t>>6&1)?"vm.nilObj":"context",1==(t>>7&1))throw Error("on-stack receiver not yet supported");if(this.source.push("var closure = vm.newFullClosure(",s,", ",i,", lit[",1+e,"]);\n"),this.source.push("closure.pointers[",Squeak.ClosureFull_receiver,"] = rcvr;\n"),"context"===s&&this.source.push("vm.reclaimableContextCount = 0;\n"),i>0){for(var r=0;r<i;r++)this.source.push("closure.pointers[",r+Squeak.ClosureFull_firstCopiedValue,"] = stack[vm.sp - ",i-r-1,"];\n");this.source.push("stack[vm.sp -= ",i-1,"] = closure;\n")}else this.source.push("stack[++vm.sp] = closure;\n")},generateCallPrimitive:function(e,t){this.debug&&this.generateDebugCode("call primitive "+e),this.generateLabel(),this.method.bytes[this.pc]===t&&(this.needsVar.stack=!0,this.source.push("if (vm.primFailCode) {stack[vm.sp] = vm.getErrorObjectFromPrimFailCode(); vm.primFailCode = 0;}\n"))},generateDirty:function(e,t,s){switch(e){case"inst[":this.source.push("rcvr.dirty = true;\n");break;case"lit[":this.source.push(e,t,"].dirty = true;\n");break;case"temp[":"]"!==s&&this.source.push(e,t,"].dirty = true;\n");break;default:throw Error("unexpected target "+e)}},generateLabel:function(){this.prevPC&&(this.sourceLabels[this.prevPC]=this.source.length,this.source.push("case ",this.prevPC,":\n")),this.prevPC=this.pc},generateDebugCode:function(e,t,s,i,r,n){this.needsBreak&&(this.source.push("if (vm.breakOutOfInterpreter) {vm.pc = ",this.prevPC,"; return}\n"),this.needsLabel[this.prevPC]=!0);for(var a=[],o=this.prevPC;o<this.pc;o++)a.push((this.method.bytes[o]+256).toString(16).slice(-2).toUpperCase());if(this.source.push("// ",this.prevPC," <",a.join(" "),"> ",e),void 0!==t)switch(this.source.push(" "),t){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[s]):this.source.push("inst var ",s);break;case"temp[":this.source.push("tmp",s-6),"]"!==i&&this.source.push("[",r,"]");break;case"lit[":var c=this.method.pointers[s];"]"===i?this.source.push(c):this.source.push(c.pointers[0].bytesAsString());break;default:this.source.push(t)}this.source.push("\n"),this.needsBreak=this.singleStep},generateInstruction:function(e,t){this.debug&&this.generateDebugCode(e),this.generateLabel(),this.source.push(t,";\n")},deleteUnneededLabels:function(){var e=!1;for(var t in this.sourceLabels)if(this.needsLabel[t])e=!0;else for(var s=0;s<3;s++)this.source[this.sourceLabels[t]+s]="";e||(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 e=0;e<this.allVars.length;e++){var t=this.allVars[e];this.needsVar[t]||(this.source[this.sourcePos[t]]="")}}})),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(e){return this.vm.popN(e),!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(e){return this.vm.popN(e),!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(e){return this.vm.popNandPush(e+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(e,t,s){t=t||"(initialise|shutdown|prim)";var i={},r=new RegExp("^"+e+t,"i");for(var n in this)if(r.test(n)&&"function"==typeof this[n]){var a=n;e&&(a=n[e.length].toLowerCase()+n.slice(e.length+1)),i[a]=s?n:this[n].bind(this)}return i}})),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 e=require$$0$3,t=require$$1$1,s=["","",""],i=[];return Object.extend(Squeak.Primitives.prototype,"FilePlugin",{primitiveDirectoryCreate:function(t){var s=this.stackNonInteger(0);if(!this.success)return!1;var i=s.bytesAsString();try{e.mkdirSync(i)}catch(e){return console.error("Failed to create directory: "+i),!1}return this.popNIfOK(t)},primitiveDirectoryDelete:function(t){if(this.stackNonInteger(0),!this.success)return!1;var s=s.bytesAsString();try{e.rmdirSync(s)}catch(e){return console.error("Failed to delete directory: "+s),!1}return this.popNIfOK(t)},primitiveDirectoryDelimitor:function(e){var s=this.emulateMac?":":t.sep;return this.popNandPushIfOK(e+1,this.charFromInt(s.charCodeAt(0)))},primitiveDirectoryLookup:function(s){var i=this.stackInteger(0),r=this.stackNonInteger(1);if(!this.success)return!1;var n=r.bytesAsString(),a=null;try{var o=e.readdirSync(n);if(i<1||i>o.length)return!1;var c=o[i-1],h=e.statSync(n+t.sep+c);a=[c,Math.floor((h.ctimeMs-Squeak.Epoch)/1e3),Math.floor((h.mtimeMs-Squeak.Epoch)/1e3),h.isDirectory(),h.isFile()?h.size:0]}catch(e){return-20!==e.errno&&console.error("Failed to read directory: "+n),!1}return this.popNandPushIfOK(s+1,this.makeStObject(a)),!0},primitiveFileStdioHandles:function(e){var t=[this.makeFileHandle("/dev/stdin",0,!1),this.makeFileHandle("/dev/stdout",1,!0),this.makeFileHandle("/dev/stderr",2,!0)];return this.popNandPushIfOK(e+1,this.makeStArray(t)),!0},primitiveFileOpen:function(t){var s=this.stackBoolean(0),r=this.stackNonInteger(1);if(!this.success)return!1;var n,a=r.bytesAsString();try{if((n=e.openSync(a,s?"a+":"r"))<0)return!1}catch(e){return console.error("Failed to open file: "+a),!1}var o=this.makeFileHandle(a,n,s);return i.push(n),this.popNandPushIfOK(t+1,o),!0},primitiveFileSize:function(t){var s,i=this.stackNonInteger(0);if(!this.success)return!1;try{s=e.fstatSync(i.fd).size}catch(e){return console.error("Failed to get file size"),!1}return this.popNandPushIfOK(t+1,this.makeLargeIfNeeded(s)),!0},primitiveFileGetPosition:function(e){var t=this.stackNonInteger(0);return!!this.success&&(this.popNandPushIfOK(e+1,this.makeLargeIfNeeded(t.filePos)),!0)},primitiveFileSetPosition:function(e){var t=this.stackPos32BitInt(0),s=this.stackNonInteger(1);return!!this.success&&(s.filePos=t,this.popNIfOK(e))},primitiveFileAtEnd:function(t){var s,i=this.stackNonInteger(0);if(!this.success)return!1;try{s=i.filePos>=e.fstatSync(i.fd).size}catch(e){return console.error("Failed to decide if at end of file"),!1}return this.popNandPushIfOK(t+1,this.makeStObject(s)),!0},primitiveDirectorySetMacTypeAndCreator:function(e){return this.popNIfOK(e)},primitiveFileRead:function(t){var s=this.stackInteger(0),i=this.stackInteger(1)-1,r=this.stackNonInteger(2),n=this.stackNonInteger(3);if(!this.success||!r.isWordsOrBytes())return!1;if(!s)return this.popNandPushIfOK(t+1,0);var a,o=r.bytes;if(o||(o=r.wordsAsUint8Array(),i*=4,s*=4),i<0||i+s>o.length)return!1;if(0===n.fd)return console.warn("File reading on stdin not implemented yet"),!1;try{a=e.readSync(n.fd,o,i,s,n.filePos),n.filePos+=a}catch(e){return console.error("Failed to read from file"),!1}return s=r.bytes?a:a>>2,this.popNandPushIfOK(t+1,s),!0},primitiveFileWrite:function(t){var i=this.stackInteger(0),r=this.stackInteger(1)-1,n=this.stackNonInteger(2),a=this.stackNonInteger(3);if(!this.success||!a.fileWrite)return!1;if(!i)return this.popNandPushIfOK(t+1,0);var o,c=n.bytes;if(c||(c=n.wordsAsUint8Array(),r*=4,i*=4),!c)return!1;if(r<0||r+i>c.length)return!1;if(1===a.fd||2===a.fd)for(var h=1===a.fd?console.log:console.error,u=c.slice(r,r+i);i>0&&u.length>0;){var l=u.indexOf(10);l>=0?(h(s[a.fd]+String.fromCharCode.apply(null,u.slice(0,l))),s[a.fd]="",u=u.slice(l+1),o+=l+1,i-=l+1,a.filePos+=l+1):(s[a.fd]+=String.fromCharCode.apply(null,u),o+=u.length,i-=u.length,a.filePos+=u.length)}else try{o=e.writeSync(a.fd,c,r,i,a.filePos),a.filePos+=o}catch(e){return console.error("Failed to write to file"),!1}return n.bytes||(o>>=2),this.popNandPushIfOK(t+1,o),!0},primitiveFileFlush:function(t){var i=this.stackNonInteger(0);if(!this.success)return!1;if(1===i.fd||2===i.fd)(1===i.fd?console.log:console.error)(s[i.fd]),s[i.fd]="";else try{e.fsyncSync(i.fd)}catch(e){return console.error("Failed to flush file"),!1}return this.popNIfOK(t)},primitiveFileTruncate:function(t){var s=this.stackPos32BitInt(0),i=this.stackNonInteger(1);if(!this.success||!i.fileWrite)return!1;try{e.fstatSync(i.fd).size>s&&(e.ftruncateSync(i.fd,s),i.filePos>s&&(i.filePos=s))}catch(e){return console.error("Failed to truncate file"),!1}return this.popNIfOK(t)},primitiveFileClose:function(t){var s=this.stackNonInteger(0);if(!this.success)return!1;try{e.closeSync(s.fd),i=i.filter((function(e){return e!==s.fd}))}catch(e){return console.error("Failed to close file"),!1}return this.popNIfOK(t)},primitiveFileRename:function(t){var s=this.stackNonInteger(1),i=this.stackNonInteger(0);if(!this.success)return!1;var r=s.bytesAsString(),n=i.bytesAsString();try{e.renameSync(r,n)}catch(e){return console.error("Failed to rename file from: "+r+" to: "+n),!1}return this.popNIfOK(t)},primitiveFileDelete:function(t){var s=this.stackNonInteger(0);if(!this.success)return!1;var i=s.bytesAsString();try{e.unlinkSync(i)}catch(e){return console.error("Failed to delete file: "+i),!1}return this.popNIfOK(t)},makeFileHandle:function(e,t,s){var i=this.makeStString(e);return i.fd=t,i.fileWrite=s,i.filePos=0,i},filenameToSqueak:function(e){return e},filenameFromSqueak:function(e){return e}}),Object.extend(Squeak,{flushAllFiles:function(){i.forEach((function(t){try{e.fsyncSync(t)}catch(e){console.error("Failed to flush one of the files")}}))},filePut:function(t,s){try{e.writeFileSync(t,new Uint8Array(s))}catch(e){console.error("Failed to create file with content: "+t)}}}),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(e,t){return commonjsGlobal[t]},set:function(e,t,s){return commonjsGlobal[t]=s,!0}})});class SessionStorage{storage={};constructor(){var e=this;Object.keys(process$1.env).forEach((function(t){e.storage[t]=process$1.env[t]})),e.storage.CLIENT_VERSION="1"}getItem(e){return this.storage[e]}setItem(e,t){this.storage[e]=t}removeItem(e){delete this.storage[e]}get length(){return Object.keys(this.storage).length}key(e){return Object.keys(this.storage)[e]}}function CpSystemPlugin(){return{getModuleName:function(){return"CpSystemPlugin"},interpreterProxy:null,primHandler:null,setInterpreter:function(e){return this.setupGlobalObject(),this.interpreterProxy=e,this.vm=e.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.functionCalls=[],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.global?(commonjsGlobal.require=function(e){var t=require(e);return Object.keys(t).forEach((function(s){if(s[0]>="A"&&s[0]<="Z"){var i=t[s];i&&i.constructor&&i.prototype&&i===i.prototype.constructor&&(i.__cp_className=e+"."+s)}})),t},commonjsGlobal.constructor=function(){}):window.global=window,commonjsGlobal.identity=function(e){return e??commonjsGlobal}},runUninterrupted:function(e){var t=this.primHandler,s=t.getScheduler();t.putToSleep(s.pointers[Squeak.ProcSched_activeProcess]),t.transferTo(e);var i,r=this.vm;do{(i=r.method.compiled)?i(r):r.interpretOne()}while(e===s.pointers[Squeak.ProcSched_activeProcess])},signalSemaphoreWithIndex:function(e){this.vm.runProcessLoop(!0),this.primHandler.signalSemaphoreWithIndex(e)},updateStringSupport:function(){this.stringClass.classInstProto().prototype.asString=function(){for(var e=[],t=this.bytes||this.words||[],s=0;s<t.length;)e.push(String.fromCodePoint.apply(null,t.subarray(s,s+=16348)));return e.join("")};var e=this;Squeak.Primitives.prototype.makeStString=function(t){for(var s=!1,i=Array.from(t).map((function(e){var t=e.codePointAt(0);return t>=256&&(s=!0),t})),r=e.vm.instantiateClass(s?e.wideStringClass:e.byteStringClass,i.length),n=r.bytes||r.words||[],a=0;a<i.length;a++)n[a]=i[a];return r}},updateMakeStObject:function(){var e=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(t,s,i){if(null==t)return this.vm.nilObj;if(!0===t)return this.vm.trueObj;if(!1===t)return this.vm.falseObj;if(t.sqClass)return t;if(t.constructor===Number){if(Number.isInteger(t)){if(t>e.maxSmallInteger||t<e.minSmallInteger){var r=t<0;r&&(t=-t);for(var n=[],a=0;t>0;){var o=255&t;n[a++]=o,t=(t-o)/256}var c=this.vm.instantiateClass(this.vm.specialObjects[r?Squeak.splOb_ClassLargeNegativeInteger:Squeak.splOb_ClassLargePositiveInteger],n.length);return c.bytes=n,c}return t}return this.makeFloat(t)}var h;if(i=i||[],void 0!==(h=e.findSeenObj(i,t)))return h;if(t.substring)return e.addSeenObj(i,t,this.makeStString(t));if(t.slice&&void 0!==t.length){if(!t.BYTES_PER_ELEMENT)return e.addSeenObj(i,t,this.makeStArray(t,s,i));if(t.constructor===Float32Array||t.constructor===Float64Array)return e.addSeenObj(i,t,this.makeStArray(t,null,i));switch(t.BYTES_PER_ELEMENT){case 1:return e.addSeenObj(i,t,this.makeStByteArray(t));case 2:case 4:return e.addSeenObj(i,t,e.makeStWordArray(t));default:return console.error("No support for TypedArrays with bytes per element: "+t.BYTES_PER_ELEMENT,t),this.vm.nilObj}}return t.constructor===Object&&!e.hasFunctions(t)||void 0===t.constructor&&"object"==typeof t?e.makeStOrderedDictionary(t,i):(s||(s=e.getProxyClassFor(t)),s?((h=this.vm.instantiateClass(s,0)).jsObj=t,e.addSeenObj(i,t,h)):(console.error("Can't create Smalltalk object for the following object (answering nil)",t),this.vm.nilObj))}},updateMakeStArray:function(){var e=this;this.primHandler.makeStArray=function(t,s,i){i=i||[];var r=e.findSeenObj(i,t);if(void 0!==r)return r;var n=this.vm.instantiateClass(e.arrayClass,t.length);i.push({jsObj:t,stObj:n});for(var a=0;a<t.length;a++)n.pointers[a]=this.makeStObject(t[a],s,i);return n}},makeStWordArray:function(e){for(var t=this.vm.instantiateClass(this.wordArrayClass,e.length),s=0;s<e.length;s++)t.words[s]=4294967295&e[s];return t},makeStAssociation:function(e,t,s){var i;(s=s||[],e&&!e.sqClass)&&(void 0!==(i=this.findSeenObj(s,e))&&(e=i));t&&!t.sqClass&&(void 0!==(i=this.findSeenObj(s,t))&&(t=i));var r=this.vm.instantiateClass(this.associationClass,0);return r.pointers[0]=this.primHandler.makeStObject(e,void 0,s),r.pointers[1]=this.primHandler.makeStObject(t,void 0,s),r},makeStOrderedDictionary:function(e,t){t=t||[];var s=this.findSeenObj(t,e);if(void 0!==s)return s;var i=this.vm.instantiateClass(this.orderedDictionaryClass,0);t.push({jsObj:e,stObj:i});var r=this.makeStDictionary(e,[]);i.pointers[0]=r;var n=this.primHandler.makeStArray(Object.keys(e),void 0,t);return i.pointers[1]=n,i},makeStDictionary:function(e,t){t=t||[];var s=this.findSeenObj(t,e);if(void 0!==s)return s;var i=this.vm.instantiateClass(this.dictionaryClass,0);t.push({jsObj:e,stObj:i});var r=Object.keys(e),n=Math.floor(4*(r.length+1)/3),a=Array(n).fill(null),o=this;return r.forEach((function(s){for(var i=o.makeStAssociation(s,e[s],t),r=o.stringHash(Array.from(s).map((function(e){return e.codePointAt(0)})))%n,c=r,h=!1;!h&&c<n;)null===a[c]?h=!0:c++;if(!h)for(c=0;!h&&c<r;)null===a[c]?h=!0:c++;a[c]=i})),i.pointers[0]=r.length,i.pointers[1]=this.primHandler.makeStArray(a,void 0,t),i},findSeenObj:function(e,t){var s=e.find((function(e){return e.jsObj===t}));if(void 0!==s)return s.stObj},addSeenObj:function(e,t,s){return e.push({jsObj:t,stObj:s}),s},hasFunctions:function(e){return Object.keys(e).some((function(e){return e&&e.apply}))},answer:function(e,t){return this.interpreterProxy.popthenPush(e+1,this.primHandler.makeStObject(t)),!0},answerSelf:function(e){return this.interpreterProxy.pop(e),!0},asJavaScriptObject:function(e){return e.isNil?null:!!e.isTrue||!e.isFalse&&("number"==typeof e?e:e.isFloat?e.float:e.jsObj?e.jsObj:this.isKindOf(e.sqClass,this.stringClass)?e.asString():e.sqClass===this.arrayClass?this.arrayAsJavaScriptObject(e):this.isKindOf(e.sqClass,this.orderedDictionaryClass)?this.orderedDictionaryAsJavaScriptObject(e):this.isKindOf(e.sqClass,this.dictionaryClass)?this.dictionaryAsJavaScriptObject(e):e.domElement?e.domElement:this.isKindOf(e.sqClass,this.contextClass)?this.contextAsJavaScriptFunction(e):e.sqClass===this.largePositiveIntegerClass?this.largeInteger(e):e.sqClass===this.largeNegativeIntegerClass?-this.largeInteger(e):e.bytes?e.bytes:e.words?e.words:e.asString())},arrayAsJavaScriptObject:function(e){var t=this;return(e.pointers||[]).map((function(e){return t.asJavaScriptObject(e)}))},orderedDictionaryAsJavaScriptObject:function(e){var t=this.dictionaryAsJavaScriptObject(e.pointers[0]);return this.arrayAsJavaScriptObject(e.pointers[1]).reduce((function(e,s){return e[s]=t[s],e}),{})},dictionaryAsJavaScriptObject:function(e){var t=this,s=e.pointers.find((function(e){return e&&e.sqClass===t.arrayClass}));if(!s||!s.pointers||!s.pointers.forEach)throw Error("Dictionary has unexpected structure");var i={};return s.pointers.forEach((function(e){e.isNil||(i[t.asJavaScriptObject(e.pointers[0])]=t.asJavaScriptObject(e.pointers[1]))})),i},contextAsJavaScriptFunction:function(e){var t=this;return function(){var s=Array.from(arguments).map((function(e){return t.primHandler.makeStObject(e)})),i=t.vm.image.clone(e),r=t.vm.instantiateClass(t.processClass,0);r.pointers[Squeak.Proc_suspendedContext]=i,r.pointers[Squeak.Proc_priority]=t.maxProcessPriority;var n={process:r,arguments:s};t.functionCalls.push(n),t.runUninterrupted(n.process),n!==t.functionCalls.pop()&&console.warn("Unbalanced usage of runUninterrupted for contextAsJavaScriptFunction"),void 0===n.result&&console.warn("No result set executing a Smalltalk block as JavaScript function");var a=t.functionCalls[t.functionCalls.length-1];if(void 0!==a?t.primHandler.transferTo(a.process):t.vm.stoppedProcessLoop&&t.vm.runProcessLoop(!0),delete n.process,delete n.arguments,n.result instanceof Error&&n.result.cause&&n.result.cause.sqClass)throw n.result;return n.result}},isKindOf:function(e,t){for(;e&&!e.isNil;){if(e===t)return!0;e=e.superclass()}return!1},largeInteger:function(e){for(var t=0,s=e.bytes||[],i=s.length,r=0,n=1;r<i;r++,n*=256)t+=s[r]*n;return t},"primitiveObjectTraceCr:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0).asString();return console.log((new Date).toISOString()+" "+t),this.answerSelf(e)},"primitiveObjectWarnCr:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0).asString();return console.warn((new Date).toISOString()+" "+t),this.answerSelf(e)},"primitiveObjectErrorCr:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0).asString();return console.error((new Date).toISOString()+" "+t),this.answerSelf(e)},symbolFromString:function(e){var t=this.symbolTable[e];if(void 0!==t)return t;for(var s=this.vm.instantiateClass(this.symbolClass,e.length),i=0;i<e.length;i++)s.bytes[i]=255&e.charCodeAt(i);return this.symbolTable[e]=s,s},"primitiveSymbolRegister:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0),s=t.asString();if(this.symbolTable[s])throw Error("Registered non-unique Symbol: "+s);return this.symbolTable[s]=t,this.answerSelf(e)},"primitiveSymbolFromString:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0).asString();return this.answer(e,this.symbolFromString(t))},"primitiveSymbolEquals:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0),s=this.interpreterProxy.stackValue(e),i=t===s;if(!i){var r=s.bytes||s.words||[],n=t.bytes||t.words||[];if(r.length===n.length){var a=0;for(i=!0;a<r.length&&i;)r[a]!==n[a]?i=!1:a++}}return this.answer(e,i)},primitiveSymbolIsLiteralSymbol:function(e){if(0!==e)return!1;var t=this.interpreterProxy.stackValue(e),s=t.bytes||t.words||[],i=1,r=s.length>0;if(r){var n=function(e){return e>=65&&e<=90||e>=97&&e<=122},a=function(e){return[33,37,38,42,43,44,45,47,60,61,62,63,64,92,96,124,215,247].indexOf(e)>=0||e>=126&&e<=191&&[170,181,186].indexOf(e)<0},o=n(s[0])?function(e){return n(e)||function(e){return e>=48&&e<=57}(e)||function(e){return 58===e}(e)}:a(s[0])?function(e){return a(e)}:null;for(r=null!==o;i<s.length&&r;){r=o(s[i]),i++}}return this.answer(e,r)},primitiveByteArrayAsString:function(e){if(0!==e)return!1;var t=this.interpreterProxy.stackValue(e);return this.answer(e,t.asString())},"primitiveNumberRaisedTo:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(e),s=this.interpreterProxy.stackValue(0),i=null;return t.isFloat?i=t.float:"number"==typeof t&&(i=t),null!==i&&this.answer(e,Math.pow(i,s))},primitiveNumberPrintString:function(e){if(0!==e)return!1;var t=this.interpreterProxy.stackValue(e),s=null;return t.isFloat?s=t.float:"number"==typeof t&&(s=t),null!==s&&this.answer(e,s.toString())},"primitiveNumberPrintStringBase:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0);if("number"!=typeof t||t<2||t>36)return!1;var s=this.interpreterProxy.stackValue(e),i=null;return s.isFloat?10===t&&(i=s.float.toString()):"number"==typeof s&&(i=s.toString(t)),null!==i&&this.answer(e,10!==t?t+"r"+i:i)},primitiveIntegerAtRandom:function(e){if(0!==e)return!1;var t=this.interpreterProxy.stackValue(e);return"number"==typeof t&&this.answer(e,Math.floor(Math.random()*(t-1)+1))},"primitiveStringFromWordArray:":function(e){if(1!==e)return!1;for(var t=this.interpreterProxy.stackValue(e),s=this.interpreterProxy.stackValue(0).words||[],i=this.vm.instantiateClass(t,s.length),r=i.bytes||i.words,n=0;n<s.length;n++)r[n]=s[n];return this.answer(e,i)},skipDelimiters:function(e,t,s){for(;s<e.length;s++)if(t.indexOf(e[s])<0)return s;return e.length+1},findDelimiters:function(e,t,s){for(;s<e.length;s++)if(t.indexOf(e[s])>=0)return s;return e.length+1},createSubstring:function(e,t,s){for(var i=e.slice(t,s),r=i.some((function(e){return e>=256})),n=this.vm.instantiateClass(r?this.wideStringClass:this.byteStringClass,i.length),a=n.bytes||n.words||[],o=0;o<i.length;o++)a[o]=i[o];return n},stringHash:function(e){for(var t=13312,s=0;s<e.length;s++){var i=16383&(t+=e[s]);t=9741*i+16384*(9741*Math.floor(t/16384)+101*i&16383)&268435455}return t},"primitiveStringConcatenate:":function(e){if(1!==e)return!1;for(var t=this.interpreterProxy.stackValue(e),s=this.interpreterProxy.stackValue(0),i=t.bytes||t.words||[],r=s.bytes||s.words||[],n=t.words||s.words||!1,a=this.vm.instantiateClass(n?this.wideStringClass:this.byteStringClass,i.length+r.length),o=a.bytes||a.words,c=0;c<i.length;c++)o[c]=i[c];for(var h=0;h<r.length;h++,c++)o[c]=r[h];return this.answer(e,a)},"primitiveStringAsciiCompare:":function(e){if(1!==e)return!1;for(var t=this.interpreterProxy.stackValue(0),s=this.interpreterProxy.stackValue(e),i=s.bytes||s.words||[],r=t.bytes||t.words||[],n=Math.min(i.length,r.length),a=0;a<n;a++){var o=i[a]-r[a];if(o>0)return this.answer(e,3);if(o<0)return this.answer(e,1)}return i.length>n?this.answer(e,3):r.length>n?this.answer(e,1):this.answer(e,2)},primitiveStringAsUppercase:function(e){if(0!==e)return!1;for(var t=this.interpreterProxy.stackValue(e),s=t.bytes||t.words||[],i=this.vm.instantiateClass(t.sqClass,s.length),r=t.bytes?i.bytes:i.words,n=0;n<s.length;n++)r[n]=String.fromCodePoint(s[n]).toUpperCase().codePointAt(0);return this.answer(e,i)},primitiveStringAsLowercase:function(e){if(0!==e)return!1;for(var t=this.interpreterProxy.stackValue(e),s=t.bytes||t.words||[],i=this.vm.instantiateClass(t.sqClass,s.length),r=t.bytes?i.bytes:i.words,n=0;n<s.length;n++)r[n]=String.fromCodePoint(s[n]).toLowerCase().codePointAt(0);return this.answer(e,i)},primitiveStringAsNumber:function(e){if(0!==e)return!1;var t=this.interpreterProxy.stackValue(e).asString(),s=null;if("NaN"===t)s=Number.NaN;else if("Infinity"===t)s=Number.POSITIVE_INFINITY;else if("-Infinity"===t)s=Number.NEGATIVE_INFINITY;else{var i=t.match(/^(\d+r)?(-?\d+(?:\.\d+)?(?:e-?\d)?)$/);if(i)if(i[1]){var r=Number.parseInt(i[1]);r>=2&&r<=36&&i[2].indexOf(".")<0&&i[2].indexOf("e")<0&&(s=Number.parseInt(i[2],r))}else s=+i[2]}return null!==s&&this.answer(e,s)},"primitiveStringFindTokens:":function(e){if(1!==e)return!1;for(var t=this.interpreterProxy.stackValue(e),s=t.bytes||t.words||[],i=this.interpreterProxy.stackValue(0),r=i.bytes||i.words||[],n=[],a=0;a<s.length;){var o=this.skipDelimiters(s,r,a);o<(a=this.findDelimiters(s,r,o))&&n.push(this.createSubstring(s,o,a))}return this.answer(e,n)},"primitiveStringIndexOf:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0),s=this.interpreterProxy.stackValue(e).asString();return this.answer(e,t.sqClass===this.characterClass?s.indexOf(String.fromCodePoint(t.hash))+1:0)},"primitiveStringIncludesSubstring:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(e).asString(),s=this.interpreterProxy.stackValue(0).asString();return this.answer(e,t.indexOf(s)>=0)},primitiveStringHash:function(e){if(0!==e)return!1;var t=this.interpreterProxy.stackValue(e),s=t.bytes||t.words||[],i=this.stringHash(s);return this.answer(e,i)},primitiveStringTrim:function(e){if(0!==e)return!1;this.interpreterProxy.stackValue(e);var t=this.interpreterProxy.stackValue(e).asString();return this.answer(e,t.trim())},primitiveStringTrimLeft:function(e){if(0!==e)return!1;this.interpreterProxy.stackValue(e);var t=this.interpreterProxy.stackValue(e).asString();return this.answer(e,t.trimStart())},primitiveStringTrimRight:function(e){if(0!==e)return!1;this.interpreterProxy.stackValue(e);var t=this.interpreterProxy.stackValue(e).asString();return this.answer(e,t.trimEnd())},"primitiveWideStringFrom:":function(e){if(1!==e)return!1;for(var t=this.interpreterProxy.stackValue(e),s=this.interpreterProxy.stackValue(0),i=s.bytes||s.words||[],r=this.vm.instantiateClass(t,i.length),n=r.words,a=0;a<i.length;a++)n[a]=i[a];return this.answer(e,r)},"primitiveJavaScriptObjectRegisterProxyClass:forClassName:":function(e){if(2!==e)return!1;var t=this.interpreterProxy.stackValue(1);if(t.isNil)return!1;var s=this.interpreterProxy.stackValue(0).asString();return!!s&&(this.globalProxyClasses[s]=t,Function.prototype.applyPassThrough||(Function.prototype.applyPassThrough=function(e,t){return this.apply(e,t)}),this.answerSelf(e))},getProxyClassFor:function(e){var t=e&&e.constructor;if(!t)return null;var s=Object.keys(this.globalProxyClasses);if(0===s.length)return null;for(var i=void 0;t;)i=s.find((function(e){return t.__cp_className===e||commonjsGlobal[e]===t})),t=i?null:Object.getPrototypeOf(t);return i||(i="Object"),this.globalProxyClasses[i]},"primitiveJavaScriptObjectApply:withArguments:resultAs:":function(e){if(3!==e)return!1;var t=this.interpreterProxy.stackValue(e).jsObj;if(void 0===t)return!1;var s=this.interpreterProxy.stackValue(2).asString();if(!s)return!1;var i=t.constructor===Function&&"applyPassThrough"===s?[null,this.interpreterProxy.stackValue(1).pointers[1].pointers.map((function(e){return e}))]:this.asJavaScriptObject(this.interpreterProxy.stackValue(1))||[],r=this.interpreterProxy.stackValue(0),n=void 0;try{this.lastException=null;var a=t[s];if(a&&a.apply)n=a.apply(t,i);else{var o=this.getSelectorNamed(t,s);if(!o){var c=s.indexOf(":");c>0&&(o=this.getSelectorNamed(t,s.slice(0,c)))}if(!o)return!1;if(o.get&&0===i.length)n=o.get.apply(t);else if(o.set&&1===i.length)n=o.set.apply(t,i);else if(o.value&&o.value.constructor===Function)n=o.value.apply(t,i);else{if(void 0===o.writable)return!1;0===i.length?n=o.value:1===i.length&&o.writable&&(n=t[s]=i[0])}}}catch(e){return this.lastException=e,!1}if(null!=n&&!r.isNil){var h=this.vm.instantiateClass(r,0);h.jsObj=n,n=h}return this.answer(e,n)},"primitiveJavaScriptObjectLastExceptionAs:":function(e){if(1!==e)return!1;var t=this.lastException;if(null!==t){var s=this.getProxyClassFor(t);s&&s!==this.globalProxyClasses.Object||(s=this.interpreterProxy.stackValue(0));var i=this.vm.instantiateClass(s,0);i.jsObj=t,t=i,this.lastException=null}return this.answer(e,t)},"primitiveJavaScriptObjectPropertyAt:resultAs:":function(e){if(2!==e)return!1;var t=this.interpreterProxy.stackValue(e).jsObj;if(void 0===t)return!1;var s=this.interpreterProxy.stackValue(1).asString(),i=this.interpreterProxy.stackValue(0),r=t[s];if(null!=r&&!i.isNil){var n=this.vm.instantiateClass(i,0);n.jsObj=r,r=n}return this.answer(e,r)},"primitiveJavaScriptObjectPropertyAt:put:":function(e){if(2!==e)return!1;var t=this.interpreterProxy.stackValue(e).jsObj;if(void 0===t)return!1;var s=this.interpreterProxy.stackValue(1).asString(),i=this.asJavaScriptObject(this.interpreterProxy.stackValue(0));return t[s]=i,this.answerSelf(e)},"primitiveJavaScriptObjectRawPropertyAt:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(e).jsObj;if(void 0===t)return!1;var s=t[this.interpreterProxy.stackValue(0).asString()];return null==s||s.isNil?(this.interpreterProxy.popthenPush(e+1,this.vm.nilObj),!0):!!(s.sqClass||"number"==typeof s&&s>=this.minSmallInteger&&s<=this.maxSmallInteger)&&(this.interpreterProxy.popthenPush(e+1,s),!0)},"primitiveJavaScriptObjectRawPropertyAt:put:":function(e){if(2!==e)return!1;var t=this.interpreterProxy.stackValue(e).jsObj;if(void 0===t)return!1;var s=this.interpreterProxy.stackValue(1).asString(),i=this.interpreterProxy.stackValue(0);return t[s]=i,this.answerSelf(e)},primitiveJavaScriptObjectGetSelectorNames:function(e){if(0!==e)return!1;var t=this.interpreterProxy.stackValue(e).jsObj;if(void 0===t)return!1;for(var s=Object.create(null);t;){Object.getOwnPropertyNames(t).forEach((function(e){s[e]=!0})),t=Object.getPrototypeOf(t)}return this.answer(e,Object.keys(s))},"primitiveJavaScriptObjectGetSelectorType:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(e).jsObj;if(void 0===t)return!1;var s=this.interpreterProxy.stackValue(0).asString();if(!s)return!1;var i=this.getSelectorNamed(t,s);if(!i)return this.answer(e,null);var r=void 0;return r=i.get?i.set?"read-write-prop":"read-prop":i.set?"write-prop":void 0!==i.writable?i.value&&i.value.constructor===Function?"function":i.writable?"read-write-attr":"read-attr":"unknown",this.answer(e,this.symbolFromString(r))},"primitiveJavaScriptObjectGetClassRefFrom:resultAs:":function(e){if(2!==e)return!1;var t=this.interpreterProxy.stackValue(e).jsObj;if(void 0===t)return!1;var s=this.interpreterProxy.stackValue(1).asString();if(!s)return!1;var i=this.interpreterProxy.stackValue(0);if(i.isNil)return!1;var r=t[s];if(!r)return!1;var n=this.vm.instantiateClass(i,0);return n.jsObj=r,this.answer(e,n)},getSelectorNamed:function(e,t){for(var s=void 0;e&&!s;)(s=Object.getOwnPropertyDescriptor(e,t))||(e=Object.getPrototypeOf(e));return s},"primitiveJavaScriptClassNewInstanceWithArguments:resultAs:":function(e){if(2!==e)return!1;var t=this.interpreterProxy.stackValue(e).jsObj,s=this.asJavaScriptObject(this.interpreterProxy.stackValue(1))||[],i=this.interpreterProxy.stackValue(0),r=void 0;try{var n=Reflect.construct(t,s);(r=this.vm.instantiateClass(i.isNil?this.getProxyClassFor(n):i,0)).jsObj=n}catch(e){console.error("Failed to instantiate class "+t,e)}return this.answer(e,r)},primitiveJavaScriptFunctionCurrentArguments:function(e){if(0!==e)return!1;var t=this.functionCalls[this.functionCalls.length-1];return void 0===t?(console.error("primitiveJavaScriptFunctionCurrentArguments called without a function present"),!1):this.answer(e,t.arguments)},"primitiveJavaScriptFunctionCurrentSetResult:":function(e){if(1!==e)return!1;var t=this.asJavaScriptObject(this.interpreterProxy.stackValue(0)),s=this.functionCalls[this.functionCalls.length-1];return void 0===s?(console.error("primitiveJavaScriptFunctionCurrentSetResult: called without a function present"),!1):(s.result=t,this.answerSelf(e))},"primitiveEnvironmentVariableAt:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0).asString();if(!t)return!1;var s=commonjsGlobal.sessionStorage.getItem(t);return this.answer(e,s)},"primitiveEnvironmentVariableAt:put:":function(e){if(2!==e)return!1;var t=this.interpreterProxy.stackValue(1).asString();if(!t)return!1;var s=this.interpreterProxy.stackValue(0).asString();return!!s&&(commonjsGlobal.sessionStorage.setItem(t,s),this.answerSelf(e))},primitiveEnvironmentVariableNames:function(e){if(0!==e)return!1;for(var t=new Array(commonjsGlobal.sessionStorage.length),s=0;s<commonjsGlobal.sessionStorage.length;s++)t[s]=commonjsGlobal.sessionStorage.key(s);return this.answer(e,t)},"primitiveEnvironmentRemoveVariableAt:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0).asString();return!!t&&(commonjsGlobal.sessionStorage.removeItem(t),this.answerSelf(e))},"primitiveEnvironmentPersistentVariableAt:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0).asString();if(!t)return!1;var s=commonjsGlobal.localStorage.getItem(t);return this.answer(e,s)},"primitiveEnvironmentPersistentVariableAt:put:":function(e){if(2!==e)return!1;var t=this.interpreterProxy.stackValue(1).asString();if(!t)return!1;var s=this.interpreterProxy.stackValue(0).asString();return!!s&&(commonjsGlobal.localStorage.setItem(t,s),this.answerSelf(e))},"primitiveEnvironmentRemovePersistentVariableAt:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0).asString();return!!t&&(commonjsGlobal.localStorage.removeItem(t),this.answerSelf(e))},"primitiveEnvironmentAlert:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0).asString();return commonjsGlobal.alert?commonjsGlobal.alert(t):console.warn(t),this.answerSelf(e)},"primitiveEnvironmentConfirm:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(0).asString();return!!commonjsGlobal.confirm&&this.answer(e,!0===commonjsGlobal.confirm(t))},"primitiveEnvironmentGlobalApply:withArguments:":function(e){if(2!==e)return!1;var t=this.interpreterProxy.stackValue(1).asString();if(!t)return!1;var s=this.asJavaScriptObject(this.interpreterProxy.stackValue(0))||[],i=commonjsGlobal[t];if(!i||!i.apply)return!1;var r=void 0;try{r=i.apply(commonjsGlobal,s)}catch(e){console.error("Failed to perform apply:withArguments on global object:",e,"Selector:",t,"Arguments:",s)}return this.answer(e,r)},primitiveEnvironmentReload:function(e){return 0===e&&("undefined"!=typeof window&&(window.document.location.reload(!0),this.answerSelf(e)))},"primitiveWebSocketConnectToUrl:withEventSemaphore:":function(e){if(2!==e)return!1;var t=this.interpreterProxy.stackValue(e),s=this.interpreterProxy.stackValue(1).asString(),i=this.interpreterProxy.stackIntegerValue(0);return t.webSocketHandle={webSocket:new WebSocket(s),url:s,semaIndex:i,buffers:[]},this.setupWebSocket(t.webSocketHandle),this.answerSelf(e)},setupWebSocket:function(e){var t=this,s=e.webSocket;s.onopen=function(){t.signalSemaphoreWithIndex(e.semaIndex)},s.onclose=function(){t.signalSemaphoreWithIndex(e.semaIndex)},s.onerror=function(s){console.error("Failure on WebSocket for url ["+e.url+"]: ",s),t.signalSemaphoreWithIndex(e.semaIndex)},s.onmessage=function(s){new Response(s.data).arrayBuffer().then((function(s){e.buffers.push(new Uint8Array(s)),t.signalSemaphoreWithIndex(e.semaIndex),t.vm.forceInterruptCheck()})).catch((function(s){console.error("Failed to read websocket message",s),t.signalSemaphoreWithIndex(e.semaIndex)}))}},primitiveWebSocketReceivedMessage:function(e){if(0!==e)return!1;var t=this.interpreterProxy.stackValue(e).webSocketHandle;if(!t)return!1;var s=t.buffers.splice(0,1)[0],i=s?this.primHandler.makeStByteArray(s):this.vm.nilObj;return this.answer(e,i)},"primitiveWebSocketSend:":function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackValue(e),s=this.interpreterProxy.stackObjectValue(0),i=t.webSocketHandle;if(!i)return!1;var r=!1;if(1===i.webSocket.readyState)try{i.webSocket.send(s.bytes),r=!0}catch(e){console.error("Failed to write websocket message",e),this.signalSemaphoreWithIndex(i.semaIndex)}return this.answer(e,r)},primitiveWebSocketReadyState:function(e){if(0!==e)return!1;var t=this.interpreterProxy.stackValue(e).webSocketHandle;if(!t)return!1;var s=t.webSocket.readyState;return this.answer(e,s)},primitiveWebSocketClose:function(e){if(0!==e)return!1;var t=this.interpreterProxy.stackValue(e).webSocketHandle;if(!t)return!1;var s=!1;try{t.webSocket&&(t.webSocket.close(),s=!0)}catch(e){console.error("Failed to close websocket",e),this.signalSemaphoreWithIndex(t.semaIndex)}return this.answer(e,s)}}}function registerCpSystemPlugin(){"object"==typeof Squeak&&Squeak.registerExternalModule?Squeak.registerExternalModule("CpSystemPlugin",CpSystemPlugin()):self.setTimeout(registerCpSystemPlugin,100)}Object.assign(self,{localStorage:{},sessionStorage:new SessionStorage,WebSocket:"undefined"==typeof WebSocket?requireWebSocket():WebSocket,sha1:requireSha1(),btoa:function(e){return Buffer.from(e,"ascii").toString("base64")},atob:function(e){return Buffer.from(e,"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(e){try{return require("./plugins/"+e),Squeak.externalModules[e]}catch(t){console.error("Plugin "+e+" could not be loaded")}}}),fs.readFile(root+imageName+".image",(function(e,t){if(e)console.error("Failed to read image",e);else{var s=new Squeak.Image(root+imageName);s.readFromBuffer(t.buffer,(function(){var e={vmOptions:["-vm-display-null","-nodisplay"]},t=new Squeak.Interpreter(s,e);t.processLoopCounter=0,t.runProcessLoop=function(s){if(!0===s){if(!t.stoppedProcessLoop)return;t.stoppedProcessLoop=!1,t.processLoopCounter=0}try{t.interpret(50,(function(s){if("sleep"===s){if(t.stoppedProcessLoop)return;++t.processLoopCounter>7&&(t.stoppedProcessLoop=!0)}else t.processLoopCounter=0;!ignoreQuit&&e.quitFlag||setTimeout(t.runProcessLoop,"sleep"===s?10:s)}))}catch(e){console.error("Failure during Squeak run: ",e)}},t.runProcessLoop()}))}})),function(){var e=1,t=11;function s(e){return"number"==typeof e?h.classSmallInteger():e.sqClass}function i(e){return e.bytes?e.bytes.length:e.words?4*e.words.length:0}function r(e,t){return 0|Math.floor(e/t)}function n(e,t){return e-r(e,t)*t|0}function a(e,t){return t>31?0:e<<t}function o(e,t){return t>31?0:e>>>t}var c=0,h=null,u="LargeIntegers v1.5 (e)",l=1,p=2;function m(e,t,s){var r,c,u,l,p,m,d,f;if(t<1||s<1)return h.primitiveFail();if(c=e,m=Math.min(s,function(e){return b(e.bytes,i(e))}(c)),t>m)return!1;if(p=1+(t-1>>3),r=1+(m-1>>3),l=n(t-1,8),u=7-n(m-1,8),p===r)return d=a(255,l)&o(255,u),0!=(A(c,p)&d);if(0!==o(A(c,p),l))return!0;for(f=p+1;f<=r-1;f++)if(0!==A(c,f))return!0;return 0!=(255&a(A(c,r),u))}function d(e,t){var r,n,a;return a=h.instantiateClassindexableSize(s(e),t),n=(r=i(e))<t?r:t,g(e.bytes,a.bytes,n),a}function f(e,t){var s,i,r;return"number"==typeof e?(s=(i=e)<0?h.classLargeNegativeInteger():h.classLargePositiveInteger(),function(e,t){var s,i,r;for(s=t.bytes,i=1,r=k(e);i<=r;i++)s[i-1]=S(e,i)}(i,r=h.instantiateClassindexableSize(s,t))):r=d(e,t),r}function v(e,t,s){var i,r,n;for(n=s-1;n>=0;){if((r=t[n])!==(i=e[n]))return r<i?1:-1;--n}return 0}function g(e,t,s){var i,r;for(i=s-1,r=0;r<=i;r++)t[r]=e[r];return 0}function b(e,t){var s,i;for(i=t;0===(s=e[i-1]);)if(0==--i)return 0;return y(s)+8*(i-1)}function k(e){return e<256&&e>-256?1:e<65536&&e>-65536?2:e<16777216&&e>-16777216?3:4}function S(e,t){return t<1&&h.primitiveFail(),t>4?0:e<0?255&o(0-e,8*(t-1)):255&o(e,8*(t-1))}function C(e,t,s,i,r){return function(){for(var n=s-t+1,a=0;a<n;a++)e[a+t]=i[a+r];return 0}()}function y(e){var t,s;return s=0,(t=e)<65536||(t>>>=16,s+=16),t<256||(t>>>=8,s+=8),t<16||(t>>>=4,s+=4),t<4||(t>>>=2,s+=2),t<2||(t>>>=1,++s),s+t}function O(e){var t,s,i,r,n,a;for(n=(a=e)<0?h.classLargeNegativeInteger():h.classLargePositiveInteger(),t=k(a),i=(s=h.instantiateClassindexableSize(n,t)).bytes,r=1;r<=t;r++)i[r-1]=S(a,r);return s}function I(e,t){var r,c,u,l;return c=i(e),0===(l=b(e.bytes,c))?0:(r=l+t+7>>3,u=h.instantiateClassindexableSize(s(e),r),function(e,t,s,i,r){var c,h,u,l,p,m,d;for(c=e>>3,p=n(e,8),d=c-1,l=0;l<=d;l++)i[l]=0;if(0===p)return C(i,c,r-1,t,0);for(m=8-p,h=0,d=s-1,l=0;l<=d;l++)u=t[l],i[l+c]=255&(h|a(u,p)),h=o(u,m);0!==h&&(i[r-1]=h)}(t,e.bytes,c,u.bytes,r),u)}function P(e,t,i){var r,c,u,l,p;return c=(p=b(e.bytes,i))+7>>3,(l=p-t)<=0?h.instantiateClassindexableSize(s(e),0):(u=l+7>>3,r=h.instantiateClassindexableSize(s(e),u),function(e,t,s,i,r){var c,h,u,l,p,m,d,f;if(h=e>>3,0===(p=n(e,8)))return C(i,0,r-1,t,h);for(m=8-p,u=o(t[h],p),d=s-1,c=f=h+1;c<=d;c++)l=t[c],i[c-f]=255&(u|a(l,m)),u=o(l,p);0!==u&&(i[r-1]=u)}(t,e.bytes,c,r.bytes,u),r)}function _(e,t){var r,n,a,o,c,u,l,p,m,d;return p=i(e),m=i(t),c=s(e),p<=m?(o=e,n=p,d=t,l=m):(o=t,n=m,d=e,l=p),r=h.instantiateClassindexableSize(c,l),a=function(e,t,s,i,r){var n,a,o;for(o=0,a=t-1,n=0;n<=a;n++)o=(o>>>8)+e[n]+s[n],r[n]=255&o;for(a=i-1,n=t;n<=a;n++)o=(o>>>8)+s[n],r[n]=255&o;return o>>>8}(o.bytes,n,d.bytes,l,r.bytes),a>0&&(u=h.instantiateClassindexableSize(c,l+1),g(r.bytes,u.bytes,l),(r=u).bytes[l]=a),r}function x(e,t,r){var n,a,o,u,m,d,f,v,g;if("number"==typeof e){if(e<0)return h.primitiveFail();o=O(e)}else{if(s(e)===h.classLargeNegativeInteger())return h.primitiveFail();o=e}if("number"==typeof t){if(t<0)return h.primitiveFail();u=O(t)}else{if(s(t)===h.classLargeNegativeInteger())return h.primitiveFail();u=t}return(f=i(o))<(v=i(u))?(n=f,a=o,m=v,d=u):(n=v,a=u,m=f,d=o),g=h.instantiateClassindexableSize(h.classLargePositiveInteger(),m),function(e,t,s,i,r,n){var a,o;if(o=s-1,e===c){for(a=0;a<=o;a++)n[a]=t[a]&i[a];for(o=r-1,a=s;a<=o;a++)n[a]=0;return 0}if(e===l){for(a=0;a<=o;a++)n[a]=t[a]|i[a];for(o=r-1,a=s;a<=o;a++)n[a]=i[a];return 0}if(e===p){for(a=0;a<=o;a++)n[a]=t[a]^i[a];for(o=r-1,a=s;a<=o;a++)n[a]=i[a];return 0}h.primitiveFail()}(r,a.bytes,n,d.bytes,m,g.bytes),h.failed()?0:M(g)}function q(e,t){var s,r;return r=i(e),(s=i(t))!==r?s>r?-1:1:v(e.bytes,t.bytes,r)}function w(e,t,s){var a,o,c,u,l,p,m,d,v;return v=i(e),d=i(t),a=s?h.classLargeNegativeInteger():h.classLargePositiveInteger(),(m=v-d+1)<=0?(o=h.instantiateClassindexableSize(h.classArray(),2),h.stObjectatput(o,1,0),h.stObjectatput(o,2,e),o):(u=f(u=I(t,p=8-y(pe(t,d))),j(u)+1),j(c=I(e,p))===v&&(c=f(c,v+1)),l=h.instantiateClassindexableSize(a,m),function(e,t,s,i,a,o){var c,h,u,l,p,m,d,f,v,g,b,k,S,C,y,O,I,P;for(y=o,I=e[(C=t-1)-1],l=1===C?0:e[C-2],b=1;b<=y;b++){if(s[(k=i+1-b)-1]===I)h=255;else for(P=n(O=((O=s[k-1])<<8)+s[k-2],I),m=(f=(h=r(O,I))*l)>>>8,p=255&f,d=k<3?0:s[k-3];P<m||P===m&&d<p?(--h,p<l?(--m,p=p+256-l):p-=l,v=m>=I):v=!1,v;)m-=I;for(g=k-C,u=0,S=1;S<=t;S++)m=e[S-1]*(h>>>8),p=e[S-1]*(255&h),c=s[g-1]-u-(255&p),s[g-1]=255&c,u=m+(p>>>8)-(c>>=8),++g;if(u>0)for(--h,g=k-C,u=0,S=1;S<=t;S++)u=(u>>>8)+s[g-1]+e[S-1],s[g-1]=255&u,++g;a[o-b]=h}}(u.bytes,j(u),c.bytes,j(c),l.bytes,j(l)),c=P(c,p,j(u)-1),o=h.instantiateClassindexableSize(h.classArray(),2),h.stObjectatput(o,1,l),h.stObjectatput(o,2,c),o)}function j(e){return"number"==typeof e?k(e):i(e)}function N(e,t,s,r){var n,a,o,c;return o=i(e),c=i(t),o<=(a=i(s))&&c<=a&&r>=0&&r<=255?(n=h.instantiateClassindexableSize(h.classLargePositiveInteger(),a),function(e,t,s,i,r,n,a,o){var c,h,u,l,p,m,d,f;for(m=t-1,p=i-1,l=n-1,u=0,h=0;h<=m;h++){for(f=o[0]+e[h]*s[0],f+=(d=f*a&255)*r[0],c=1;c<=p;c++)f=(f>>>8)+o[c]+e[h]*s[c]+d*r[c],o[c-1]=255&f;for(c=i;c<=l;c++)f=(f>>>8)+o[c]+d*r[c],o[c-1]=255&f;f=(f>>>8)+u,o[l]=255&f,u=f>>>8}for(h=t;h<=l;h++){for(f=o[0],f+=(d=f*a&255)*r[0],c=1;c<=l;c++)f=(f>>>8)+o[c]+d*r[c],o[c-1]=255&f;f=(f>>>8)+u,o[l]=255&f,u=f>>>8}if(0!==u||1!==v(r,o,n))for(f=0,h=0;h<=l;h++)f=f+o[h]-r[h],o[h]=255&f,f>>=8}(e.bytes,o,t.bytes,c,s.bytes,a,r,n.bytes),M(n)):h.primitiveFail()}function F(e,t,s){var r,n,a,o,c,u,l,p;return(p=i(e))<=(l=i(t))?(o=e,a=p,r=t,c=l):(o=t,a=l,r=e,c=p),n=s?h.classLargeNegativeInteger():h.classLargePositiveInteger(),u=h.instantiateClassindexableSize(n,c+a),function(e,t,s,i,r){var n,a,o,c,h,u,l,p;if(1===t&&0===e[0])return 0;if(1===i&&0===s[0])return 0;for(p=t-1,u=i-1,h=0;h<=p;h++)if(0!==(o=e[h])){for(l=h,c=0,a=0;a<=u;a++)c=(n=(n=s[a])*o+c+r[l])>>>8,r[l]=255&n,++l;r[l]=c}}(o.bytes,a,r.bytes,c,u.bytes),R(u)}function A(e,t){return t>i(e)?0:pe(e,t)}function V(e,t){var r,n,a,o,c,u,l,p,m,d;if(l=s(e)===h.classLargeNegativeInteger(),(p=i(e))===(m=i(t))){for(;p>1&&A(e,p)===A(t,p);)--p;m=p}return p<m||p===m&&A(e,p)<A(t,p)?(n=t,u=m,o=e,r=p,d=!1===l):(n=e,u=p,o=t,r=m,d=l),c=u,a=h.instantiateClassindexableSize(d?h.classLargeNegativeInteger():h.classLargePositiveInteger(),c),function(e,t,s,i,r){var n,a;for(a=0,n=0;n<=t-1;n++)a=a+s[n]-e[n],r[n]=255&a,a>>=8;for(n=t;n<=i-1;n++)a+=s[n],r[n]=255&a,a>>=8}(o.bytes,r,n.bytes,u,a.bytes),d?T(a):M(a)}function B(){return u}function L(e){var t,i,r;if("number"==typeof e)return!0;if(0===(i=j(e)))return!1;if(0===pe(e,i))return!1;if(4,i>4)return!0;if(i<4)return!1;if(s(e)===h.classLargePositiveInteger())return 1073741823,pe(e,4)>S(1073741823,4);if(r=-1073741824,pe(e,4)<S(r,4))return!1;for(t=1;t<=4;t++)if(pe(e,t)!==S(r,t))return!0;return!1}function R(e){return s(e)===h.classLargePositiveInteger()?M(e):T(e)}function T(e){var t,s,i,r,n;for(s=r=j(e);0!==s&&0===pe(e,s);)--s;if(0===s)return 0;if(4,s<=4){if(i=-1073741824,s<4||A(e,4)<S(i,4)){for(n=0,t=s;t>=1;t+=-1)n=256*n-pe(e,t);return n}for(t=1;t<=4;t++)if(A(e,t)!==S(i,t))return s<r?d(e,s):e;return i}return s<r?d(e,s):e}function M(e){var t,s,i,r;for(s=r=j(e);0!==s&&0===pe(e,s);)--s;if(0===s)return 0;if(4,s<=4&&A(e,4)<=S(1073741823,4)){for(i=0,t=s;t>=1;t+=-1)i=256*i+pe(e,t);return i}return s<r?d(e,s):e}function E(){var e,t,s,i;return t=h.stackIntegerValue(1),s=h.stackIntegerValue(0),h.success(h.isKindOfInteger(h.stackValue(2))),e=h.stackValue(2),h.failed()?null:(i=m("number"==typeof e?O(e):e,t,s)?h.trueObject():h.falseObject(),h.failed()||h.popthenPush(3,i),null)}function D(){var e,t;return h.success(h.isKindOfInteger(h.stackValue(0))),e=h.stackValue(0),h.failed()?null:"number"==typeof e?(t=O(e),h.failed()||h.popthenPush(2,t),null):(h.failed()||h.popthenPush(2,e),null)}function W(){var e;return e=h.trueObject(),h.failed()||h.popthenPush(1,e),null}function z(){var e,t,s,r;return h.success(h.isKindOfInteger(h.stackValue(1))),t=h.stackValue(1),s=h.stackIntegerValue(0),h.failed()?null:(e="number"==typeof t?O(t):t,s>=0?(r=I(e,s),h.failed()||h.popthenPush(3,r),null):(r=R(P(e,0-s,i(e))),h.failed()||h.popthenPush(3,r),null))}function K(){var e,t,s;return h.success(h.isKindOfInteger(h.stackValue(0))),t=h.stackValue(0),h.success(h.isKindOfInteger(h.stackValue(1))),e=h.stackValue(1),h.failed()?null:(s=_("number"==typeof e?O(e):e,"number"==typeof t?O(t):t),h.failed()||h.popthenPush(2,s),null)}function H(){var e,t,s;return h.success(h.isKindOfInteger(h.stackValue(1))),e=h.stackValue(1),h.success(h.isKindOfInteger(h.stackValue(0))),t=h.stackValue(0),h.failed()?null:(s=_("number"==typeof e?O(e):e,"number"==typeof t?O(t):t),h.failed()||h.popthenPush(3,s),null)}function U(){var e,t,s;return h.success(h.isKindOfInteger(h.stackValue(0))),t=h.stackValue(0),h.success(h.isKindOfInteger(h.stackValue(1))),e=h.stackValue(1),h.failed()?null:(s=x(e,t,c),h.failed()||h.popthenPush(2,s),null)}function G(){var e,t,s,i;return h.success(h.isKindOfInteger(h.stackValue(2))),e=h.stackValue(2),h.success(h.isKindOfInteger(h.stackValue(1))),t=h.stackValue(1),s=h.stackIntegerValue(0),h.failed()?null:(i=x(e,t,s),h.failed()||h.popthenPush(4,i),null)}function $(){var e,t,s;return h.success(h.isKindOfInteger(h.stackValue(0))),t=h.stackValue(0),h.success(h.isKindOfInteger(h.stackValue(1))),e=h.stackValue(1),h.failed()?null:(s=x(e,t,l),h.failed()||h.popthenPush(2,s),null)}function J(){var e,t,s,r;return s=h.stackIntegerValue(0),h.success(h.isKindOfInteger(h.stackValue(1))),t=h.stackValue(1),h.failed()?null:(e="number"==typeof t?O(t):t,s>=0?(r=I(e,s),h.failed()||h.popthenPush(2,r),null):(r=R(P(e,0-s,i(e))),h.failed()||h.popthenPush(2,r),null))}function X(){var e,t,s,r;return s=h.stackIntegerValue(0),h.success(h.isKindOfInteger(h.stackValue(1))),t=h.stackValue(1),h.failed()?null:(e="number"==typeof t?O(t):t,s>=0?(r=I(e,s),h.failed()||h.popthenPush(2,r),null):(r=R(P(e,0-s,i(e))),h.failed()||h.popthenPush(2,r),null))}function Y(){var e,t,s;return h.success(h.isKindOfInteger(h.stackValue(0))),t=h.stackValue(0),h.success(h.isKindOfInteger(h.stackValue(1))),e=h.stackValue(1),h.failed()?null:(s=x(e,t,p),h.failed()||h.popthenPush(2,s),null)}function Q(){var e,t,s,i,r;return h.success(h.isKindOfInteger(h.stackValue(0))),i=h.stackValue(0),h.success(h.isKindOfInteger(h.stackValue(1))),t=h.stackValue(1),h.failed()?null:"number"==typeof t?"number"==typeof i?(e=t)>(s=i)?(r=1,h.failed()||h.popthenPush(2,r),null):e<s?(r=-1,h.failed()||h.popthenPush(2,r),null):(r=0,h.failed()||h.popthenPush(2,r),null):(r=-1,h.failed()||h.popthenPush(2,r),null):"number"==typeof i?(r=1,h.failed()||h.popthenPush(2,r),null):(r=q(t,i),h.failed()||h.popthenPush(2,r),null)}function Z(){var e,t,s,i,r;return h.success(h.isKindOfInteger(h.stackValue(1))),s=h.stackValue(1),h.success(h.isKindOfInteger(h.stackValue(0))),i=h.stackValue(0),h.failed()?null:"number"==typeof s?"number"==typeof i?(e=s)>(t=i)?(r=1,h.failed()||h.popthenPush(3,r),null):e<t?(r=-1,h.failed()||h.popthenPush(3,r),null):(r=0,h.failed()||h.popthenPush(3,r),null):(r=-1,h.failed()||h.popthenPush(3,r),null):"number"==typeof i?(r=1,h.failed()||h.popthenPush(3,r),null):(r=q(s,i),h.failed()||h.popthenPush(3,r),null)}function ee(){var e,t,s,i,r,n;if(h.success(h.isKindOfInteger(h.stackValue(1))),i=h.stackValue(1),r=h.booleanValueOf(h.stackValue(0)),h.success(h.isKindOfInteger(h.stackValue(2))),t=h.stackValue(2),h.failed())return null;if(!L(t))return h.primitiveFail(),null;if(!L(i))return h.primitiveFail(),null;if(e="number"==typeof t?O(t):t,"number"==typeof i){if(0===i)return h.primitiveFail(),null;s=O(i)}else s=i;return n=w(e,s,r),h.failed()||h.popthenPush(3,n),null}function te(){var e,t,s,i,r,n;if(h.success(h.isKindOfInteger(h.stackValue(2))),s=h.stackValue(2),h.success(h.isKindOfInteger(h.stackValue(1))),i=h.stackValue(1),r=h.booleanValueOf(h.stackValue(0)),h.failed())return null;if(e="number"==typeof s?O(s):s,"number"==typeof i){if(0===i)return h.primitiveFail(),null;t=O(i)}else t=i;return n=w(e,t,r),h.failed()||h.popthenPush(4,n),null}function se(){var e,t,s,i;return h.success(h.isKindOfInteger(h.stackValue(1))),t=h.stackValue(1),s=h.booleanValueOf(h.stackValue(0)),h.success(h.isKindOfInteger(h.stackValue(2))),e=h.stackValue(2),h.failed()?null:(i=F("number"==typeof e?O(e):e,"number"==typeof t?O(t):t,s),h.failed()||h.popthenPush(3,i),null)}function ie(){var e,t,s,i;return h.success(h.isKindOfInteger(h.stackValue(2))),e=h.stackValue(2),h.success(h.isKindOfInteger(h.stackValue(1))),t=h.stackValue(1),s=h.booleanValueOf(h.stackValue(0)),h.failed()?null:(i=F("number"==typeof e?O(e):e,"number"==typeof t?O(t):t,s),h.failed()||h.popthenPush(4,i),null)}function re(){var e,t,s;return h.success(h.isKindOfInteger(h.stackValue(0))),t=h.stackValue(0),h.success(h.isKindOfInteger(h.stackValue(1))),e=h.stackValue(1),h.failed()?null:(s=V("number"==typeof e?O(e):e,"number"==typeof t?O(t):t),h.failed()||h.popthenPush(2,s),null)}function ne(){var e,t,s;return h.success(h.isKindOfInteger(h.stackValue(1))),e=h.stackValue(1),h.success(h.isKindOfInteger(h.stackValue(0))),t=h.stackValue(0),h.failed()?null:(s=V("number"==typeof e?O(e):e,"number"==typeof t?O(t):t),h.failed()||h.popthenPush(3,s),null)}function ae(){var e,t,s,i;for(t=B().length,e=(i=h.instantiateClassindexableSize(h.classString(),t)).bytes,s=0;s<=t-1;s++)e[s]=B()[s];return h.failed()||h.popthenPush(1,i),null}function oe(){var e,t,s,i,r;return h.success(h.isKindOfInteger(h.stackValue(2))),t=h.stackValue(2),h.success(h.isKindOfInteger(h.stackValue(1))),s=h.stackValue(1),i=h.stackIntegerValue(0),h.success(h.isKindOfInteger(h.stackValue(3))),e=h.stackValue(3),h.failed()?null:(r=N("number"==typeof e?O(e):e,"number"==typeof t?O(t):t,"number"==typeof s?O(s):s,i),h.failed()||h.popthenPush(4,r),null)}function ce(){var e,t;return h.success(h.isKindOfInteger(h.stackValue(0))),e=h.stackValue(0),h.failed()?null:"number"==typeof e?(h.failed()||h.popthenPush(2,e),null):(t=R(e),h.failed()||h.popthenPush(2,t),null)}function he(){var e,t;return h.success(h.stackValue(0).sqClass===h.classLargeNegativeInteger()),e=h.stackValue(0),h.failed()?null:(t=T(e),h.failed()||h.popthenPush(1,t),null)}function ue(){var e,t;return h.success(h.stackValue(0).sqClass===h.classLargePositiveInteger()),e=h.stackValue(0),h.failed()?null:(t=M(e),h.failed()||h.popthenPush(1,t),null)}function le(s){return!1!=((h=s).majorVersion()==e)&&h.minorVersion()>=t}function pe(e,t){return e.bytes[t-1]}!function e(){"object"==typeof Squeak&&Squeak.registerExternalModule?Squeak.registerExternalModule("LargeIntegers",{primDigitAddWith:H,primDigitBitShiftMagnitude:X,primGetModuleName:ae,primDigitBitLogicWithOp:G,primCheckIfCModuleExists:W,primDigitCompare:Q,primDigitMultiplyNegative:se,primDigitBitShift:J,primNormalizePositive:ue,primDigitSubtractWith:ne,_primDigitBitShift:z,primDigitMultiplyWithNegative:ie,primDigitSubtract:re,primDigitDivNegative:ee,primNormalizeNegative:he,primDigitBitOr:$,primMontgomeryTimesModulo:oe,primDigitBitAnd:U,primDigitDivWithNegative:te,setInterpreter:le,primNormalize:ce,primDigitBitXor:Y,primDigitCompareWith:Z,primDigitAdd:K,getModuleName:B,primAsLargeInteger:D,primAnyBitFromTo:E}):self.setTimeout(e,100)}()}(),registerCpSystemPlugin(),module.exports=node_app;