diff --git a/plopp-b3daccel-plugin.js b/plopp-b3daccel-plugin.js index fd37176..794938c 100644 --- a/plopp-b3daccel-plugin.js +++ b/plopp-b3daccel-plugin.js @@ -53,8 +53,12 @@ function B3DAcceleratorPlugin() { var canvas = document.createElement("canvas"); canvas.width = w; canvas.height = h; + // this is for Plopp, we ignore the actual rectangle canvas.style.position = "absolute"; canvas.style.backgroundColor = "transparent"; + canvas.style.width = "100%" + canvas.style.height = "100%" + canvas.style.objectFit = "contain"; document.body.appendChild(canvas); var options = { depth: true, alpha: false, antialias: true }; if (flags & B3D_STENCIL_BUFFER) options.stencil = true; @@ -190,7 +194,7 @@ function B3DAcceleratorPlugin() { console.log("B3DAccel: primitiveSwapRendererBuffers", handle); // let browser display the rendered frame this.interpreterProxy.vm.breakNow(); - debugger; + // debugger; // wait after each frame this.interpreterProxy.pop(argCount); return true; }, diff --git a/plopp-opengl.js b/plopp-opengl.js index 43f5eee..a911d3d 100644 --- a/plopp-opengl.js +++ b/plopp-opengl.js @@ -15,83 +15,33 @@ // helpful constant lookup: // https://javagl.github.io/GLConstantsTranslator/GLConstantsTranslator.html -function OpenGL() { - "use strict"; +// TODO +// [ ] optimize list compilation glBegin/glEnd - function transformPoint(matrix, src, dst) { - var x = src[0]; - var y = src[1]; - var z = src[2]; - var rx = x * matrix[0] + y * matrix[1] + z * matrix[2] + matrix[3]; - var ry = x * matrix[4] + y * matrix[5] + z * matrix[6] + matrix[7]; - var rz = x * matrix[8] + y * matrix[9] + z * matrix[10] + matrix[11]; - var rw = x * matrix[12] + y * matrix[13] + z * matrix[14] + matrix[15]; - if (rw === 1) { - dst[0] = rx; - dst[1] = ry; - dst[2] = rz; - } else { - if (rw !== 0) rw = 1 / rw; - dst[0] = rx * rw; - dst[1] = ry * rw; - dst[2] = rz * rw; - } - dst[3] = src[3]; - } +// OpenGL 1.0 constants (many missing in WebGL) +var GL; +var GL_Symbols; // reverse mapping for debug printing +initGLConstants(); - function multMatrix(m1, m2) { - for (var row = 0; row < 16; row += 4) { - var c0 = m1[row+0] * m2[0] + m1[row+1] * m2[4] + m1[row+2] * m2[8] + m1[row+3] * m2[12]; - var c1 = m1[row+0] * m2[1] + m1[row+1] * m2[5] + m1[row+2] * m2[9] + m1[row+3] * m2[13]; - var c2 = m1[row+0] * m2[2] + m1[row+1] * m2[6] + m1[row+2] * m2[10] + m1[row+3] * m2[14]; - var c3 = m1[row+0] * m2[3] + m1[row+1] * m2[7] + m1[row+2] * m2[11] + m1[row+3] * m2[15]; - m1[row+0] = c0; - m1[row+1] = c1; - m1[row+2] = c2; - m1[row+3] = c3; - } - } +var identity = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, +]); - function translateMatrix(m, x, y, z) { - m[12] += x * m[0] + y * m[4] + z * m[8]; - m[13] += x * m[1] + y * m[5] + z * m[9]; - m[14] += x * m[2] + y * m[6] + z * m[10]; - m[15] += x * m[3] + y * m[7] + z * m[11]; - } - - var identity = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1, - ]); - - // OpenGL constants missing in WebGL - var GL_ALPHA_TEST = 3008; - var GL_BGRA = 32993; - var GL_LIGHTING = 2896; - var GL_LIGHT0 = 16384; - var GL_LIGHT1 = 16385; - var GL_LIGHT2 = 16386; - var GL_LIGHT3 = 16387; - var GL_LIGHT4 = 16388; - var GL_LIGHT5 = 16389; - var GL_LIGHT6 = 16390; - var GL_LIGHT7 = 16391; - var GL_LIST_INDEX = 2867; - var GL_TEXTURE_COMPRESSED = 34465; - var GL_QUADS = 7; - var GL_QUAD_STRIP = 8; - var GL_POLYGON = 9; - var GL_UNPACK_LSB_FIRST = 3313; - var GL_UNPACK_ROW_LENGTH = 3314; - var GL_UNPACK_SKIP_ROWS = 3315; - var GL_UNPACK_SKIP_PIXELS = 3316; +function OpenGL() { + "use strict"; // Primitive attributes for glBegin/glEnd - var HAS_NORMAL = 1; - var HAS_COLOR = 2; - var HAS_TEXCOORD = 4; + var HAS_NORMAL = 1 << 0; + var HAS_COLOR = 1 << 1; + var HAS_TEXCOORD = 1 << 2; + + // more flags for selecting shader + var HAS_TEXTURE = 1 << 3; + var HAS_LIGHTING = 1 << 4; + var HAS_ALPHA_TEST = 1 << 5; // Emulated OpenGL state var gl = { @@ -104,19 +54,21 @@ function OpenGL() { texCoord: new Float32Array(2), primitive: null, // for glBegin/glEnd primitiveAttrs: 0, // for glVertex - shaders: {}, // shader programs by vertex attributes - matrix: null, // current matrix (modelView or projection) - modelView: new Float32Array(identity), - projection: new Float32Array(identity), + shaders: {}, // shader programs by attr/flags + matrixMode: 0, // current matrix mode + matrices: {}, // matrix stacks by mode + matrix: null, // current matrix (matrices[mode][0]) lighting: false, - lights: [], // light state + lights: [], // light states material: null, // material state - textureId: 0, // texture id generator + textureIdGen: 0, // texture id generator textures: {}, // webgl texture objects by id - textureUnit: null, // active texture unit - textureUnits: [], // texture unit state - listId: 0, // display list id generator + texture: null, // texture + textureEnabled: false, // texture enabled + listIdGen: 0, // display list id generator lists: {}, // display lists by id + list: null, // current display list + listMode: 0, // current display list mode pixelStoreUnpackRowLength: 0, pixelStoreUnpackSkipRows: 0, pixelStoreUnpackSkipPixels: 0, @@ -125,6 +77,12 @@ function OpenGL() { var webgl; // the actual WebGL context return { + ffiFunctionNotFoundHandler: function(name, args) { + console.warn("OpenGL: UNIMPLEMENTED (missing) " + name, args); + debugger + return null; // do not fail but return nil + }, + initialiseModule: function() { console.log("OpenGL: initialiseModule"); // get the context from B3DAcceleratorPlugin @@ -133,14 +91,20 @@ function OpenGL() { if (!B3DAcceleratorPlugin) throw Error("OpenGL: B3DAcceleratorPlugin not loaded"); webgl = B3DAcceleratorPlugin.webglContext; console.log("OpenGL: got context from B3DAcceleratorPlugin", webgl); - var spector = new SPECTOR.Spector(); - spector.captureContext(webgl); - spector.displayUI(); + // if Spector script is loaded, capture WebGL calls + if (typeof SPECTOR !== "undefined") { + var spector = new SPECTOR.Spector(); + spector.captureContext(webgl); + spector.displayUI(); + } // for debug access this.webgl = webgl; this.gl = gl; // set initial state - gl.matrix = gl.modelView; + gl.matrices[GL.MODELVIEW] = [new Float32Array(identity)]; + gl.matrices[GL.PROJECTION] = [new Float32Array(identity)]; + gl.matrixMode = GL.MODELVIEW; + gl.matrix = gl.matrices[gl.matrixMode][0]; gl.color.set([1, 1, 1, 1]); for (var i = 0; i < 8; i++) { gl.lights[i] = { @@ -160,26 +124,30 @@ function OpenGL() { emission: new Float32Array([0, 0, 0, 1]), shininess: 0, }; - for (var i = 0; i < 8; i++) { - gl.textureUnits[i] = { - index: i, - enabled: false, - mipmap: false, - }; - } - gl.textureUnit = gl.textureUnits[0]; }, // FFI functions get JS args, return JS result + addToList: function(name, args) { + if (!gl.list) return false; + gl.list.commands.push({name: name, args: args}); + if (gl.listMode === GL.COMPILE) { + console.log("[COMPILE]", name, args); + return true; + } + return false; + }, + glAlphaFunc: function(func, ref) { - console.log("glAlphaFunc", func, ref); + if (gl.listMode && this.addToList("glAlphaFunc", [func, ref])) return; + console.log("glAlphaFunc", GL_Symbols[func], ref); gl.alphaFunc = func; gl.alphaRef = ref; }, glBegin: function(mode) { - console.log("glBegin", mode); + if (gl.listMode && this.addToList("glBegin", [mode])) return; + console.log("glBegin", GL_Symbols[mode]); gl.primitive = { mode: mode, vertices: [], @@ -190,29 +158,53 @@ function OpenGL() { }, glBindTexture: function(target, texture) { - console.log("glBindTexture", target, texture); + if (gl.listMode && this.addToList("glBindTexture", [target, texture])) return; + console.log("glBindTexture", GL_Symbols[target], texture); var texture = gl.textures[texture]; if (!texture) throw Error("OpenGL: texture not found"); webgl.bindTexture(target, texture); - gl.textureUnit.texture = texture; + gl.texture = texture; }, glBlendFunc: function(sfactor, dfactor) { - console.log("glBlendFunc", sfactor, dfactor); + if (gl.listMode && this.addToList("glBlendFunc", [sfactor, dfactor])) return; + console.log("glBlendFunc", GL_Symbols[sfactor], GL_Symbols[dfactor]); webgl.blendFunc(sfactor, dfactor); }, + glCallList: function(list) { + if (gl.listMode && this.addToList("glCallList", [list])) return; + console.log("glCallList", list, "START"); + var list = gl.lists[list]; + if (!list) { + console.warn("OpenGL: display list not found " + list); + return; + } + for (var i = 0; i < list.commands.length; i++) { + var cmd = list.commands[i]; + this[cmd.name].apply(this, cmd.args); + } + console.log("DONE: glCallList", list.id); + }, + glClear: function(mask) { - console.log("glClear 0x"+ mask.toString(16)); + if (gl.listMode && this.addToList("glClear", [mask])) return; + var maskString = ""; + if (mask & webgl.COLOR_BUFFER_BIT) maskString += " COLOR"; + if (mask & webgl.DEPTH_BUFFER_BIT) maskString += " DEPTH"; + if (mask & webgl.STENCIL_BUFFER_BIT) maskString += " STENCIL"; + console.log("glClear"+ maskString); webgl.clear(mask); }, glClearColor: function(red, green, blue, alpha) { + if (gl.listMode && this.addToList("glClearColor", [red, green, blue, alpha])) return; console.log("glClearColor", red, green, blue, alpha); webgl.clearColor(red, green, blue, alpha); }, glColor3f: function(red, green, blue) { + if (gl.listMode && this.addToList("glColor3f", [red, green, blue])) return; console.log("glColor3f", red, green, blue); gl.color[0] = red; gl.color[1] = green; @@ -222,6 +214,7 @@ function OpenGL() { }, glColor4f: function(red, green, blue, alpha) { + if (gl.listMode && this.addToList("glColor4f", [red, green, blue, alpha])) return; console.log("glColor4f", red, green, blue, alpha); gl.color[0] = red; gl.color[1] = green; @@ -231,13 +224,16 @@ function OpenGL() { }, glColorMask: function(red, green, blue, alpha) { + if (gl.listMode && this.addToList("glColorMask", [red, green, blue, alpha])) return; console.log("glColorMask", red, green, blue, alpha); webgl.colorMask(red, green, blue, alpha); }, glEnable: function(cap) { + if (gl.listMode && this.addToList("glEnable", [cap])) return; switch (cap) { - case gl.ALPHA_TEST: + case GL.ALPHA_TEST: + console.log("glEnable GL_ALPHA_TEST"); gl.alphaTest = true; break; case webgl.BLEND: @@ -252,18 +248,18 @@ function OpenGL() { console.log("glEnable GL_DEPTH_TEST"); webgl.enable(webgl.DEPTH_TEST); break; - case GL_LIGHT0: - case GL_LIGHT1: - case GL_LIGHT2: - case GL_LIGHT3: - case GL_LIGHT4: - case GL_LIGHT5: - case GL_LIGHT6: - case GL_LIGHT7: - console.log("glEnable GL_LIGHT" + (cap - GL_LIGHT0)); - gl.lights[cap - GL_LIGHT0].enabled = true; - break; - case GL_LIGHTING: + case GL.LIGHT0: + case GL.LIGHT1: + case GL.LIGHT2: + case GL.LIGHT3: + case GL.LIGHT4: + case GL.LIGHT5: + case GL.LIGHT6: + case GL.LIGHT7: + console.log("glEnable GL_LIGHT" + (cap - GL.LIGHT0)); + gl.lights[cap - GL.LIGHT0].enabled = true; + break; + case GL.LIGHTING: console.log("glEnable GL_LIGHTING"); gl.lighting = true; break; @@ -277,7 +273,7 @@ function OpenGL() { break; case webgl.TEXTURE_2D: console.log("glEnable GL_TEXTURE_2D"); - gl.textureUnit.enabled = true; + gl.textureEnabled = true; break; default: console.log("UNIMPLEMENTED glEnable", cap); @@ -285,163 +281,209 @@ function OpenGL() { }, glEnd: function() { + if (gl.listMode && this.addToList("glEnd", [])) return; var primitive = gl.primitive; gl.primitive = null; + + // select shader + var shaderFlags = primitive.vertexAttrs; + var flagString = ""; + if (gl.textureEnabled) shaderFlags |= HAS_TEXTURE; + if (gl.lighting) shaderFlags |= HAS_LIGHTING; + if (gl.alphaTest) shaderFlags |= HAS_ALPHA_TEST; + if (shaderFlags & HAS_NORMAL) flagString += " NORMAL"; + if (shaderFlags & HAS_COLOR) flagString += " COLOR"; + if (shaderFlags & HAS_TEXCOORD) flagString += " TEXCOORD"; + if (shaderFlags & HAS_TEXTURE) flagString += " TEXTURE"; + if (shaderFlags & HAS_LIGHTING) flagString += " LIGHTING"; + if (shaderFlags & HAS_ALPHA_TEST) flagString += " ALPHA_TEST"; + + if (!!(shaderFlags & HAS_TEXTURE) !== !!(shaderFlags & HAS_TEXCOORD)) { + shaderFlags &= ~(HAS_TEXTURE + HAS_TEXCOORD); + flagString += " (disabling texture)"; + } + + if (shaderFlags & HAS_LIGHTING) { + shaderFlags &= ~(HAS_LIGHTING + HAS_NORMAL); + flagString += " (UNIMPLEMENTED lighting)"; + } + + if (shaderFlags & (~(HAS_TEXCOORD + HAS_TEXTURE + HAS_NORMAL + HAS_COLOR))) { + console.log("UNIMPLEMENTED glEnd " + GL_Symbols[primitive.mode] + ":" + flagString); + return; + } + + // create shader program + var shader = gl.shaders[shaderFlags]; + if (!shader) { + shader = gl.shaders[shaderFlags] = { + program: webgl.createProgram(), + locations: null, + }; + var vs = webgl.createShader(webgl.VERTEX_SHADER); + webgl.shaderSource(vs, this.vertexShaderSource(shaderFlags)); + webgl.compileShader(vs); + if (!webgl.getShaderParameter(vs, webgl.COMPILE_STATUS)) { + console.error("OpenGL: vertex shader compile error: " + webgl.getShaderInfoLog(vs)); + debugger; + return; + } + var fs = webgl.createShader(webgl.FRAGMENT_SHADER); + webgl.shaderSource(fs, this.fragmentShaderSource(shaderFlags)); + webgl.compileShader(fs); + if (!webgl.getShaderParameter(fs, webgl.COMPILE_STATUS)) { + console.error("OpenGL: fragment shader compile error: " + webgl.getShaderInfoLog(fs)); + debugger; + return; + } + webgl.attachShader(shader.program, vs); + webgl.attachShader(shader.program, fs); + webgl.linkProgram(shader.program); + if (!webgl.getProgramParameter(shader.program, webgl.LINK_STATUS)) { + console.error("OpenGL: shader link error: " + webgl.getProgramInfoLog(shader.program)); + debugger + return; + } + shader.locations = this.getLocations(shader.program, shaderFlags); + } + webgl.useProgram(shader.program); + + // create vertex buffer + var vertices = primitive.vertices; + var size = primitive.vertexSize; + var data = new Float32Array(vertices.length * size); + for (var i = 0, offset = 0; i < vertices.length; i++, offset += size) { + data.set(vertices[i], offset); + } + var vertexBuffer = webgl.createBuffer(); + webgl.bindBuffer(webgl.ARRAY_BUFFER, vertexBuffer); + webgl.bufferData(webgl.ARRAY_BUFFER, data, webgl.DYNAMIC_DRAW); + + // create index buffer and drawMode depending on primitive mode + var indices; + var drawMode; + switch (primitive.mode) { case webgl.POINTS: - console.log("UNIMPLEMENTED glEnd GL_POINTS"); - break; case webgl.LINES: - console.log("UNIMPLEMENTED glEnd GL_LINES"); - break; case webgl.LINE_LOOP: - console.log("UNIMPLEMENTED glEnd GL_LINE_LOOP"); - break; case webgl.LINE_STRIP: - console.log("UNIMPLEMENTED glEnd GL_LINE_STRIP"); - break; case webgl.TRIANGLES: - console.log("UNIMPLEMENTED glEnd GL_TRIANGLES"); - break; case webgl.TRIANGLE_STRIP: - console.log("UNIMPLEMENTED glEnd GL_TRIANGLE_STRIP"); - break; case webgl.TRIANGLE_FAN: - console.log("UNIMPLEMENTED glEnd GL_TRIANGLE_FAN"); + console.log("glEnd " + GL_Symbols[primitive.mode] + ":" + flagString); + drawMode = primitive.mode; break; - case GL_QUADS: // (not directly supported by WebGL) + case GL.QUADS: // (not directly supported by WebGL) // use triangles and an index buffer to // duplicate vertices as v0-v1-v2, v2-v1-v3 // we assume that all attributes are floats - if (primitive.vertexAttrs !== 0) { - console.log("UNIMPLEMENTED glEnd GL_QUADS", primitive.vertexAttrs); - return; - } - console.log("glEnd GL_QUADS"); - // create vertex and index buffers - var vertices = primitive.vertices; - var size = primitive.vertexSize; - var data = new Float32Array(vertices.length * size); - for (var i = 0, offset = 0; i < vertices.length; i++, offset += size) { - data.set(vertices[i], offset); - } - var indices = new Uint16Array(vertices.length * 3 / 2); - offset = 0; + console.log("glEnd GL_QUADS:" + flagString); + indices = vertices.length > 256 + ? new Uint16Array(vertices.length * 3 / 2) + : new Uint8Array(vertices.length * 3 / 2); + var offset = 0; for (var i = 0; i < vertices.length; i += 4) { indices[offset++] = i; indices[offset++] = i+1; indices[offset++] = i+2; + indices[offset++] = i; indices[offset++] = i+2; - indices[offset++] = i+1; indices[offset++] = i+3; } - var vertexBuffer = webgl.createBuffer(); - webgl.bindBuffer(webgl.ARRAY_BUFFER, vertexBuffer); - webgl.bufferData(webgl.ARRAY_BUFFER, data, webgl.DYNAMIC_DRAW); - var indexBuffer = webgl.createBuffer(); - webgl.bindBuffer(webgl.ELEMENT_ARRAY_BUFFER, indexBuffer); - webgl.bufferData(webgl.ELEMENT_ARRAY_BUFFER, indices, webgl.DYNAMIC_DRAW); - // create shader program - var shader = gl.shaders[primitive.vertexAttrs]; - if (!shader) { - shader = gl.shaders[primitive.vertexAttrs] = { - program: webgl.createProgram(), - locations: null, - }; - var vs = webgl.createShader(webgl.VERTEX_SHADER); - webgl.shaderSource(vs, this.vertexShaderSource(primitive.vertexAttrs)); - webgl.compileShader(vs); - if (!webgl.getShaderParameter(vs, webgl.COMPILE_STATUS)) { - console.error("OpenGL: vertex shader compile error: " + webgl.getShaderInfoLog(vs)); - debugger; - return; - } - var fs = webgl.createShader(webgl.FRAGMENT_SHADER); - webgl.shaderSource(fs, this.fragmentShaderSource(primitive.vertexAttrs)); - webgl.compileShader(fs); - if (!webgl.getShaderParameter(fs, webgl.COMPILE_STATUS)) { - console.error("OpenGL: fragment shader compile error: " + webgl.getShaderInfoLog(fs)); - debugger; - return; - } - webgl.attachShader(shader.program, vs); - webgl.attachShader(shader.program, fs); - webgl.linkProgram(shader.program); - if (!webgl.getProgramParameter(shader.program, webgl.LINK_STATUS)) { - console.error("OpenGL: shader link error: " + webgl.getProgramInfoLog(shader.program)); - debugger - return; - } - shader.locations = this.getLocations(shader.program, primitive.vertexAttrs); - } - webgl.useProgram(shader.program); - // set up uniforms and vertex attributes - var stride = size * 4; - var offset = 0; - var loc = gl.shaders[primitive.vertexAttrs].locations; - webgl.uniformMatrix4fv(loc['uModelView'], false, gl.modelView); - webgl.uniformMatrix4fv(loc['uProjection'], false, gl.projection); - webgl.vertexAttribPointer(loc['aPosition'], 3, webgl.FLOAT, false, stride, offset); - webgl.enableVertexAttribArray(loc['aPosition']); - offset += 12; - if (loc['aNormal'] >= 0) { - webgl.vertexAttribPointer(loc['aNormal'], 3, webgl.FLOAT, false, stride, offset); - webgl.enableVertexAttribArray(loc['aNormal']); - offset += 12; - } - if (loc['aColor'] >= 0) { - webgl.vertexAttribPointer(loc['aColor'], 4, webgl.FLOAT, false, stride, offset); - webgl.enableVertexAttribArray(loc['aColor']); - offset += 16; - } else if (loc['uColor']) { - webgl.uniform4fv(loc['uColor'], gl.color); - } - if (loc['aTexCoord'] >= 0) { - webgl.vertexAttribPointer(loc['aTexCoord'], 2, webgl.FLOAT, false, stride, offset); - webgl.enableVertexAttribArray(loc['aTexCoord']); - offset += 8; - } - if (loc['uSampler'] >= 0) { - webgl.activeTexture(webgl.TEXTURE0 + gl.textureUnit.index); - webgl.bindTexture(webgl.TEXTURE_2D, gl.textureUnit.texture); - webgl.uniform1i(loc['uSampler'], gl.textureUnit.index); - } - // draw - webgl.bindBuffer(webgl.ARRAY_BUFFER, vertexBuffer); - webgl.bindBuffer(webgl.ELEMENT_ARRAY_BUFFER, indexBuffer); - webgl.drawElements(webgl.TRIANGLES, indices.length, webgl.UNSIGNED_SHORT, 0); + drawMode = webgl.TRIANGLES; break; - case GL_QUAD_STRIP: // (not directly supported by WebGL) - console.log("UNIMPLEMENTED glEnd GL_QUAD_STRIP"); - break; - case GL_POLYGON: // (not directly supported by WebGL) - console.log("UNIMPLEMENTED glEnd GL_POLYGON"); + case GL.QUAD_STRIP: // (not directly supported by WebGL) + console.log("UNIMPLEMENTED glEnd GL_QUAD_STRIP:" + flagString); + return; + case GL.POLYGON: // (not directly supported by WebGL) + // use trianglefan + console.log("glEnd GL_POLYGON:" + flagString); + drawMode = webgl.TRIANGLE_FAN; break; default: - console.log("UNIMPLEMENTED glEnd", primitive.mode); + console.log("UNIMPLEMENTED glEnd", primitive.mode, flagString); + return; + } + var indexBuffer; + if (indices) { + indexBuffer = webgl.createBuffer(); + webgl.bindBuffer(webgl.ELEMENT_ARRAY_BUFFER, indexBuffer); + webgl.bufferData(webgl.ELEMENT_ARRAY_BUFFER, indices, webgl.DYNAMIC_DRAW); } - }, - glEndList: function() { - console.log("glEndList"); - var list = gl.list; - gl.list = null; - gl.lists[list.id] = list; + // set up uniforms and vertex attributes + var stride = size * 4; + var offset = 0; + var loc = gl.shaders[shaderFlags].locations; + console.log("uModelView", Array.from(gl.matrices[GL.MODELVIEW][0])); + webgl.uniformMatrix4fv(loc['uModelView'], false, gl.matrices[GL.MODELVIEW][0]); + console.log("uProjection", Array.from(gl.matrices[GL.PROJECTION][0])); + webgl.uniformMatrix4fv(loc['uProjection'], false, gl.matrices[GL.PROJECTION][0]); + console.log("aPosition", size, stride, offset); + webgl.vertexAttribPointer(loc['aPosition'], 3, webgl.FLOAT, false, stride, offset); + webgl.enableVertexAttribArray(loc['aPosition']); + offset += 12; + if (loc['aNormal'] >= 0) { + console.log("aNormal", size, stride, offset); + webgl.vertexAttribPointer(loc['aNormal'], 3, webgl.FLOAT, false, stride, offset); + webgl.enableVertexAttribArray(loc['aNormal']); + offset += 12; + } else if (loc['uNormal']) { + console.log("uNormal", Array.from(gl.normal)); + webgl.uniform3fv(loc['uNormal'], gl.normal); + } + if (loc['aColor'] >= 0) { + console.log("aColor", size, stride, offset); + webgl.vertexAttribPointer(loc['aColor'], 4, webgl.FLOAT, false, stride, offset); + webgl.enableVertexAttribArray(loc['aColor']); + offset += 16; + } else if (loc['uColor']) { + console.log("uColor", Array.from(gl.color)); + webgl.uniform4fv(loc['uColor'], gl.color); + } + if (loc['aTexCoord'] >= 0) { + console.log("aTexCoord", size, stride, offset); + webgl.vertexAttribPointer(loc['aTexCoord'], 2, webgl.FLOAT, false, stride, offset); + webgl.enableVertexAttribArray(loc['aTexCoord']); + offset += 8; + } + if (loc['uSampler']) { + console.log("uSampler", gl.texture); + webgl.activeTexture(webgl.TEXTURE0); + webgl.bindTexture(webgl.TEXTURE_2D, gl.texture); + webgl.uniform1i(loc['uSampler'], 0); + } + + // draw + webgl.bindBuffer(webgl.ARRAY_BUFFER, vertexBuffer); + if (indexBuffer) { + webgl.bindBuffer(webgl.ELEMENT_ARRAY_BUFFER, indexBuffer); + console.log("glDrawElements", GL_Symbols[drawMode], indices.length); + webgl.drawElements(drawMode, indices.length, vertices.length > 256 ? webgl.UNSIGNED_SHORT : webgl.UNSIGNED_BYTE, 0); + } else { + console.log("glDrawArrays", GL_Symbols[drawMode], 0, vertices.length); + webgl.drawArrays(drawMode, 0, vertices.length); + } }, glDepthFunc: function(func) { - console.log("glDepthFunc", func); + if (gl.listMode && this.addToList("glDepthFunc", [func])) return; + console.log("glDepthFunc", GL_Symbols[func]); webgl.depthFunc(func); }, glDepthMask: function(flag) { + if (gl.listMode && this.addToList("glDepthMask", [flag])) return; console.log("glDepthMask", flag); webgl.depthMask(flag); }, glDisable: function(cap) { + if (gl.listMode && this.addToList("glDisable", [cap])) return; switch (cap) { - case GL_ALPHA_TEST: + case GL.ALPHA_TEST: + console.log("glDisable GL_ALPHA_TEST"); gl.alphaTest = false; break; case webgl.BLEND: @@ -449,25 +491,25 @@ function OpenGL() { webgl.disable(webgl.BLEND); break; case webgl.CULL_FACE: - console.log("glDisable GL_CULL_FACE"); + console.log("glDisable GL.CULL_FACE"); webgl.disable(webgl.CULL_FACE); break; case webgl.DEPTH_TEST: console.log("glDisable GL_DEPTH_TEST"); webgl.disable(webgl.DEPTH_TEST); break; - case GL_LIGHT0: - case GL_LIGHT1: - case GL_LIGHT2: - case GL_LIGHT3: - case GL_LIGHT4: - case GL_LIGHT5: - case GL_LIGHT6: - case GL_LIGHT7: - console.log("glDisable GL_LIGHT" + (cap - GL_LIGHT0)); - gl.lights[cap - GL_LIGHT0].enabled = false; - break; - case GL_LIGHTING: + case GL.LIGHT0: + case GL.LIGHT1: + case GL.LIGHT2: + case GL.LIGHT3: + case GL.LIGHT4: + case GL.LIGHT5: + case GL.LIGHT6: + case GL.LIGHT7: + console.log("glDisable GL_LIGHT" + (cap - GL.LIGHT0)); + gl.lights[cap - GL.LIGHT0].enabled = false; + break; + case GL.LIGHTING: console.log("glDisable GL_LIGHTING"); gl.lighting = false; break; @@ -481,15 +523,24 @@ function OpenGL() { break; case webgl.TEXTURE_2D: console.log("glDisable GL_TEXTURE_2D"); - gl.textureUnit.enabled = false; + gl.textureEnabled = false; break; default: console.log("UNIMPLEMENTED glDisable", cap); } }, + glEndList: function() { + console.log("glEndList"); + var list = gl.list; + gl.list = null; + gl.lists[list.id] = list; + gl.listMode = 0; + }, + glFrontFace: function(mode) { - console.log("glFrontFace", mode); + if (gl.listMode && this.addToList("glFrontFace", [mode])) return; + console.log("glFrontFace", GL_Symbols[mode]); webgl.frontFace(mode); }, @@ -497,15 +548,15 @@ function OpenGL() { console.log("glGenLists", range); var firstId = 0; if (range > 0) { - firstId = gl.listId + 1; - gl.listId += range; + firstId = gl.listIdGen + 1; + gl.listIdGen += range; } return firstId; }, glGenTextures: function(n, textures) { for (var i = 0; i < n; i++) { - var id = ++gl.textureId; + var id = ++gl.textureIdGen; gl.textures[id] = webgl.createTexture(); textures[i] = id; } @@ -514,7 +565,7 @@ function OpenGL() { glGetIntegerv(name, params) { switch (name) { - case GL_LIST_INDEX: + case GL.LIST_INDEX: console.log("glGetIntegerv GL_LIST_INDEX"); params[0] = gl.list ? gl.list.id : 0; break; @@ -525,7 +576,7 @@ function OpenGL() { glGetString: function(name) { switch (name) { - case 7939: // GL_EXTENSIONS + case GL.EXTENSIONS: console.log("glGetString GL_EXTENSIONS"); return gl.extensions; default: @@ -536,7 +587,7 @@ function OpenGL() { glGetTexLevelParameteriv: function(target, level, pname, params) { switch (pname) { - case GL_TEXTURE_COMPRESSED: + case GL.TEXTURE_COMPRESSED: return false; default: console.log("UNIMPLEMENTED glGetTexLevelParameteriv", target, level, pname, params); @@ -545,7 +596,7 @@ function OpenGL() { glIsEnabled: function(cap) { switch (cap) { - case GL_LIGHTING: + case GL.LIGHTING: console.log("glIsEnabled GL_LIGHTING"); return gl.lighting; default: @@ -555,9 +606,10 @@ function OpenGL() { }, glLightf: function(light, pname, param) { - var i = light - GL_LIGHT0; + if (gl.listMode && this.addToList("glLightf", [light, pname, param])) return; + var i = light - GL.LIGHT0; switch (pname) { - case 4614: // GL_SPOT_CUTOFF + case GL.SPOT_CUTOFF: console.log("glLightf", i, "GL_SPOT_CUTOFF", param); gl.lights[i].spotCutoff = param; break; @@ -567,101 +619,104 @@ function OpenGL() { }, glLightfv: function(light, pname, param) { - var i = light - GL_LIGHT0; + if (gl.listMode && this.addToList("glLightfv", [light, pname, param])) return; + var i = light - GL.LIGHT0; switch (pname) { - case 4608: // GL_AMBIENT - console.log("glLightfv", i, "GL_AMBIENT", param); + case GL.AMBIENT: + console.log("glLightfv", i, "GL_AMBIENT", Array.from(param)); gl.lights[i].ambient = param; break; - case 4609: // GL_DIFFUSE - console.log("glLightfv", i, "GL_DIFFUSE", param); + case GL.DIFFUSE: + console.log("glLightfv", i, "GL_DIFFUSE", Array.from(param)); gl.lights[i].diffuse = param; break; - case 4610: // GL_SPECULAR - console.log("glLightfv", i, "GL_SPECULAR", param); + case GL.SPECULAR: + console.log("glLightfv", i, "GL_SPECULAR", Array.from(param)); gl.lights[i].specular = param; break; - case 4611: // GL_POSITION - console.log("glLightfv", i, "GL_POSITION", param); - transformPoint(gl.modelView, param, gl.lights[i].position); + case GL.POSITION: + transformPoint(gl.matrices[GL.MODELVIEW][0], param, Array.from(gl.lights[i].position)); + console.log("glLightfv", i, "GL_POSITION", param, "=>", Array.from(gl.lights[i].position)); break; default: - console.log("UNIMPLEMENTED glLightfv", i, pname, param); + console.log("UNIMPLEMENTED glLightfv", i, GL_Symbols[pname], Array.from(param)); } }, glLoadIdentity: function() { + if (gl.listMode && this.addToList("glLoadIdentity", [])) return; console.log("glLoadIdentity"); gl.matrix.set(identity); }, glLoadMatrixf: function(m) { - console.log("glLoadMatrixf", Array.from(m)); + if (gl.listMode && this.addToList("glLoadMatrixf", [m])) return; gl.matrix.set(m); + console.log("glLoadMatrixf", GL_Symbols[gl.matrixMode], Array.from(m)); }, glMaterialfv: function(face, pname, param) { + if (gl.listMode && this.addToList("glMaterialfv", [face, pname, param])) return; switch (pname) { - case 4608: // GL_AMBIENT - console.log("glMaterialfv GL_AMBIENT", param); + case GL.AMBIENT: + console.log("glMaterialfv GL_AMBIENT", Array.from(param)); gl.material.ambient = param; break; - case 4609: // GL_DIFFUSE - console.log("glMaterialfv GL_DIFFUSE", param); + case GL.DIFFUSE: + console.log("glMaterialfv GL_DIFFUSE", Array.from(param)); gl.material.diffuse = param; break; - case 4610: // GL_SPECULAR - console.log("glMaterialfv GL_SPECULAR", param); + case GL.SPECULAR: + console.log("glMaterialfv GL_SPECULAR", Array.from(param)); gl.material.specular = param; break; - case 5632: // GL_EMISSION - console.log("glMaterialfv GL_EMISSION", param); + case GL.EMISSION: + console.log("glMaterialfv GL_EMISSION", Array.from(param)); gl.material.emission = param; break; - case 5633: // GL_SHININESS - console.log("glMaterialfv GL_SHININESS", param); + case GL.SHININESS: + console.log("glMaterialfv GL_SHININESS", Array.from(param)); gl.material.shininess = param[0]; break; - case 5634: // GL_AMBIENT_AND_DIFFUSE - console.log("glMaterialfv GL_AMBIENT_AND_DIFFUSE", param); + case GL.AMBIENT_AND_DIFFUSE: + console.log("glMaterialfv GL_AMBIENT_AND_DIFFUSE", Array.from(param)); gl.material.ambient = param; gl.material.diffuse = param; break; default: - console.log("UNIMPLEMENTED glMaterialfv", face, pname, param); + console.log("UNIMPLEMENTED glMaterialfv", GL_Symbols[pname], Array.from(param)); } }, glMatrixMode: function(mode) { - switch (mode) { - case 5888: // GL_MODELVIEW - console.log("glMatrixMode GL_MODELVIEW"); - gl.matrix = gl.modelView; - break; - case 5889: // GL_PROJECTION - console.log("glMatrixMode GL_PROJECTION"); - gl.matrix = gl.projection; - break; - default: - console.log("UNIMPLEMENTED glMatrixMode", mode); - } + if (gl.listMode && this.addToList("glMatrixMode", [mode])) return; + if (mode !== GL.MODELVIEW && mode !== GL.PROJECTION) + console.warn("UNIMPLEMENTED glMatrixMode", GL_Symbols[mode]); + else + console.log("glMatrixMode", GL_Symbols[mode]); + gl.matrixMode = mode; + if (!gl.matrices[mode]) gl.matrices[mode] = [new Float32Array(identity)]; + gl.matrix = gl.matrices[mode][0]; }, glMultMatrixf: function(m) { - console.log("glMultMatrixf", Array.from(m)); + if (gl.listMode && this.addToList("glMultMatrixf", [m])) return; multMatrix(gl.matrix, m); + console.log("glMultMatrixf", GL_Symbols[gl.matrixMode], Array.from(m), "=>", Array.from(gl.matrix)); }, glNewList: function(list, mode) { - console.log("glNewList", list, mode); + console.log("glNewList", list, GL_Symbols[mode]); var newList = { id: list, - mode: mode, + commands: [], }; gl.list = newList; + gl.listMode = mode; }, glNormal3f: function(nx, ny, nz) { + if (gl.listMode && this.addToList("glNormal3f", [nx, ny, nz])) return; console.log("glNormal3f", nx, ny, nz); gl.normal[0] = nx; gl.normal[1] = ny; @@ -670,6 +725,7 @@ function OpenGL() { }, glNormal3fv: function(v) { + if (gl.listMode && this.addToList("glNormal3fv", [v])) return; console.log("glNormal3fv", Array.from(v)); gl.normal.set(v); gl.primitiveAttrs |= HAS_NORMAL; @@ -679,20 +735,20 @@ function OpenGL() { switch (pname) { case webgl.UNPACK_ALIGNMENT: console.log("glPixelStorei GL_UNPACK_ALIGNMENT", param); - webgl.pixelStorei(webgl.UNPACK_ALIGNMENT, param); + //@webgl.pixelStorei(webgl.UNPACK_ALIGNMENT, param); break; - case GL_UNPACK_LSB_FIRST: + case GL.UNPACK_LSB_FIRST: if (param !== 0) console.log("UNIMPLEMENTED glPixelStorei GL_UNPACK_LSB_FIRST", param); break; - case GL_UNPACK_ROW_LENGTH: + case GL.UNPACK_ROW_LENGTH: console.log("glPixelStorei GL_UNPACK_ROW_LENGTH", param); gl.pixelStoreUnpackRowLength = param; break; - case GL_UNPACK_SKIP_ROWS: + case GL.UNPACK_SKIP_ROWS: console.log("glPixelStorei GL_UNPACK_SKIP_ROWS", param); gl.pixelStoreUnpackSkipRows = param; break; - case GL_UNPACK_SKIP_PIXELS: + case GL.UNPACK_SKIP_PIXELS: console.log("glPixelStorei GL_UNPACK_SKIP_PIXELS", param); gl.pixelStoreUnpackSkipPixels = param; break; @@ -702,63 +758,81 @@ function OpenGL() { }, glPolygonOffset: function(factor, units) { + if (gl.listMode && this.addToList("glPolygonOffset", [factor, units])) return; console.log("glPolygonOffset", factor, units); webgl.polygonOffset(factor, units); }, glPushMatrix: function() { - console.log("glPushMatrix"); - var m1 = gl.matrix; - var m2 = new Float32Array(m1); - gl.matrix = m2; - gl.matrix.stack = m1; + if (gl.listMode && this.addToList("glPushMatrix", [])) return; + gl.matrix = new Float32Array(gl.matrix); + gl.matrices[gl.matrixMode].unshift(gl.matrix); + console.log("glPushMatrix", GL_Symbols[gl.matrixMode], "=>", Array.from(gl.matrix)); }, glPopMatrix: function() { - console.log("glPopMatrix"); - var m1 = gl.matrix; - var m2 = m1.stack; - if (!m2) return console.warn("OpenGL: matrix stack underflow"); - gl.matrix = m2; - m1.stack = null; + if (gl.listMode && this.addToList("glPopMatrix", [])) return; + if (gl.matrices[gl.matrixMode].length <= 1) + return console.warn("OpenGL: matrix stack underflow"); + gl.matrices[gl.matrixMode].shift(); + gl.matrix = gl.matrices[gl.matrixMode][0]; + console.log("glPopMatrix", GL_Symbols[gl.matrixMode], "=>", Array.from(gl.matrix)); }, glTranslated: function(x, y, z) { - console.log("glTranslated", x, y, z); + if (gl.listMode && this.addToList("glTranslated", [x, y, z])) return; translateMatrix(gl.matrix, x, y, z); + console.log("glTranslated", GL_Symbols[gl.matrixMode], x, y, z, "=>", Array.from(gl.matrix)); }, glTranslatef: function(x, y, z) { - console.log("glTranslatef", x, y, z); + if (gl.listMode && this.addToList("glTranslatef", [x, y, z])) return; translateMatrix(gl.matrix, x, y, z); + console.log("glTranslatef", GL_Symbols[gl.matrixMode], x, y, z, "=>", Array.from(gl.matrix)); }, glScaled: function(x, y, z) { - console.log("glScaled", x, y, z); + if (gl.listMode && this.addToList("glScaled", [x, y, z])) return; var m = gl.matrix; m[0] *= x; m[1] *= x; m[2] *= x; m[3] *= x; m[4] *= y; m[5] *= y; m[6] *= y; m[7] *= y; m[8] *= z; m[9] *= z; m[10] *= z; m[11] *= z; + console.log("glScaled", GL_Symbols[gl.matrixMode], x, y, z, "=>", Array.from(gl.matrix)); }, glStencilFunc: function(func, ref, mask) { - console.log("glStencilFunc", func, ref, mask); + if (gl.listMode && this.addToList("glStencilFunc", [func, ref, mask])) return; + console.log("glStencilFunc", GL_Symbols[func], ref, '0x'+(mask>>>0).toString(16)); webgl.stencilFunc(func, ref, mask); }, glStencilOp: function(fail, zfail, zpass) { - console.log("glStencilOp", fail, zfail, zpass); + if (gl.listMode && this.addToList("glStencilOp", [fail, zfail, zpass])) return; + console.log("glStencilOp", GL_Symbols[fail], GL_Symbols[zfail], GL_Symbols[zpass]); webgl.stencilOp(fail, zfail, zpass); }, glTexImage2D: function(target, level, internalformat, width, height, border, format, type, pixels) { - console.log("glTexImage2D", target, level, internalformat, width, height, border, format, type, pixels); + if (gl.listMode && this.addToList("glTexImage2D", [target, level, internalformat, width, height, border, format, type, pixels])) return; + console.log("glTexImage2D", GL_Symbols[target], level, GL_Symbols[internalformat], width, height, border, GL_Symbols[format], GL_Symbols[type], pixels); + gl.texture.width = width; + gl.texture.height = height; + // WebGL does not support GL_UNPACK_ROW_LENGTH, GL_UNPACK_SKIP_ROWS, GL_UNPACK_SKIP_PIXELS + if (gl.pixelStoreUnpackRowLength !== 0 && gl.pixelStoreUnpackRowLength !== gl.texture.width) { + console.warn("UNIMPLEMENTED glTexImage2D GL_UNPACK_ROW_LENGTH " + gl.pixelStoreUnpackRowLength); + } + if (gl.pixelStoreUnpackSkipRows !== 0) { + console.warn("UNIMPLEMENTED glTexImage2D GL_UNPACK_SKIP_ROWS " + gl.pixelStoreUnpackSkipRows); + } + if (gl.pixelStoreUnpackSkipPixels !== 0) { + console.warn("UNIMPLEMENTED glTexImage2D GL_UNPACK_SKIP_PIXELS " + gl.pixelStoreUnpackSkipPixels); + } // WebGL only supports GL_RGBA switch (format) { - case webgl.GL_RGBA: + case webgl.RGBA: + console.warn("glTexImage2D GL_RGBA: need to not swizzle BGRA"); break; - case GL_BGRA: - console.warn("glTexImage2D GL_BGRA as RGBA"); + case GL.BGRA: format = webgl.RGBA; // todo: swap bytes in shader break; @@ -776,20 +850,11 @@ function OpenGL() { console.warn("UNIMPLEMENTED glTexImage2D type " + type); return; } - // WebGL does not support GL_UNPACK_ROW_LENGTH, GL_UNPACK_SKIP_ROWS, GL_UNPACK_SKIP_PIXELS - if (gl.pixelStoreUnpackRowLength !== 0 && gl.pixelStoreUnpackRowLength !== width) { - console.warn("UNIMPLEMENTED glTexImage2D GL_UNPACK_ROW_LENGTH " + gl.pixelStoreUnpackRowLength); - } - if (gl.pixelStoreUnpackSkipRows !== 0) { - console.warn("UNIMPLEMENTED glTexImage2D GL_UNPACK_SKIP_ROWS " + gl.pixelStoreUnpackSkipRows); - } - if (gl.pixelStoreUnpackSkipPixels !== 0) { - console.warn("UNIMPLEMENTED glTexImage2D GL_UNPACK_SKIP_PIXELS " + gl.pixelStoreUnpackSkipPixels); - } webgl.texImage2D(target, level, internalformat, width, height, border, format, type, pixels); }, glTexCoord2f: function(s, t) { + if (gl.listMode && this.addToList("glTexCoord2f", [s, t])) return; console.log("glTexCoord2f", s, t); gl.texCoord[0] = s; gl.texCoord[1] = t; @@ -797,21 +862,38 @@ function OpenGL() { }, glTexParameteri: function(target, pname, param) { - console.log("glTexParameteri", target, pname, param); + if (gl.listMode && this.addToList("glTexParameteri", [target, pname, param])) return; + console.log("glTexParameteri", GL_Symbols[target], GL_Symbols[pname], GL_Symbols[param] || param); webgl.texParameteri(target, pname, param); - if (pname === gl.TEXTURE_MIN_FILTER) { - gl.textureUnit.mipmap = param !== gl.NEAREST && param !== gl.LINEAR; - } }, glTexSubImage2D: function(target, level, xoffset, yoffset, width, height, format, type, pixels) { - console.log("glTexSubImage2D", target, level, xoffset, yoffset, width, height, format, type, pixels); - // WebGL only supports GL_RGBA + if (gl.listMode && this.addToList("glTexSubImage2D", [target, level, xoffset, yoffset, width, height, format, type, pixels])) return; + console.log("glTexSubImage2D", GL_Symbols[target], level, xoffset, yoffset, width, height, GL_Symbols[format], GL_Symbols[type], pixels); + // WebGL does not support GL_UNPACK_ROW_LENGTH, GL_UNPACK_SKIP_ROWS, GL_UNPACK_SKIP_PIXELS + // emulate GL_UNPACK_SKIP_ROWS + var pixelsOffset = gl.pixelStoreUnpackSkipRows * gl.texture.width; // to be multiplied by pixel size below + // assume GL_UNPACK_ROW_LENGTH is full width (which is the case when uploading part of a bitmap in Squeak) + if (gl.pixelStoreUnpackRowLength !== 0 && gl.pixelStoreUnpackRowLength !== gl.texture.width) { + console.warn("UNIMPLEMENTED glTexSubImage2D GL_UNPACK_ROW_LENGTH " + gl.pixelStoreUnpackRowLength); + } + // WebGL does not support GL_UNPACK_SKIP_PIXELS to allow different width + if (width !== gl.texture.width) { + // we could either + // 1. call texSubImage2D for each row + // 2. copy subimage pixels into a new buffer + // 3. call texSubImage2D for the whole width so we don't need to skip pixels + // we choose 3. for now + width = gl.texture.width; + xoffset = 0; + } + // WebGL only supports RGB not BGR switch (format) { - case webgl.GL_RGBA: + case webgl.RGBA: + pixelsOffset *= 4; break; - case GL_BGRA: - console.warn("glTexSubImage2D GL_BGRA as RGBA"); + case GL.BGRA: + pixelsOffset *= 4; format = webgl.RGBA; break; default: @@ -822,43 +904,37 @@ function OpenGL() { // convert to appropriate typed array switch (type) { case webgl.UNSIGNED_BYTE: - pixels = new Uint8Array(pixels); + pixels = new Uint8Array(pixels, pixelsOffset); break; default: console.warn("UNIMPLEMENTED glTexSubImage2D type " + type); return; } - // WebGL does not support GL_UNPACK_ROW_LENGTH, GL_UNPACK_SKIP_ROWS, GL_UNPACK_SKIP_PIXELS - if (gl.pixelStoreUnpackRowLength !== 0 && gl.pixelStoreUnpackRowLength !== width) { - console.warn("UNIMPLEMENTED glTexSubImage2D GL_UNPACK_ROW_LENGTH " + gl.pixelStoreUnpackRowLength); - } - if (gl.pixelStoreUnpackSkipRows !== 0) { - console.warn("UNIMPLEMENTED glTexSubImage2D GL_UNPACK_SKIP_ROWS " + gl.pixelStoreUnpackSkipRows); - } - if (gl.pixelStoreUnpackSkipPixels !== 0) { - console.warn("UNIMPLEMENTED glTexSubImage2D GL_UNPACK_SKIP_PIXELS " + gl.pixelStoreUnpackSkipPixels); - } webgl.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); }, glVertex2f: function(x, y) { + if (gl.listMode && this.addToList("glVertex2f", [x, y])) return; console.log("glVertex2f", x, y); var position = [x, y]; this.pushVertex(position); }, glVertex3f: function(x, y, z) { + if (gl.listMode && this.addToList("glVertex3f", [x, y, z])) return; console.log("glVertex3f", x, y, z); var position = [x, y, z]; this.pushVertex(position); }, glVertex3fv: function(v) { + if (gl.listMode && this.addToList("glVertex3fv", [v])) return; console.log("glVertex3fv", Array.from(v)); this.pushVertex(v); }, glViewport: function(x, y, width, height) { + if (gl.listMode && this.addToList("glViewport", [x, y, width, height])) return; console.log("glViewport", x, y, width, height); webgl.viewport(x, y, width, height); }, @@ -890,33 +966,33 @@ function OpenGL() { }, // shader source code - vertexShaderSource: function(vertexAttrs) { + vertexShaderSource: function(shaderFlags) { var src = []; src.push("uniform mat4 uModelView;"); src.push("uniform mat4 uProjection;"); src.push("attribute vec3 aPosition;"); - if (vertexAttrs & HAS_NORMAL) { - src.push("attribute vec3 uNormal;"); + if (shaderFlags & HAS_NORMAL) { + src.push("attribute vec3 aNormal;"); src.push("varying vec3 vNormal;"); } - if (vertexAttrs & HAS_COLOR) { + if (shaderFlags & HAS_COLOR) { src.push("attribute vec4 uColor;"); src.push("varying vec4 vColor;"); } - if (vertexAttrs & HAS_TEXCOORD) { - src.push("attribute vec2 texCoord;"); + if (shaderFlags & HAS_TEXCOORD) { + src.push("attribute vec2 aTexCoord;"); src.push("varying vec2 vTexCoord;"); } src.push("void main(void) {"); src.push(" gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);"); - if (vertexAttrs & HAS_NORMAL) { - src.push(" vNormal = uNormal;"); + if (shaderFlags & HAS_NORMAL) { + src.push(" vNormal = aNormal;"); } - if (vertexAttrs & HAS_COLOR) { + if (shaderFlags & HAS_COLOR) { src.push(" vColor = uColor;"); } - if (vertexAttrs & HAS_TEXCOORD) { - src.push(" vTexCoord = texCoord;"); + if (shaderFlags & HAS_TEXCOORD) { + src.push(" vTexCoord = aTexCoord;"); } src.push("}"); var src = src.join("\n"); @@ -924,38 +1000,41 @@ function OpenGL() { return src; }, - fragmentShaderSource: function(vertexAttrs) { + fragmentShaderSource: function(shaderFlags) { var src = []; src.push("precision mediump float;"); - if (vertexAttrs & HAS_NORMAL) { + if (shaderFlags & HAS_NORMAL) { src.push("varying vec3 vNormal;"); } - if (vertexAttrs & HAS_COLOR) { + if (shaderFlags & HAS_COLOR) { src.push("varying vec4 vColor;"); } else { src.push("uniform vec4 uColor;"); } - if (vertexAttrs & HAS_TEXCOORD) { + if (shaderFlags & HAS_TEXCOORD) { src.push("varying vec2 vTexCoord;"); + } + if (shaderFlags & HAS_TEXTURE) { src.push("uniform sampler2D uSampler;"); } src.push("void main(void) {"); - if (vertexAttrs & HAS_NORMAL) { + if (shaderFlags & HAS_NORMAL) { src.push(" vec3 normal = normalize(vNormal);"); } - if (vertexAttrs & HAS_TEXCOORD) { - src.push(" vec4 color = texture2D(uSampler, vec2(vTexCoord.s, vTexCoord.t));"); - } else if (vertexAttrs & HAS_COLOR) { + if (shaderFlags & HAS_COLOR) { src.push(" vec4 color = vColor;"); } else { src.push(" vec4 color = uColor;"); - src.push(" color = vec4(1, 0, 0, 1);"); } - if (vertexAttrs & HAS_NORMAL) { + if ((shaderFlags & (HAS_TEXCOORD + HAS_TEXTURE)) === (HAS_TEXCOORD + HAS_TEXTURE)) { + src.push(" color *= texture2D(uSampler, vec2(vTexCoord.s, vTexCoord.t)).bgra;"); + } + if (shaderFlags & HAS_NORMAL) { src.push(" float diffuse = max(dot(normal, vec3(0, 0, 1)), 0.0);"); src.push(" gl_FragColor = color * diffuse;"); } else { src.push(" gl_FragColor = color;"); + // src.push(" gl_FragColor = mix(color, vec4(1, 0, 1, 1), 0.5);"); } src.push("}"); var src = src.join("\n"); @@ -963,25 +1042,25 @@ function OpenGL() { return src; }, - getLocations: function(program, vertexAttrs) { + getLocations: function(program, shaderFlags) { var locations = {}; // uniforms locations.uModelView = webgl.getUniformLocation(program, "uModelView"); locations.uProjection = webgl.getUniformLocation(program, "uProjection"); - if (vertexAttrs & HAS_TEXCOORD) { + if (shaderFlags & HAS_TEXTURE) { locations.uSampler = webgl.getUniformLocation(program, "uSampler"); } // attributes locations.aPosition = webgl.getAttribLocation(program, "aPosition"); - if (vertexAttrs & HAS_NORMAL) { + if (shaderFlags & HAS_NORMAL) { locations.aNormal = webgl.getAttribLocation(program, "aNormal"); } - if (vertexAttrs & HAS_COLOR) { + if (shaderFlags & HAS_COLOR) { locations.aColor = webgl.getAttribLocation(program, "aColor"); } else { locations.uColor = webgl.getUniformLocation(program, "uColor"); } - if (vertexAttrs & HAS_TEXCOORD) { + if (shaderFlags & HAS_TEXCOORD) { locations.aTexCoord = webgl.getAttribLocation(program, "aTexCoord"); } console.log(locations); @@ -990,6 +1069,262 @@ function OpenGL() { }; } +function transformPoint(matrix, src, dst) { + var x = src[0]; + var y = src[1]; + var z = src[2]; + var rx = matrix[0] * x + matrix[4] * y + matrix[8] * z + matrix[12]; + var ry = matrix[1] * x + matrix[5] * y + matrix[9] * z + matrix[13]; + var rz = matrix[2] * x + matrix[6] * y + matrix[10] * z + matrix[14]; + var rw = matrix[3] * x + matrix[7] * y + matrix[11] * z + matrix[15]; + if (rw === 1) { + dst[0] = rx; + dst[1] = ry; + dst[2] = rz; + } else { + if (rw !== 0) rw = 1 / rw; + dst[0] = rx * rw; + dst[1] = ry * rw; + dst[2] = rz * rw; + } + dst[3] = src[3]; +} + +function multMatrix(m1, m2) { + for (var row = 0; row < 16; row += 4) { + var c0 = m1[row+0] * m2[0] + m1[row+1] * m2[4] + m1[row+2] * m2[8] + m1[row+3] * m2[12]; + var c1 = m1[row+0] * m2[1] + m1[row+1] * m2[5] + m1[row+2] * m2[9] + m1[row+3] * m2[13]; + var c2 = m1[row+0] * m2[2] + m1[row+1] * m2[6] + m1[row+2] * m2[10] + m1[row+3] * m2[14]; + var c3 = m1[row+0] * m2[3] + m1[row+1] * m2[7] + m1[row+2] * m2[11] + m1[row+3] * m2[15]; + m1[row+0] = c0; + m1[row+1] = c1; + m1[row+2] = c2; + m1[row+3] = c3; + } +} + +function translateMatrix(m, x, y, z) { + m[12] += x * m[0] + y * m[4] + z * m[8]; + m[13] += x * m[1] + y * m[5] + z * m[9]; + m[14] += x * m[2] + y * m[6] + z * m[10]; + m[15] += x * m[3] + y * m[7] + z * m[11]; +} + +function initGLConstants() { + GL = { + // from https://github.com/KhronosGroup/OpenGL-Registry/blob/main/api/GL/glcorearb.h + // but some are missing, see below + DEPTH_BUFFER_BIT: 0x00000100, + STENCIL_BUFFER_BIT: 0x00000400, + COLOR_BUFFER_BIT: 0x00004000, + FALSE: 0, + TRUE: 1, + POINTS: 0x0000, + LINES: 0x0001, + LINE_LOOP: 0x0002, + LINE_STRIP: 0x0003, + TRIANGLES: 0x0004, + TRIANGLE_STRIP: 0x0005, + TRIANGLE_FAN: 0x0006, + QUADS: 0x0007, + NEVER: 0x0200, + LESS: 0x0201, + EQUAL: 0x0202, + LEQUAL: 0x0203, + GREATER: 0x0204, + NOTEQUAL: 0x0205, + GEQUAL: 0x0206, + ALWAYS: 0x0207, + ZERO: 0, + ONE: 1, + SRC_COLOR: 0x0300, + ONE_MINUS_SRC_COLOR: 0x0301, + SRC_ALPHA: 0x0302, + ONE_MINUS_SRC_ALPHA: 0x0303, + DST_ALPHA: 0x0304, + ONE_MINUS_DST_ALPHA: 0x0305, + DST_COLOR: 0x0306, + ONE_MINUS_DST_COLOR: 0x0307, + SRC_ALPHA_SATURATE: 0x0308, + NONE: 0, + FRONT_LEFT: 0x0400, + FRONT_RIGHT: 0x0401, + BACK_LEFT: 0x0402, + BACK_RIGHT: 0x0403, + FRONT: 0x0404, + BACK: 0x0405, + LEFT: 0x0406, + RIGHT: 0x0407, + FRONT_AND_BACK: 0x0408, + NO_ERROR: 0, + INVALID_ENUM: 0x0500, + INVALID_VALUE: 0x0501, + INVALID_OPERATION: 0x0502, + OUT_OF_MEMORY: 0x0505, + CW: 0x0900, + CCW: 0x0901, + POINT_SIZE: 0x0B11, + POINT_SIZE_RANGE: 0x0B12, + POINT_SIZE_GRANULARITY: 0x0B13, + LINE_SMOOTH: 0x0B20, + LINE_WIDTH: 0x0B21, + LINE_WIDTH_RANGE: 0x0B22, + LINE_WIDTH_GRANULARITY: 0x0B23, + POLYGON_MODE: 0x0B40, + POLYGON_SMOOTH: 0x0B41, + CULL_FACE: 0x0B44, + CULL_FACE_MODE: 0x0B45, + FRONT_FACE: 0x0B46, + DEPTH_RANGE: 0x0B70, + DEPTH_TEST: 0x0B71, + DEPTH_WRITEMASK: 0x0B72, + DEPTH_CLEAR_VALUE: 0x0B73, + DEPTH_FUNC: 0x0B74, + STENCIL_TEST: 0x0B90, + STENCIL_CLEAR_VALUE: 0x0B91, + STENCIL_FUNC: 0x0B92, + STENCIL_VALUE_MASK: 0x0B93, + STENCIL_FAIL: 0x0B94, + STENCIL_PASS_DEPTH_FAIL: 0x0B95, + STENCIL_PASS_DEPTH_PASS: 0x0B96, + STENCIL_REF: 0x0B97, + STENCIL_WRITEMASK: 0x0B98, + VIEWPORT: 0x0BA2, + DITHER: 0x0BD0, + BLEND_DST: 0x0BE0, + BLEND_SRC: 0x0BE1, + BLEND: 0x0BE2, + LOGIC_OP_MODE: 0x0BF0, + DRAW_BUFFER: 0x0C01, + READ_BUFFER: 0x0C02, + SCISSOR_BOX: 0x0C10, + SCISSOR_TEST: 0x0C11, + COLOR_CLEAR_VALUE: 0x0C22, + COLOR_WRITEMASK: 0x0C23, + DOUBLEBUFFER: 0x0C32, + STEREO: 0x0C33, + LINE_SMOOTH_HINT: 0x0C52, + POLYGON_SMOOTH_HINT: 0x0C53, + UNPACK_SWAP_BYTES: 0x0CF0, + UNPACK_LSB_FIRST: 0x0CF1, + UNPACK_ROW_LENGTH: 0x0CF2, + UNPACK_SKIP_ROWS: 0x0CF3, + UNPACK_SKIP_PIXELS: 0x0CF4, + UNPACK_ALIGNMENT: 0x0CF5, + PACK_SWAP_BYTES: 0x0D00, + PACK_LSB_FIRST: 0x0D01, + PACK_ROW_LENGTH: 0x0D02, + PACK_SKIP_ROWS: 0x0D03, + PACK_SKIP_PIXELS: 0x0D04, + PACK_ALIGNMENT: 0x0D05, + MAX_TEXTURE_SIZE: 0x0D33, + MAX_VIEWPORT_DIMS: 0x0D3A, + SUBPIXEL_BITS: 0x0D50, + TEXTURE_1D: 0x0DE0, + TEXTURE_2D: 0x0DE1, + TEXTURE_WIDTH: 0x1000, + TEXTURE_HEIGHT: 0x1001, + TEXTURE_BORDER_COLOR: 0x1004, + DONT_CARE: 0x1100, + FASTEST: 0x1101, + NICEST: 0x1102, + BYTE: 0x1400, + UNSIGNED_BYTE: 0x1401, + SHORT: 0x1402, + UNSIGNED_SHORT: 0x1403, + INT: 0x1404, + UNSIGNED_INT: 0x1405, + FLOAT: 0x1406, + STACK_OVERFLOW: 0x0503, + STACK_UNDERFLOW: 0x0504, + CLEAR: 0x1500, + AND: 0x1501, + AND_REVERSE: 0x1502, + COPY: 0x1503, + AND_INVERTED: 0x1504, + NOOP: 0x1505, + XOR: 0x1506, + OR: 0x1507, + NOR: 0x1508, + EQUIV: 0x1509, + INVERT: 0x150A, + OR_REVERSE: 0x150B, + COPY_INVERTED: 0x150C, + OR_INVERTED: 0x150D, + NAND: 0x150E, + SET: 0x150F, + TEXTURE: 0x1702, + COLOR: 0x1800, + DEPTH: 0x1801, + STENCIL: 0x1802, + STENCIL_INDEX: 0x1901, + DEPTH_COMPONENT: 0x1902, + RED: 0x1903, + GREEN: 0x1904, + BLUE: 0x1905, + ALPHA: 0x1906, + RGB: 0x1907, + RGBA: 0x1908, + POINT: 0x1B00, + LINE: 0x1B01, + FILL: 0x1B02, + KEEP: 0x1E00, + REPLACE: 0x1E01, + INCR: 0x1E02, + DECR: 0x1E03, + VENDOR: 0x1F00, + RENDERER: 0x1F01, + VERSION: 0x1F02, + EXTENSIONS: 0x1F03, + NEAREST: 0x2600, + LINEAR: 0x2601, + NEAREST_MIPMAP_NEAREST: 0x2700, + LINEAR_MIPMAP_NEAREST: 0x2701, + NEAREST_MIPMAP_LINEAR: 0x2702, + LINEAR_MIPMAP_LINEAR: 0x2703, + TEXTURE_MAG_FILTER: 0x2800, + TEXTURE_MIN_FILTER: 0x2801, + TEXTURE_WRAP_S: 0x2802, + TEXTURE_WRAP_T: 0x2803, + REPEAT: 0x2901, + // missing from glcorearb.h + QUAD_STRIP: 0x0008, + POLYGON: 0x0009, + LIST_INDEX: 0x0B33, + LIGHTING: 0x0B50, + ALPHA_TEST: 0x0BC0, + AMBIENT: 0x1200, + DIFFUSE: 0x1201, + SPECULAR: 0x1202, + POSITION: 0x1203, + SPOT_CUTOFF: 0x1206, + GL_COMPILE: 0x1300, + GL_COMPILE_AND_EXECUTE: 0x1301, + EMISSION: 0x1600, + SHININESS: 0x1601, + AMBIENT_AND_DIFFUSE: 0x1602, + COLOR_INDEXES: 0x1603, + MODELVIEW: 0x1700, + PROJECTION: 0x1701, + LIGHT0: 0x4000, + LIGHT1: 0x4001, + LIGHT2: 0x4002, + LIGHT3: 0x4003, + LIGHT4: 0x4004, + LIGHT5: 0x4005, + LIGHT6: 0x4006, + LIGHT7: 0x4007, + BGRA: 0x80E1, + CLAMP_TO_EDGE: 0x812F, + TEXTURE_COMPRESSED: 0x86A1, + }; + GL_Symbols = {}; + for (var name in GL) { + var value = GL[name]; + GL_Symbols[value] = name; + } +} + function registerOpenGL() { if (typeof Squeak === "object" && Squeak.registerExternalModule) { Squeak.registerExternalModule('libGL.so.1', OpenGL()); diff --git a/plopp.css b/plopp.css index aa388ec..eb76162 100644 --- a/plopp.css +++ b/plopp.css @@ -28,7 +28,6 @@ video { } canvas { position: fixed; - background: #000; cursor: default; } canvas.pixelated { diff --git a/squeak.js b/squeak.js index 6fd0213..d9ee1c7 100644 --- a/squeak.js +++ b/squeak.js @@ -1 +1 @@ -!function(){"use strict";if(self.Squeak||(self.Squeak={}),!Squeak.Settings){var settings;try{if(settings=self.localStorage,settings["squeak-foo:"]="bar","bar"!==settings["squeak-foo:"])throw Error();delete settings["squeak-foo:"]}catch(e){settings={}}Squeak.Settings=settings}function yS(e,t){return 31>>t}function HS(){return FS}function IS(e,t){var r,i,a;for((i=t-e)<0&&(i=0-i),r=63,a=1;a<=62;a++)63===r&&GS[a-1]>=i&&(r=a);return r}function JS(e){var t,r,i;for(r=0,t=e;;){if(!(0<(i=t-AS)))return r+=zS(CS,0-i),CS&=zS(255,8-(AS-=t)),r;r+=yS(CS,i),t-=AS,CS=DS[++BS-1],AS=8}}function KS(e,t){var r,i,a,s;for(i=t,a=e;;){if(!((s=(r=8-AS)-a)<0))return CS+=yS(i,s),AS+=a,self;CS+=zS(i,0-s),DS[++BS-1]=CS,i&=yS(1,(CS=AS=0)-s)-1,a-=r}}function LS(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m;if(e=ES.stackValue(1),t=ES.stackIntegerValue(0),p=ES.fetchIntegerofObject(0,e),f=ES.fetchIntegerofObject(1,e),u=ES.fetchIntegerofObject(2,e),c=ES.fetchIntegerofObject(3,e),l=ES.fetchIntegerofObject(4,e),h=ES.fetchIntegerofObject(5,e),CS=ES.fetchIntegerofObject(6,e),AS=ES.fetchIntegerofObject(7,e),BS=ES.fetchIntegerofObject(8,e),DS=ES.fetchBytesofObject(9,e),m=ES.fetchInt16ArrayofObject(10,e),b=ES.fetchIntegerofObject(12,e),o=ES.fetchIntegerofObject(13,e),GS=ES.fetchInt16ArrayofObject(14,e),d=ES.fetchInt16ArrayofObject(15,e),ES.failed())return null;for(a=1;a<=t;a++)if(1==(a&h))32767<(p=JS(16))&&(p-=65536),f=JS(6),m[++b-1]=p;else{for(i=JS(o),n=GS[f],s=0,r=l;0>>=1,r>>>=1;s+=n,0<(i&u)?p-=s:p+=s,32767>>=1,d>>>=1,r>>>=1;u+=f,l+=d,0<(i&b)?c-=u:c+=u,0<(a&b)?h-=l:h+=l,32767>>=1,r>>>=1;o+=l,0=xS}var wS,xS,AS,BS,CS,DS,ES,FS,GS,uU,vU,FU,GU,HU,IU,JU,KU,LU,MU,NU,OU,PU,QU,RU,SU,TU,UU,VU,WU,XU,YU,ZU,$U,_U,aV,bV,cV,dV,eV,fV,gV,hV,iV,jV,kV,lV,mV,nV,oV,pV,qV,rV,sV,tV,uV,vV,wV,xV,yV,zV,AV,BV,CV,DV,EV,FV,GV,HV,IV,JV,KV,LV,MV,NV,OV,PV,QV,RV,SV,TV,UV,VV,WV,XV,YV,ZV,$V,_V,aW,bW,cW,dW,eW,fW,gW,hW,iW,jW,kW,lW,mW,nW,oW,pW,qW,rW,sW,tW,uW,vW,wW,xW,yW,zW,AW,BW,CW,DW,EW,FW,GW,HW,IW,JW,KW,LW,MW,NW,OW,PW,QW,RW,SW,TW,UW,VW,WW,XW,YW,ZW,$W,_W,aX,bX,cX,dX,eX,fX,gX,hX,iX,jX,kX,lX,mX,nX,oX,pX,qX,rX,sX,tX,uX,vX,wX,xX,yX,zX,AX,BX,CX,DX,EX,FX,GX,HX,IX,JX,KX,LX,MX,NX,OX,PX,QX,RX,SX,TX,UX,VX,WX,XX,YX,ZX,$X,_X,aY,bY,cY,dY,eY,fY,gY,hY,iY,jY,kY,lY,mY,nY,oY,pY,qY,rY,sY,tY,uY,vY,wY,xY,yY,zY,AY,BY,CY,DY,EY,FY,GY,HY,IY,JY,KY,LY,MY,NY,OY,Psa,Qsa,Zsa,$sa,_sa,ata,bta,cta,dta,eta,fta,gta,hta,ita,jta,kta,lta,mta,nta,ota,pta,qta,rta,sta,tta,uta,vta,wta,xta,yta,zta,Ata,Bta,Cta,Dta,Eta,Fta,Gta,Hta,Ita,Jta,Kta,Lta,Mta,Nta,Ota,Pta,Qta,Rta,Sta,Tta,Uta,Vta,Wta,Xta,Yta,Zta,$ta,_ta,aua,bua,cua,dua,eua,fua,gua,hua,iua,jua,kua,lua,mua,nua,oua,pua,qua,rua,sua,tua,uua,vua,wua,xua,yua,zua,Aua,Bua,Cua,Dua,Eua,Fua,Gua,Hua,Iua,Jua,Kua,Lua,Mua,Nua,Oua,Pua,Qua,Rua,Sua,Tua,Uua,Vua,Wua,Xua,Yua,Zua,$ua,_ua,ava,bva,cva,dva,eva,fva,gva,nIa,oIa,sIa,tIa,uIa,vIa,wIa,xIa,yIa,zIa,AIa,BIa,CIa,DIa,DJa,EJa,GJa,HJa,KLa,LLa,OLa,PLa,mNa,nNa,tNa,uNa,vNa,wNa,xNa,yNa,zNa,ANa,BNa,CNa,DNa,ENa,FNa,GNa,HNa,INa,JNa,KNa,LNa,MNa,NNa,ONa,PNa,QNa,RNa,SNa,TNa,UNa,VNa,WNa,XNa,YNa,ZNa,$Na,_Na,aOa,bOa,cOa,dOa,eOa,fOa,gOa,hOa,iOa,jOa,kOa,lOa,mOa,nOa,oOa,pOa,qOa,rOa,sOa,tOa,uOa,UQa,VQa,$Qa,_Qa,aRa,bRa,cRa,dRa,eRa,V$a,W$a,_$a,a_a,b_a,c_a,d_a,e_a,f_a,zeb,Aeb,Eeb,Feb,Geb,Heb,Ieb,Jeb,Keb,Leb,Meb,Neb,Oeb,Peb,Qeb,Reb,Seb,Teb,Ueb,Veb,Web,Xeb,Yeb,Zeb,$eb,_eb,afb,bfb,cfb,dfb,efb,ffb,gfb,hfb,ifb,jfb,kfb,lfb,mfb,nfb,ofb,pfb,qfb,rfb,sfb,tfb,ufb,vfb,wfb,xfb,yfb,zfb,Afb,Bfb,Cfb,Dfb,Efb,Ffb,Gfb,Hfb,Ifb,Jfb,Kfb,Lfb,Mfb,Nfb,Ofb,Pfb,Qfb,Rfb,Sfb,Tfb,Ufb,Vfb,Wfb,Xfb,Yfb,Zfb,$fb,_fb,agb,bgb,cgb,dgb,egb,fgb,ggb,hgb,igb,jgb,kgb,lgb,mgb,ngb,ogb,pgb,qgb,rgb,sgb,tgb,ugb,vgb,ekb,fkb,mkb,nkb,okb,pkb,qkb,Usb,Vsb,Ysb,Zsb,$sb,_sb,atb,btb,Qub,Rub,Vub,Wub,$wb,_wb,dxb,exb,THb,UHb,XHb,YHb,ZHb,$Hb,_Hb,aIb,zKb,AKb,EKb,FKb,JLb,KLb,SLb,TLb,ULb,VLb,WLb,XLb,YLb,ZLb,$Lb,_Lb,aMb,bMb,cMb,dMb,eMb,fMb,gMb,hMb,iMb,jMb,kMb,lMb,mMb,nMb,oMb,pMb,qMb,rMb,sMb,tMb,uMb,vMb,wMb,xMb,yMb,zMb,AMb,BMb,CMb,DMb,EMb,FMb,GMb,HMb,IMb,JMb,KMb;function wU(e){return"number"==typeof e?IY.classSmallInteger():e.sqClass}function xU(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function zU(e,t){return 0|Math.floor(e/t)}function BU(e,t){return 31>>t}function DU(e,t){return new Int32Array(e.buffer,e.byteOffset+4*t)}function EU(e,t){return new Float32Array(e.buffer,e.byteOffset+4*t)}function PY(){return OY[dX]}function QY(e){return OY[dX]=e}function RY(){return OY[eX]}function TY(e,t){var r;return t<(r=e+WY()-1&~(WY()-1))?t:r}function VY(e,t){return t-1&~(WY()-1)}function WY(){return OY[gX]}function YY(){return OY[hX]}function ZY(e){return OY[hX]=e}function $Y(){return OY[iX]}function _Y(e){return OY[iX]=e}function bZ(e,t){var r;return 0===e?t<0?0-t:t:0===t?e<0?0-e:e:(r=e*e+t*t)<32?[0,1,1,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,6][r]:Math.sqrt(r)+.5|0}function cZ(e){oZ(1)&&(HY[e0()]=e,f0(e0()+1))}function gZ(){return OY[jX]}function hZ(e){return OY[jX]=e}function iZ(){return OY[kX]}function jZ(e){return OY[kX]=e}function kZ(e){return K1(e)}function mZ(){return J4(6),K4()}function nZ(e,t){var r,i,a,s;if(!rZ(a=eV+e))return 0;if(MY=(i=MY)+a,$1(i,cW),W1(i,0),Y1(i,a),r=F$(i),j0())for(s=0;s<=e-1;s++)r[s]=y4(t[s]);else for(s=0;s<=e-1;s++)r[s]=t[s];return P1(i,aV,e),i}function oZ(e){var t,r,i,a;if(kZ(e)){if(0!==iZ())for(i=iZ(),t=iZ()+e,r=1,a=iZ();r<=a;r++)xY[--t]=xY[--i];return xY=DU(xY,e),1}}function pZ(e,t,r){var i,a,s,n;if(!rZ(a=PW+t))return 0;if(MY=(i=MY)+a,$1(i,r?jW:iW),W1(i,0),Y1(i,a),n=i0(i),j0())for(s=0;s<=t-1;s++)n[s]=y4(e[s]);else for(s=0;s<=t-1;s++)n[s]=e[s];return P1(i,NW,t),i}function rZ(e){var t,r,i,a;if(oZ(e)){if(0!==e0())for(i=e0(),t=e0()+e,r=1,a=e0();r<=a;r++)HY[--t]=HY[--i];return HY=DU(HY,e),1}}function tZ(){return J4(3)}function wZ(e){return 0==(O1(e,aW)&yV)}function xZ(e,t,r){if(r>>5&31)<<3,l=(h>>>10&31)<<3,h=(a+=a>>>5)+((u+=u>>>5)<<8)+((l+=l>>>5)<<16)+(255<<24)):h=0===O1(e,aV)?0:F$(e)[h]),E4(h)}function WZ(e){return O1(e,$U)}function YZ(e){return L4(K4()-e+4)}function ZZ(e,t){return M4(K4()-e+4,t)}function $Z(e){return L4(K4()-e+5)}function _Z(e,t){return M4(K4()-e+5,t)}function a$(e){return L4(K4()-e+0)}function b$(e,t){return M4(K4()-e+0,t)}function c$(e){return L4(K4()-e+1)}function d$(e,t){return M4(K4()-e+1,t)}function e$(e){return L4(K4()-e+2)}function f$(e,t){return M4(K4()-e+2,t)}function g$(e){return L4(K4()-e+3)}function h$(e,t){return M4(K4()-e+3,t)}function i$(e,t,r){var i,a,s,n,o,u;for(s=xU(e),i=e.wordsAsInt32Array(),a=n=0;a<=s-1;a++){if(o=m3(a,i),!(0<=(u=n3(a,i))&&u<=t))return;n+=o}return n===r}function m$(e,t,r,i,a,s,n){var o,u,l,c;if((u=e,l=t,IY.isWords(u)&&((c=xU(u))===3*l||c===6*l))&&(function(e){var t,r,i;if(IY.isWords(e)){for(i=xU(e),t=e.wordsAsInt32Array(),r=0;r<=i-1;r++)if(!C0(t[r]))return;return 1}}(n)&&i$(r,o=xU(n),t)&&i$(i,o,t)&&i$(s,o,t)&&function(e,t){var r,i,a,s;for(i=xU(e),s=e.wordsAsInt32Array(),r=a=0;r<=i-1;r++)a+=m3(r,s);return a===t}(a,t)))return 1}function o$(e){return(Z1(e)&oW)===hW?function(e){var t;t=G0(e)?c5(e):0;if(R0(e)+t=x_()&&P0(e)-t>=x_())return 0;cZ(e)}(e):(Z1(e)&oW)===bW?(r=G0(t=e)?T4(t):0,!(AZ(t)+r=x_()&&yZ(t)-r>=x_())&&void cZ(t)):void cZ(e);var t,r}function q$(){return[1,.98078528040323,.923879532511287,.831469612302545,.7071067811865475,.555570233019602,.38268343236509,.1950903220161286,0,-.1950903220161283,-.3826834323650896,-.555570233019602,-.707106781186547,-.831469612302545,-.9238795325112865,-.98078528040323,-1,-.98078528040323,-.923879532511287,-.831469612302545,-.707106781186548,-.555570233019602,-.3826834323650903,-.1950903220161287,0,.1950903220161282,.38268343236509,.555570233019602,.707106781186547,.831469612302545,.9238795325112865,.98078528040323,1]}function r$(){return[0,.1950903220161282,.3826834323650897,.555570233019602,.707106781186547,.831469612302545,.923879532511287,.98078528040323,1,.98078528040323,.923879532511287,.831469612302545,.7071067811865475,.555570233019602,.38268343236509,.1950903220161286,0,-.1950903220161283,-.3826834323650896,-.555570233019602,-.707106781186547,-.831469612302545,-.9238795325112865,-.98078528040323,-1,-.98078528040323,-.923879532511287,-.831469612302545,-.707106781186548,-.555570233019602,-.3826834323650903,-.1950903220161287,0]}function s$(e,t){return e<0?0:t<=e?t-1:e}function t$(){var e,t;for((e=CU(x3(),$Y()))<0&&(e=0),(t=CU(t3(),$Y())+1)>v3()&&(t=v3());e>1,l=o+=(r=$Z(e))-d>>1,u+=(i+=f-c>>1)-n>>1,l+=(a+=d-h>>1)-o>>1,f$(e,i),h$(e,a),ZZ(e,u),_Z(e,l),b$(s,u),d$(s,l),f$(s,n),h$(s,o),ZZ(s,t),_Z(s,r),s)}function I$(e,t){var r,i,a;r=EZ(e)[lV]>>8,(i=X4(e)[lV]>>8)w$()&&(r=w$()),(i=CU(e,$Y()))=y$()||r=w$()||(a=t,s=r,n=i,(zY||u0())&&zY(a,s,n))}function V$(e){return $1(e,Z1(e)|yV)}function W$(e){return $1(e,Z1(e)&~yV)}function Y$(e,t){return P1(e,XV,t)}function Z$(e){return O1(e,ZV)}function $$(e,t){return P1(e,ZV,t)}function a_(e,t){return P1(e,YV,t)}function b_(){return EU(OY,JX)}function d_(e){return O1(e,yW)}function e_(e,t){return P1(e,yW,t)}function f_(e){return O1(e,zW)}function g_(e,t){return P1(e,zW,t)}function h_(e){return O1(e,AW)}function i_(e,t){return P1(e,AW,t)}function j_(e,t){var r,i,a;for(r=q4(),i=e,a=x4();a>16,O=b>>16,S||(I=s$(I,u),O=s$(O,o)),0<=I&&0<=O&&I>16,O=b>>16,S||(I=s$(I,u),O=s$(O,o)),0<=I&&0<=O&&I>16,O=b>>16,S||(I=s$(I,u),O=s$(O,o)),0<=I&&0<=O&&I>16,g=h>>16,p||(v=s$(v,n),g=s$(g,s)),0<=v&&0<=g&&v>16)<0||u<=o)&&l>16)>16,h=TY(v=a,s),d=VY(0,s),u=PY(),l=RY();for(;v>16===p;)f=CU(v,o),NY[f]=NY[f]+m,++v,c+=i;p=c>>16}u=4042322160|CU(PY(),$Y()),l=$Y();for(;v>16===p;)f=CU(v,o),NY[f]=NY[f]+m,v+=n,c+=BU(i,l);p=c>>16}u=PY(),l=RY();for(;v>16===p;)f=CU(v,o),NY[f]=NY[f]+m,++v,c+=i;p=c>>16}return v}(e,n,a,s,l,r);l>16,l>>16)>=h&&p>16,(u=0|r[1])>>16)],l=(h-1)*(h-1),d=s,(p=n)>J_(e)&&(p=J_(e));d>16,u>>16)>=l;)NY[d]=f,++d,o+=i,u+=a;for(c=z3(o>>16,u>>16);c>16,f>>16))-1)*(g-1),_=s,n<(S=J_(e))&&(S=n),d=TY(s,S),b=VY(0,S),_>16,f>>16)>=m;)p=CU(_,u),NY[p]=NY[p]+k,++_,h+=i,f+=a;for(v=z3(h>>16,f>>16);v>16,f>>16)>=m;)p=CU(_,u),NY[p]=NY[p]+k,_+=o,h+=BU(i,c),f+=BU(a,c);for(v=z3(h>>16,f>>16);v>16,f>>16)>=m;)p=CU(_,u),NY[p]=NY[p]+k,++_,h+=i,f+=a;for(v=z3(h>>16,f>>16);v>16,u>>16),p=t[f],d=g0(e),c=(d-1)*(d-1),h=(f+1)*(f+1),l=z3(o>>16,u>>16),b=s,m=n;for(;b>16,u>>16)<=h;)NY[b]=p,++b,o+=i,u+=a;for(l=z3(o>>16,u>>16);h>16,f>>16),_=g0(e),v=(_-1)*(_-1),g=(k+1)*(k+1),b=z3(h>>16,f>>16),d=TY(y=s,n),m=VY(0,n),y>16,f>>16)<=g;)p=CU(y,u),NY[p]=NY[p]+S,++y,h+=i,f+=a;for(b=z3(h>>16,f>>16);g>16,f>>16)<=g;)p=CU(y,u),NY[p]=NY[p]+S,y+=o,h+=BU(i,c),f+=BU(a,c);for(b=z3(h>>16,f>>16);g>16,f>>16)<=g;)p=CU(y,u),NY[p]=NY[p]+S,++y,h+=i,f+=a;for(b=z3(h>>16,f>>16);g>>0>>0}function U_(e,t,r){var i,a,s,n,o,u;if(0===e)return!1;if(a=tBU(v3(),$Y())?BU(v3(),$Y()):r,ax_()&&(s=x_()),at3()&&u3(s),s>r3()&&s3(s),s<=a)return!1;if(B0(e))o_(e,a,s);else{if(u=e,OY[UX]=u,o=a,OY[VX]=o,n=s,OY[WX]=n,(i=(Z1(e)&gW)>>>8)<=1)return!0;switch(i){case 0:case 1:break;case 2:u_();break;case 3:P_();break;case 4:case 5:k_()}}return!1}function W_(){var e,t,r;for(r=M$();c0()r)return!1;if(((t=Z1(e))&oW)===dW)return!0;if(!K1(1))return!1;switch(t){case 0:case 1:case 2:case 3:break;case 4:N3(HY[c0()],M$());break;case 5:!function(e,t){var r,i,a,s,n,o,u,l;a=c5(e),i=_1(a),n=d_(e),o=f_(e),N3(e,o),s=Z$(e),u=Z0(e),e_(e,n-i),$$(e,s+a),0=x_())return!1;if(_2(t),G0(e)&&o4(e),wZ(e)&&(n4(e),EY))return!1;hZ(gZ()+1),gZ()=B_()&&j_(t,r)}return r=F3()?-1:r}function $_(){return I3()===rW}function __(){var e;e=3,O4(N4()+e)}function a0(){return KY}function b0(e,t){var r;return e===t||(0!==(r=f_(e)-f_(t))?r<0:(r=d_(e)-d_(t))<0)}function c0(){return OY[OX]}function d0(e){return OY[OX]=e}function e0(){return OY[PX]}function f0(e){return OY[PX]=e}function g0(e){return O1(e,NW)}function i0(e){return DU(LY,e+OW)}function j0(){return 0!==OY[QX]}function l0(e){return OY[QX]=e}function m0(){return 0!==OY[RX]}function o0(e){return OY[RX]=e}function p0(e,t){var r,i,a,s,n;if(-1===(r=Z_(e,t)))return!1;if(0===r)return __(),!0;if(H3(r,G3(0)),B3(r,A3(0)),E3(r,D3(0)),__(),F3()<=3)return!0;for(n=0,r=3;rv3()&&x$(v3()),e=BU(A$(),$Y()),OY[MX]=e,t=BU(C$(),$Y()),OY[NX]=t,r=BU(w$(),$Y()),OY[KX]=r,i=BU(y$(),$Y()),OY[LX]=i,f0(0),jZ(0),HY=DU(LY,MY),xY=DU(LY,MY),function(){var e,t;for(t=0,e=MY;t=z_()||o$(t)),t+=O1(t,_V)}(),EY||(0!==e0()?(function e(t,r,i){var a;var s;var n;var o;var u;var l;var c;var h;var f;var d;var p;if((f=i+1-r)<=1)return 0;n=t[r];u=t[i];s=b0(n,u);s||(d=t[r],t[r]=t[i],t[i]=d,p=n,n=u,u=p);if(f<=2)return 0;l=r+i>>1;o=t[l];s=b0(n,o);s?(s=b0(o,u))||(d=t[i],t[i]=t[l],t[l]=d,o=u):(d=t[r],t[r]=t[l],t[l]=d,o=n);if(f<=3)return 0;c=r;h=i;a=!0;for(;a;){for(s=!0;s;)s=c<=--h&&(d=t[h],b0(o,d));for(s=!0;s;)s=++c<=h&&b0(d=t[c],o);(a=c<=h)&&(d=t[c],t[c]=t[h],t[h]=d)}e(t,r,h);e(t,c,i)}(HY,0,e0()-1),N$(f_(HY[0])),M$()xU(FY)?null:(r=IY.fetchPointerofObject(i,FY),xU(t=IY.fetchPointerofObject(0,r))!==O1(e,ZU)?null:t.wordsAsInt32Array())}function l1(e,t,r,i,a,s,n){var o,u,l,c,h,f,d,p;if(i!==a||0!==s&&0!==n){if(o=6*e,p=r?(l=(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[0+o],f=(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[1+o],c=(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[2+o],d=(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[3+o],h=(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[4+o],(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[5+o]):(l=0|t[0+o],f=0|t[1+o],c=0|t[2+o],d=0|t[3+o],h=0|t[4+o],0|t[5+o]),l===c&&f===d||c===h&&d===p)return(l!==h||f!==p)&&(a2()[0]=l,a2()[1]=f,b2()[0]=h,b2()[1]=p,C4(2),D1(s,a2(),b2(),n,i,a));a2()[0]=l,a2()[1]=f,b2()[0]=c,b2()[1]=d,c2()[0]=h,c2()[1]=p,C4(3),u=c1(a2(),b2(),c2(),0!==s&&0!==n),EY||C1(s,n,i,a,u)}}function n1(e){var t;return t=OY[TX],xU(e)>1),l=2*(l=r$()[2*e+1]*r+a|0)-(u+c>>1),b2()[0]=n,b2()[1]=l}function v1(e,t){var r;return wU(t)===IY.classPoint()&&("number"==typeof(r=IY.fetchPointerofObject(0,t))||r.isFloat)?(e[0]="number"==typeof r?r:0|IY.floatValueOf(r),"number"==typeof(r=IY.fetchPointerofObject(1,t))||r.isFloat?void(e[1]="number"==typeof r?r:0|IY.floatValueOf(r)):IY.primitiveFail()):IY.primitiveFail()}function y1(){var e,t,r,i;return 2!==IY.methodArgumentCount()?wY:0!==(t=Y2(IY.stackValue(2)))?t:(r=IY.stackObjectValue(0),e=IY.stackObjectValue(1),IY.failed()?vY:0!==(t=A1(IY.fetchPointerofObject(IU,DY)))?t:h1(IY.fetchPointerofObject(GU,DY))?q1(IY.fetchPointerofObject(HU,DY))?xU(e)=c$(c)?(e_(l,a$(c)),g_(l,c$(c)-d),GZ(l,e$(c)),IZ(l,g$(c)-d),zZ(l,YZ(c)),BZ(l,$Z(c)-d)):(e_(l,YZ(c)),g_(l,$Z(c)-d),GZ(l,e$(c)),IZ(l,g$(c)-d),zZ(l,a$(c)),BZ(l,c$(c)-d)),i_(l,O$()),Y$(l,h),a_(l,f),u&&(P1(s,sV,t),Z4(s,e),P1(s,rV,e)),n-=6}H4()}function D1(e,t,r,i,a,s){var n,o,u,l;if(o=0===e||0===i?(n=rZ(QW)?(MY=(l=MY)+QW,$1(l,hW),W1(l,0),Y1(l,QW),l):0,0):(n=rZ($W)?(MY=(u=MY)+$W,$1(u,nW),W1(u,0),Y1(u,$W),u):0,_1(e)),EY)return 0;s1(n,t,r,o,a,s),G0(n)&&(P1(n,ZW,i),h5(n,e),P1(n,YW,e))}function F1(e){return"number"==typeof e?OV:IY.isWords(e)?xU(e)F4()?TV:0)):PV}function I1(e){0===strcmp(e,yY)&&(zY=JY=0)}function K1(e){return!(SX+MY+e0()+iZ()+e>N4())||(_3(GW),!1)}function L1(){return 0!==OY[$X]}function N1(e){return OY[$X]=e}function O1(e,t){return LY[e+t]}function P1(e,t,r){return LY[e+t]=r}function Q1(){return OY[_X]}function S1(){return OY[aY]}function T1(e){return OY[aY]=e}function V1(e){return O1(e,$V)}function W1(e,t){return P1(e,$V,t)}function Y1(e,t){return P1(e,_V,t)}function Z1(e){return O1(e,aW)&kW}function $1(e,t){return P1(e,aW,t)}function _1(e){return e>>1}function a2(){return DU(OY,bY)}function b2(){return DU(OY,cY)}function c2(){return DU(OY,dY)}function d2(){return DU(OY,eY)}function e2(){c0()>=e0()&&0===iZ()&&J3(rW),M$()>=z_()&&J3(rW)}function f2(){var e;return 0!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Y2(IY.stackValue(0)))?IY.primitiveFailFor(e):(J3(rW),void d4())}function g2(){var e,t,r;return CY&&(GY=IY.ioMicroMSecs()),1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(r=Z2(IY.stackValue(1),wW))?IY.primitiveFailFor(r):(t=IY.stackObjectValue(0),IY.failed()?IY.primitiveFailFor(vY):(e=n1(t))?K1(1)?(0>1,n=b2()[1]-a2()[1]>>1,a=b2()[0]+a2()[0]>>1,s=b2()[1]+a2()[1]>>1,o=0;o<=15;o++){if(u1(o,l,n,a,s),C4(3),u=c1(a2(),b2(),c2(),0!==e&&0!==t),EY)return;if(C1(e,t,r,i,u),EY)return}}(t,e,0,a),EY?(H4(),IY.primitiveFailFor(GV)):IY.failed()?IY.primitiveFailFor(JV):(N1(1),d4(),void IY.pop(5)))):IY.primitiveFailFor(TV)):IY.primitiveFailFor(VV))}function o2(){var e,t,r,i,a,s,n,o;if(5!==IY.methodArgumentCount())return IY.primitiveFailFor(wY);if(i=IY.positive32BitValueOf(IY.stackValue(0)),a=IY.stackIntegerValue(1),t=IY.positive32BitValueOf(IY.stackValue(2)),s=IY.stackIntegerValue(3),n=IY.stackObjectValue(4),IY.failed())return IY.primitiveFailFor(vY);if(0!==(e=Z2(IY.stackValue(5),tW)))return IY.primitiveFailFor(e);if(r=xU(n),IY.isWords(n)){if(o=!1,r!==s&&2*s!==r)return IY.primitiveFailFor(vY)}else{if(!IY.isArray(n))return IY.primitiveFailFor(vY);if(r!==s)return IY.primitiveFailFor(vY);o=!0}return K1((0===a||0===i?QW:$W)*s)?C0(i)&&C0(t)?(i=y4(i),t=y4(t),EY?IY.primitiveFailFor(GV):0!==i&&0!==a||0!==t?(0!==a&&(a=D4(a)),o?function(e,t,r,i,a){var s,n,o,u,l;if(v1(a2(),IY.fetchPointerofObject(0,e)),!IY.failed())for(n=a2()[0],u=a2()[1],s=1;s<=t-1;s++){if(v1(a2(),IY.fetchPointerofObject(s,e)),IY.failed())return;if(o=a2()[0],l=a2()[1],a2()[0]=n,a2()[1]=u,b2()[0]=o,b2()[1]=l,C4(2),D1(i,a2(),b2(),a,r,0),EY)return;n=o,u=l}}(n,s,t,a,i):function(e,t,r,i,a,s){var n,o,u,l,c;for(l=s?(o=(e.int16Array||(e.int16Array=new Int16Array(e.buffer,e.byteOffset)))[0],(e.int16Array||(e.int16Array=new Int16Array(e.buffer,e.byteOffset)))[1]):(o=0|e[0],0|e[1]),n=1;n<=t-1;n++){if(c=s?(u=(e.int16Array||(e.int16Array=new Int16Array(e.buffer,e.byteOffset)))[2*n],(e.int16Array||(e.int16Array=new Int16Array(e.buffer,e.byteOffset)))[2*n+1]):(u=0|e[2*n],0|e[2*n+1]),a2()[0]=o,a2()[1]=l,b2()[0]=u,b2()[1]=c,C4(2),D1(i,a2(),b2(),a,r,0),EY)return;o=u,l=c}}(n.wordsAsInt32Array(),s,t,a,i,s===r),EY?IY.primitiveFailFor(GV):IY.failed()?IY.primitiveFailFor(JV):(N1(1),d4(),void IY.pop(5))):IY.pop(5)):IY.primitiveFailFor(VV):IY.primitiveFail()}function p2(){var e,t,r,i,a,s,n,o,u,l;return 5!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):(e=IY.positive32BitValueOf(IY.stackValue(0)),t=IY.stackIntegerValue(1),a=IY.positive32BitValueOf(IY.stackValue(2)),r=IY.stackObjectValue(3),s=IY.stackObjectValue(4),IY.failed()?IY.primitiveFailFor(vY):0!==(i=Z2(IY.stackValue(5),tW))?IY.primitiveFailFor(i):C0(e)&&C0(a)?(e=y4(e),a=y4(a),EY?IY.primitiveFailFor(GV):0!==a||0!==e&&0!==t?K1(4*QW)?(t=0t3()&&u3(c),c>r3()&&s3(c)}(e.wordsAsInt32Array(),L0(),N0()),J3(sW),d4(),IY.pop(2),void(CY&&(q0(BX,1),q0(rY,IY.ioMicroMSecs()-GY))))))))}function G2(){var e,t;return 0!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Y2(IY.stackValue(0)))?IY.primitiveFailFor(e):(t=L1(),d4(),IY.pop(1),void IY.pushBool(t))}function H2(){var e,t;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Y2(IY.stackValue(1)))?IY.primitiveFailFor(e):(t=IY.booleanValueOf(IY.stackValue(0)),IY.failed()?IY.primitiveFailFor(vY):(N1(!0===t?1:0),d4(),void IY.pop(1)))}function I2(){var e,t,r,i,a,s,n;return CY&&(GY=IY.ioMicroMSecs()),1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(i=IY.stackValue(1),a=uW,s=rW,t=0===(n=Y2(i))?I3()!==a&&I3()!==s?(b4(CW),WV):0:n)?IY.primitiveFailFor(t):(e=IY.stackObjectValue(0),IY.failed()?IY.primitiveFailFor(vY):(r=!1,I3()!==rW&&((r=Y_())?(c4(xY[gZ()],e),J3(vW)):J3(pW)),IY.failed()?null:(d4(),IY.pop(2),IY.pushBool(!r),void(CY&&(q0(CX,1),q0(sY,IY.ioMicroMSecs()-GY))))))}function J2(){var e,t,r;return CY&&(GY=IY.ioMicroMSecs()),1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),sW))||0!==(e=A1(IY.fetchPointerofObject(IU,DY)))?IY.primitiveFailFor(e):q1(IY.fetchPointerofObject(HU,DY))?(0!==u$()&&(0==(M$()&YY())&&t$(),v$(0)),t=IY.stackObjectValue(0),r=X_(),EY?IY.primitiveFailFor(GV):(r&&e4(t),IY.failed()?IY.primitiveFailFor(VV):(r?J3(xW):(H4(),s3(0),J3(qW)),d4(),IY.pop(2),IY.pushBool(!r),void(CY&&(q0(DX,1),q0(tY,IY.ioMicroMSecs()-GY)))))):IY.primitiveFailFor(LV)}function K2(){var e,t,r;return CY&&(GY=IY.ioMicroMSecs()),1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(t=Z2(IY.stackValue(1),pW))?IY.primitiveFailFor(t):(e=IY.stackObjectValue(0),(r=W_())&&(c4(HY[c0()],e),d0(c0()+1)),IY.failed()?IY.primitiveFailFor(UV):(r?J3(wW):(J3(sW),v$(1),hZ(0),H4()),d4(),IY.pop(2),IY.pushBool(!r),void(CY&&(q0(EX,1),q0(uY,IY.ioMicroMSecs()-GY)))))}function L2(){var e,t,r,i,a,s,n,o;return 6!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(t=Z2(IY.stackValue(6),tW))?IY.primitiveFailFor(t):(o=IY.positive32BitValueOf(IY.stackValue(0)),n=IY.positive32BitValueOf(IY.stackValue(1)),s=IY.stackIntegerValue(2),a=IY.stackIntegerValue(3),i=IY.stackIntegerValue(4),r=IY.stackIntegerValue(5),IY.failed()?IY.primitiveFailFor(vY):rZ(wV)?C0(n)&&C0(o)?(MY=(e=MY)+wV,$1(e,dW),Y1(e,wV),W1(e,r),e_(e,i),g_(e,a),i_(e,s),Y$(e,y4(n)),a_(e,y4(o)),EY?IY.primitiveFailFor(GV):void(IY.failed()||(d4(),IY.pop(6)))):IY.primitiveFailFor(VV):IY.primitiveFailFor(TV))}function M2(){var e,t,r;if(1!==IY.methodArgumentCount())return IY.primitiveFailFor(wY);if(0!==(e=Z2(IY.stackValue(1),tW)))return IY.primitiveFailFor(e);if(r=IY.stackIntegerValue(0),IY.failed())return IY.primitiveFailFor(vY);for(t=0;0===t;){if(!rZ(wV))return IY.primitiveFailFor(TV);MY=(t=MY)+xV,$1(t,fW),Y1(t,xV),W1(t,r)}IY.failed()||(d4(),IY.pop(2),IY.pushInteger(t))}function N2(){var e;return 0!==(e=y1())?IY.primitiveFailFor(e):(X2(),EY?f4():(function(){var e;for(;!$_();){if(CY&&(GY=IY.ioMicroMSecs()),e=W_(),CY&&(q0(EX,1),q0(uY,IY.ioMicroMSecs()-GY)),EY)return J3(pW);if(e)return J3(wW),_3(EW);if(hZ(0),H4(),v$(1),CY&&(GY=IY.ioMicroMSecs()),0!==u$()&&0==(M$()&YY())&&t$(),v$(0),e=X_(),CY&&(q0(DX,1),q0(tY,IY.ioMicroMSecs()-GY)),EY)return J3(sW);if(e)return J3(xW),_3(DW);if(H4(),s3(0),CY&&(GY=IY.ioMicroMSecs()),(M$()&YY())===YY()&&(U$(M$()),e2()),CY&&(q0(yX,1),q0(oY,IY.ioMicroMSecs()-GY)),EY)return J3(qW);if($_())return;if(hZ(0),N$(M$()+1),CY&&(GY=IY.ioMicroMSecs()),e=Y_(),CY&&(q0(CX,1),q0(sY,IY.ioMicroMSecs()-GY)),EY)return J3(uW);if(e)return J3(vW),_3(BW)}}(),void f4()))}function O2(){var e;if(0!==(e=y1()))return IY.primitiveFailFor(e);X2(),f4()}function P2(){var e,t;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(e):(t=IY.stackIntegerValue(0),IY.failed()?IY.primitiveFailFor(vY):(k3(t),d4(),void IY.pop(1)))}function Q2(){var e,t,r;if(t=IY.stackValue(0),!IY.isBytes(t))return IY.primitiveFail();if(256<=((r=t).bytes?r.bytes.length:r.words?4*r.words.length:0))return IY.primitiveFail();t.bytes,e=!1;var i=t.bytesAsString();if(i!==yY&&(yY=i,e=!0),e&&!u0())return IY.primitiveFail();IY.pop(1)}function R2(){var e,t;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(e):(t=IY.stackObjectValue(0),!IY.failed()&&IY.isPointers(t)&&2<=xU(t)?(v1(a2(),IY.fetchPointerofObject(0,t)),v1(b2(),IY.fetchPointerofObject(1,t)),IY.failed()?IY.primitiveFailFor(vY):(B$(a2()[0]),D$(a2()[1]),x$(b2()[0]),z$(b2()[1]),d4(),void IY.pop(1))):IY.primitiveFailFor(vY))}function S2(){var e,t,r,i;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(e):(t=IY.stackObjectValue(0),IY.failed()?IY.primitiveFailFor(vY):(r=t,i=E$(),l0(0),B1(r,i,8)&&(l0(1),i[1]=256*i[1],i[3]=256*i[3],i[5]=256*i[5],i[7]=256*i[7]),IY.failed()?IY.primitiveFailFor(JV):(d4(),void IY.pop(1))))}function T2(){var e,t;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(t=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(t):(e=IY.stackIntegerValue(0),IY.failed()?IY.primitiveFailFor(vY):(P$(e),d4(),void IY.pop(1)))}function U2(){var e,t,r,i,a;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(e):(t=IY.stackObjectValue(0),IY.failed()?IY.primitiveFailFor(vY):(r=t,o0(0),i=B1(r,a=b_(),6),!IY.failed()&&i&&(o0(1),a[2]=a[2]+Q$(),a[5]=a[5]+S$()),IY.failed()?IY.primitiveFailFor(vY):(d4(),void IY.pop(1))))}function V2(){var e,t,r,i;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(e):wU(t=IY.stackValue(0))!==IY.classPoint()?IY.primitiveFailFor(vY):(v1(a2(),t),IY.failed()?IY.primitiveFailFor(vY):(r=a2()[0],OY[HX]=r,i=a2()[1],OY[IX]=i,d4(),void IY.pop(1)))}function X2(){var e,t;if((t=I3())===tW){if(v0(),EY)return;t=pW}if(t===pW){if(CY&&(GY=IY.ioMicroMSecs()),e=W_(),CY&&(q0(EX,1),q0(uY,IY.ioMicroMSecs()-GY)),EY)return J3(pW);if(e)return J3(wW),_3(EW);hZ(0),H4(),v$(1),t=sW}if(t===sW){if(CY&&(GY=IY.ioMicroMSecs()),0!==u$()&&0==(M$()&YY())&&t$(),v$(0),e=X_(),CY&&(q0(DX,1),q0(tY,IY.ioMicroMSecs()-GY)),EY)return J3(sW);if(e)return J3(xW),_3(DW);t=qW,H4(),s3(0)}if(t===qW){if(CY&&(GY=IY.ioMicroMSecs()),(M$()&YY())===YY()&&(U$(M$()),e2()),CY&&(q0(yX,1),q0(oY,IY.ioMicroMSecs()-GY)),EY)return J3(qW);if($_())return;t=uW,hZ(0),N$(M$()+1)}if(t===uW){if(CY&&(GY=IY.ioMicroMSecs()),e=Y_(),CY&&(q0(CX,1),q0(sY,IY.ioMicroMSecs()-GY)),EY)return J3(uW);if(e)return J3(vW),_3(BW);J3(pW)}}function Y2(e){var t;return IY.failed()?zV:"number"==typeof e?EV:IY.isPointers(e)?xU(e)r;)xY[i]=xY[i-1],--i;xY[i]=t}(gZ(),e,t))}function g3(){return AY=O1(BY,sV)}function h3(){return AY=O1(BY,vV)}function i3(){return AY=O1(BY,ZW)}function k3(e){var t,r,i,a;4<=e&&(t=4),2<=e&&e<4&&(t=2),e<2&&(t=1),r=t,OY[gX]=r,1===t&&(_Y(0),QY(4294967295),ZY(0)),2===t&&(_Y(1),QY(4244438268),ZY(1)),4===t&&(_Y(2),QY(4042322160),ZY(3)),i=2*$Y(),OY[eX]=i,a=$Y(),OY[fX]=a}function l3(e){return!1!=((IY=e).majorVersion()==uU)&&IY.minorVersion()>=vU}function m3(e,t){return(0|t[e])>>>16}function n3(e,t){return 65535&(0|t[e])}function o3(e,t,r){tZ()&&(H3(0,e),B3(0,t),E3(0,r),3!==F3()&&T_(0,F3()-3)&&(H3(0,v4()),B3(0,r4()),E3(0,t4()),w4(e),s4(t),u4(r)))}function r3(){return OY[hY]}function s3(e){return OY[hY]=e}function t3(){return OY[gY]}function u3(e){return OY[gY]=e}function v3(){return OY[iY]}function x3(){return OY[jY]}function y3(e){return OY[jY]=e}function z3(e,t){return e*e+t*t}function A3(e){return L4(e+1)}function B3(e,t){return M4(e+1,t)}function D3(e){return L4(e+2)}function E3(e,t){return M4(e+2,t)}function F3(){return K4()}function G3(e){return L4(e)}function H3(e,t){return M4(e,t)}function I3(){return OY[kY]}function J3(e){return OY[kY]=e}function L3(e,t){var r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S,y;if(!G0(e)&&t>=AZ(e))return $$(e,0);b=d_(e),m=f_(e),g=O1(e,nV),k=O1(e,oV),u=2*(g-b),l=b+yZ(e)-2*g,c=2*(k-m),h=m+(i=AZ(e))-2*k,(f=2*(r=i-m))<2&&(f=2),d=zU(16777216,f),n=u*(_=d),n+=(a=l*(p=((S=65535&_)*S>>>16)+S*(y=_>>>16&255)*2+(y*y<<16)>>>8)*2)>>1,o=c*d,o+=(s=h*p*2)>>1,$$(e,r),(v=EZ(e))[lV]=256*b,v[mV]=256*m,v[iV]=n,v[jV]=o,v[gV]=a,v[hV]=s,(m=f_(e))!==t&&(U3(e,t),$$(e,r-(t-m)))}function N3(e,t){var r,i,a,s,n,o,u,l,c,h,f;if(!G0(e)&&t>=R0(e))return $$(e,0);if(r=P0(e)-d_(e),i=R0(e)-f_(e),a=0<=r?(l=1,u=r,0):(l=-1,u=0-r,1-i),s=0==i?(c=r,a=0):u>16,s+=i+32768>>16,r+=e[gV],i+=e[hV];return e[lV]=a,e[mV]=s,e[iV]=r,e[jV]=i,a>>8}function U3(e,t){e_(e,T3(EZ(e),t))}function W3(e){var t,r;r=d_(e)+_0(e),0<(t=O1(e,TW)+O1(e,VW))&&(r+=Z0(e),t-=O1(e,UW)),Y0(e,t),e_(e,r)}function Y3(e,t){var r,i,a,s;r=_1(i=T4(e)),a=O1(e,pV)+1,s=O1(e,qV)+1,Q4(e,a),S4(e,s),r<=a&&W$(e),0<=s&&V$(e),s+r<0?T3(EZ(e),t):EZ(e)[lV]=256*CZ(e),T3(X4(e),t),I$(e,i)}function $3(e){var t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m;s=$4(e)+1,n=a5(e)+1,_4(e,s),b5(e,n),(r=_1(i=c5(e)))<=s&&W$(e),0<=n&&V$(e),t=d_(e),W3(e),a=d_(e),(s<=i||0<=n+r)&&(u=t,l=a,b=$4(o=e),m=a5(o),f=_1(c=c5(o)),d=g5(o),p=Z0(o),h=l-u,b>>1,BY=e,n){case 0:case 1:break;case 2:AY=g5(BY);break;case 3:h3()}switch(a=AY,n){case 0:case 1:break;case 2:i3();break;case 3:g3()}0!==(r=AY)&&K1(3)&&(t=1+(h_(e)<<1),s=d_(e)+a,-1===(i=Z_(r,t))?o3(r,t,s):D3(i)>>8&255,s=e>>>16&255,t=e>>>24&255,j0()&&(r=(t*(n=E$())[6]+n[7])/t,s=(s*n[0]+n[1])*r|0,a=(a*n[2]+n[3])*r|0,i=(i*n[4]+n[5])*r|0,t=t*r|0,s=Math.max(s,0),s=Math.min(s,255),a=Math.max(a,0),a=Math.min(a,255),i=Math.max(i,0),i=Math.min(i,255),t=Math.max(t,0),t=Math.min(t,255)),t<1?0:(t<255&&L1()&&_3(FW),i+(a<<8)+(s<<16)+(t<<24))):e}function z4(e){var t,r;m0()?(r=t=e,function(e,t,r){var i,a,s;i=b_(),a=(i[0]*e+i[1]*t+i[2])*WY()|0,s=(i[3]*e+i[4]*t+i[5])*WY()|0,r[0]=a,r[1]=s}(0|t[0],0|t[1],r)):(e[0]=(e[0]+Q$())*WY(),e[1]=(e[1]+S$())*WY())}function C4(e){0>8,t=c2()[0]-a2()[0],r=c2()[1]-a2()[1],(a=128+(0|Math.sqrt(t*t+r*r))>>8)>>8&255,t=e>>>24&255,a=(a=e>>>16&255)*(s=E$())[0]+s[1]|0,i=i*s[2]+s[3]|0,r=r*s[4]+s[5]|0,t=t*s[6]+s[7]|0,a=Math.max(a,0),a=Math.min(a,255),i=Math.max(i,0),i=Math.min(i,255),r=Math.max(r,0),r=Math.min(r,255),t=Math.max(t,0),(t=Math.min(t,255))<16?0:r+(i<<8)+(a<<16)+(t<<24)):e}function F4(){return OY[fY]}function H4(){O4(F4())}function J4(e){return!!K1(e)&&(O4(N4()-e),!0)}function K4(){return F4()-N4()}function L4(e){return OY[N4()+e]}function M4(e,t){return OY[N4()+e]=t}function N4(){return OY[pX]}function O4(e){return OY[pX]=e}function Q4(e,t){return P1(e,pV,t)}function S4(e,t){return P1(e,qV,t)}function T4(e){return O1(e,rV)}function X4(e){return DU(LY,e+uV)}function Z4(e,t){return P1(e,vV,t)}function $4(e){return O1(e,WW)}function _4(e,t){return P1(e,WW,t)}function a5(e){return O1(e,XW)}function b5(e,t){return P1(e,XW,t)}function c5(e){return O1(e,YW)}function g5(e){return O1(e,_W)}function h5(e,t){return P1(e,_W,t)}function i5(e){OY=e.wordsAsInt32Array()}function Rsa(e){return"number"==typeof e?wua.classSmallInteger():e.sqClass}function Ssa(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function Tsa(e){return e.bytes?e.bytes.length:e.words?4*e.words.length:0}function Usa(e,t){return 0|Math.floor(e/t)}function Wsa(e,t){return 31>>t}function Ysa(e,t){return t<0?t<-31?0:e>>>0-t:31>>5&31)+(r>>>10&31),r=wwa(e>>>16,t>>>16,5,3),Jta+(31&r)+(r>>>5&31)+(r>>>10&31)):(r=wwa(e,t,8,3),Jta+(255&r)+(r>>>8&255)+(r>>>16&255)),t}function iva(e,t){var r,i,a,s;if((Pta&(tta|rta))!=(tta|rta))return t;if(Zta<16){for(r=Bua[Zta]&Rta,s=t,a=1;a<=dua;a++)ixa(i=s&r,hxa(i)+1),s=Xsa(s,Zta);return t}return 16===Zta?(ixa(i=Uwa(65535&t,5,Ota),hxa(i)+1),ixa(i=Uwa(t>>>16,5,Ota),hxa(i)+1)):ixa(i=Uwa(t,8,Ota),hxa(i)+1),t}function jva(e,t){return e+t}function kva(e,t){var r,i,a,s;return 0==(s=e>>>24)?t:255==s?e:(i=(i=(16711935&e)*s+(16711935&t)*(r=255-s)+16711935)+(i-65537>>>8&16711935)>>>8&16711935)|(a=(a=(16711935&(e>>>8|16711680))*s+(t>>>8&16711935)*r+16711935)+(a-65537>>>8&16711935)>>>8&16711935)<<8}function lva(e,t){return mva(e,t,!1)}function mva(e,t,r){var i,a,s,n,o,u,l,c,h,f,d,p,b,m;if(Zta<16)return t;if(h=255-Kua,o=t,1===dua)r&&0===e||(o=(d=(d=(16711935&e)*Kua+(16711935&t)*h+16711935)+(d-65537>>>8&16711935)>>>8&16711935)|(p=(p=(e>>>8&16711935)*Kua+(t>>>8&16711935)*h+16711935)+(p-65537>>>8&16711935)>>>8&16711935)<<8);else for(i=Bua[Zta],m=cua,b=t,n=e,s=1;s<=dua;s++){if(l=n&i,!(0==(m&i)||r&&0==l)){for(f=b&i,a=0,c=1;c<=3;c++)a|=Wsa(31&Usa((31&Xsa(l,u=5*(c-1)))*Kua+(31&Xsa(f,u))*h+254,255),u);o=o&~Wsa(i,16*(s-1))|Wsa(a,16*(s-1))}m=Xsa(m,Zta),n=Xsa(n,Zta),b=Xsa(b,Zta)}return o}function nva(e,t){var r,i,a;return(a=(16711935&(a=((t>>>8&16711935)*(r=255-(e>>>24))>>>8&16711935)+(e>>>8&16711935)))<<8|255*(16777472&a))|(i=16711935&(i=((16711935&t)*r>>>8&16711935)+(16711935&e))|255*(16777472&i)>>>8)}function ova(e,t){return 0===e?t:mva(e,t,!0)}function sva(e,t){return e&t}function tva(e,t){return e&~t}function uva(e,t){return~e&t}function vva(e,t){return~e&~t}function wva(e,t){return~t}function xva(e,t){return~e|t}function yva(e,t){return~e|~t}function zva(e,t){return~e}function Ava(e,t){return~e^t}function Bva(e,t){return e|t}function Cva(e,t){return e|~t}function Dva(e,t){return e^t}function Fva(e,t){return 0}function Gva(){Mta<=gua?(Yua=Vua,nua=gua,Hta=gva):(Yua=Vua+(Mta-gua),Hta=gva-(Mta-gua),nua=Mta),Mta+Lta>>2],0==(16777215&e)){for(t+=4,i+=4;0!=--r&&0==(16777215&(e=Lua[t>>>2]));)t+=4,i+=4;++r}else n=Xta[i>>>2],n=Owa(e,n),Xta[i>>>2]=n,t+=4,i+=4;++s,++o}}(),Eta=(Dta=nua)+Hta,Cta=(Fta=oua)+Gta,!0):16===Zta?(function(){var e,t,r,i,a,s,n,o,u,l,c,h,f;u=Gta+1,l=Zua,h=oua,r=16*(1&nua),bua&&(r=16-r);zua=Wsa(65535,16-r);for(;0!=--u;){for(a=l*Tua+4*Yua,n=h*eua+4*(nua>>1),e=4*(3&h),f=(3&Yua)-1,s=Hta+1,r=65535===(o=zua)?16:0;0!=--s;)t=jua[e+(f=f+1&3)],i=Lua[a>>>2],0!=(16777215&i)&&(c=Xta[n>>>2],c=Xsa(c&=~o,r),i=Wsa(0===(i=Sva(i=Owa(i,c=(31744&c)<<9|(992&c)<<6|(31&c)<<3|4278190080),t))?1:i,r),Uva(n,i,o)),a+=4,bua?0===r&&(n+=4):0!==r&&(n+=4),r^=16,o=~o;++l,++h}}(),Eta=(Dta=nua)+Hta,Cta=(Fta=oua)+Gta,!0):8===Zta&&(function(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d;a=Ova(),o=Pta&~sta,c=Gta+1,h=Zua,zua=8*(3&nua),bua&&(zua=24-zua);Aua=Zsa^Wsa(255,zua),n=0==(1&nua)?0:522133279;0==(1&(d=oua))&&(n^=522133279);for(;0!=--c;){for(n^=522133279,r=h*Tua+4*Yua,s=d*eua+4*(nua>>2),i=Hta+1,e=zua,l=Aua;0!=--i;)t=(Lua[r>>>2]&~n)+n,31<(u=Usa(((u=16777215&t)>>>16)+(u>>>8&255)+(255&u),3))&&(224>>2],f=Xsa(f&=~l,e),f=a[f],t=Wsa(t=owa(t=Owa(t,f),o),e),Uva(s,t,l)),r+=4,l=bua?0===e?(s+=4,e=24,16777215):(e-=8,l>>>8|4278190080):32===e?(s+=4,e=0,4294967040):(e+=8,l<<8|255),n^=522133279;++h,++d}}(),Eta=(Dta=nua)+Hta,Cta=(Fta=oua)+Gta,!0);if(Zta<8)return!1;if(8===Zta&&0==(Pta&tta))return!1;32===Zta&&function(){var e,t,r,i,a,s,n,o,u;for(s=Gta+1,n=Zua,u=oua;0!=--s;){for(t=n*Tua+4*Yua,i=u*eua+4*nua,r=Hta+1;0!=--r;)if(255==(a=(e=Lua[t>>>2])>>>24)){for(Xta[i>>>2]=e,t+=4,i+=4;0!=--r&&(e=Lua[t>>>2])>>>24==255;)Xta[i>>>2]=e,t+=4,i+=4;++r}else if(0==a){for(t+=4,i+=4;0!=--r&&(e=Lua[t>>>2])>>>24==0;)t+=4,i+=4;++r}else o=nva(e,o=Xta[i>>>2]),Xta[i>>>2]=o,t+=4,i+=4;++n,++u}}();16===Zta&&function(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d;for(l=Gta+1,c=Zua,f=oua,r=16*(1&nua),bua&&(r=16-r),zua=Wsa(65535,16-r);0!=--l;){for(a=c*Tua+4*Yua,n=f*eua+4*(nua>>1),e=4*(3&f),d=(3&Yua)-1,s=Hta+1,r=65535===(u=zua)?16:0;0!=--s;)t=jua[e+(d=d+1&3)],255==(o=(i=Lua[a>>>2])>>>24)?Uva(n,i=Wsa(0===(i=Sva(i,t))?1:i,r),u):0!=o&&(h=Xta[n>>>2],Uva(n,i=Wsa(0===(i=Sva(i=nva(i,h=(31744&(h=Xsa(h&=~u,r)))<<9|(992&h)<<6|(31&h)<<3|4278190080),t))?1:i,r),u)),a+=4,bua?0===r&&(n+=4):0!==r&&(n+=4),r^=16,u=~u;++c,++f}}();8===Zta&&function(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d;for(a=Ova(),o=Pta&~sta,c=Gta+1,h=Zua,zua=8*(3&nua),bua&&(zua=24-zua),Aua=Zsa^Wsa(255,zua),n=0==(1&nua)?0:522133279,0==(1&(d=oua))&&(n^=522133279);0!=--c;){for(n^=522133279,r=h*Tua+4*Yua,s=d*eua+4*(nua>>2),i=Hta+1,e=zua,l=Aua;0!=--i;)31<(u=(t=(Lua[r>>>2]&~n)+n)>>>24)&&(u<224&&(f=Xta[s>>>2],t=nva(t,f=a[f=Xsa(f&=~l,e)])),Uva(s,t=Wsa(t=owa(t,o),e),l)),r+=4,l=bua?0===e?(s+=4,e=24,16777215):(e-=8,l>>>8|4278190080):24===e?(s+=4,e=0,4294967040):(e+=8,l<<8|255),n^=522133279;++h,++d}}();return Eta=(Dta=nua)+Hta,Cta=(Fta=oua)+Gta,!0}())return;if(30===Uta||31===Uta){if(1!==wua.methodArgumentCount())return wua.primitiveFail();if(Kua=wua.stackIntegerValue(0),!(!wua.failed()&&0<=Kua&&Kua<=255))return wua.primitiveFail()}Jta=0,Qva(),Fua?function(){var e,t,r,i,a,s;for(r=Gua[Uta+1],s=1;s<=Gta;s++){if(t=Eua?Zsa:$va(oua+s-1),cua=zua,i=Xta[aua>>>2],e=r(t,i),i=cua&e|i&~cua,Xta[aua>>>2]=i,aua+=4,cua=Zsa,3===Uta)for(i=t,a=2;a<=Dua-1;a++)Xta[aua>>>2]=i,aua+=4;else for(a=2;a<=Dua-1;a++)i=Xta[aua>>>2],e=r(t,i),Xta[aua>>>2]=e,aua+=4;1>>2],e=r(t,i),i=cua&e|i&~cua,Xta[aua>>>2]=i,aua+=4),aua+=Yta}}():(function(){var e;Oua===$ta&&Zua<=oua&&(Zua>>2],Qua+=n):l=0,cua=zua,f=Lua[Qua>>>2],Qua+=n,t=Ysa(l&d,a)|Ysa(f&r,Jua),l=f,o=Xta[aua>>>2],e=s(t&i,o),o=cua&e|o&~cua,Xta[aua>>>2]=o,aua+=n,cua=Zsa,3===Uta)if(0===Jua&&i===Zsa)if(-1===qua)for(u=2;u<=Dua-1;u++)f=Lua[Qua>>>2],Qua+=n,Xta[aua>>>2]=f,aua+=n;else for(u=2;u<=Dua-1;u++)Xta[aua>>>2]=l,aua+=n,l=Lua[Qua>>>2],Qua+=n;else for(u=2;u<=Dua-1;u++)f=Lua[Qua>>>2],Qua+=n,t=Ysa(l&d,a)|Ysa(f&r,Jua),l=f,Xta[aua>>>2]=t&i,aua+=n;else for(u=2;u<=Dua-1;u++)f=Lua[Qua>>>2],Qua+=n,t=Ysa(l&d,a)|Ysa(f&r,Jua),l=f,e=s(t&i,Xta[aua>>>2]),Xta[aua>>>2]=e,aua+=n;1>>2],Qua+=n,t=Ysa(l&d,a)|Ysa(f&r,Jua),o=Xta[aua>>>2],e=s(t&i,o),o=cua&e|o&~cua,Xta[aua>>>2]=o,aua+=n),Qua+=Mua,aua+=Yta}}())),22!==Uta&&32!==Uta||(Dta=Eta=Fta=Cta=0);Eta=0>>2]),Xta[aua>>>2]=cua&d):(d=l(s&f,(o=Xta[aua>>>2])&cua),o=cua&d|o&~cua,Xta[aua>>>2]=o),aua+=4,g=2===n?(cua=Aua,v):(cua=Zsa,dua),0!=--n;);Qua+=Mua,aua+=Yta}}function Ova(){return[0,4278190081,4294967295,4286611584,4294901760,4278255360,4278190335,4278255615,4294967040,4294902015,4280295456,4282400832,4284506208,4288651167,4290756543,4292861919,4278716424,4279242768,4279769112,4280821800,4281348144,4281874488,4282927176,4283453520,4283979864,4285032552,4285558896,4286085240,4287072135,4287598479,4288124823,4289177511,4289703855,4290230199,4291282887,4291809231,4292335575,4293388263,4293914607,4294440951,4278190081,4278203136,4278216192,4278229248,4278242304,4278255360,4278190131,4278203187,4278216243,4278229299,4278242355,4278255411,4278190182,4278203238,4278216294,4278229350,4278242406,4278255462,4278190233,4278203289,4278216345,4278229401,4278242457,4278255513,4278190284,4278203340,4278216396,4278229452,4278242508,4278255564,4278190335,4278203391,4278216447,4278229503,4278242559,4278255615,4281532416,4281545472,4281558528,4281571584,4281584640,4281597696,4281532467,4281545523,4281558579,4281571635,4281584691,4281597747,4281532518,4281545574,4281558630,4281571686,4281584742,4281597798,4281532569,4281545625,4281558681,4281571737,4281584793,4281597849,4281532620,4281545676,4281558732,4281571788,4281584844,4281597900,4281532671,4281545727,4281558783,4281571839,4281584895,4281597951,4284874752,4284887808,4284900864,4284913920,4284926976,4284940032,4284874803,4284887859,4284900915,4284913971,4284927027,4284940083,4284874854,4284887910,4284900966,4284914022,4284927078,4284940134,4284874905,4284887961,4284901017,4284914073,4284927129,4284940185,4284874956,4284888012,4284901068,4284914124,4284927180,4284940236,4284875007,4284888063,4284901119,4284914175,4284927231,4284940287,4288217088,4288230144,4288243200,4288256256,4288269312,4288282368,4288217139,4288230195,4288243251,4288256307,4288269363,4288282419,4288217190,4288230246,4288243302,4288256358,4288269414,4288282470,4288217241,4288230297,4288243353,4288256409,4288269465,4288282521,4288217292,4288230348,4288243404,4288256460,4288269516,4288282572,4288217343,4288230399,4288243455,4288256511,4288269567,4288282623,4291559424,4291572480,4291585536,4291598592,4291611648,4291624704,4291559475,4291572531,4291585587,4291598643,4291611699,4291624755,4291559526,4291572582,4291585638,4291598694,4291611750,4291624806,4291559577,4291572633,4291585689,4291598745,4291611801,4291624857,4291559628,4291572684,4291585740,4291598796,4291611852,4291624908,4291559679,4291572735,4291585791,4291598847,4291611903,4291624959,4294901760,4294914816,4294927872,4294940928,4294953984,4294967040,4294901811,4294914867,4294927923,4294940979,4294954035,4294967091,4294901862,4294914918,4294927974,4294941030,4294954086,4294967142,4294901913,4294914969,4294928025,4294941081,4294954137,4294967193,4294901964,4294915020,4294928076,4294941132,4294954188,4294967244,4294902015,4294915071,4294928127,4294941183,4294954239,4294967295]}function Pva(e,t,r){return e>>16&255)]<<10)+(iua[r+(e>>>8&255)]<<5)+iua[r+(255&e)]}function Uva(e,t,r){var i;i=Xta[e>>>2],i&=r,i|=t,Xta[e>>>2]=i}function Wva(e,t){var r,i;return"number"==typeof(i=wua.fetchPointerofObject(e,t))?i:-2147483648<=(r=wua.floatValueOf(i))&&r<=2147483647?0|r:(wua.primitiveFail(),0)}function Xva(e,t,r){var i,a;return"number"==typeof(a=wua.fetchPointerofObject(e,t))?a:a.isNil?r:-2147483648<=(i=wua.floatValueOf(a))&&i<=2147483647?0|i:(wua.primitiveFail(),0)}function Yva(e,t){return 32!==Zta?t:0===t?0:0!=(4278190080&t)?t:t|4278190080&e}function Zva(){return Cua}function $va(e){return rua[(t=e)-Usa(t,r=tua)*r|0];var t,r}function _va(e){return!!e.isNil||(0===Uta||(5===Uta||(10===Uta||15===Uta)))}function cwa(){return Gua[1]=Fva,Gua[2]=sva,Gua[3]=tva,Gua[4]=exa,Gua[5]=uva,Gua[6]=Rva,Gua[7]=Dva,Gua[8]=Bva,Gua[9]=vva,Gua[10]=Ava,Gua[11]=wva,Gua[12]=Cva,Gua[13]=zva,Gua[14]=xva,Gua[15]=yva,Gua[16]=Rva,Gua[17]=Rva,Gua[18]=Rva,Gua[19]=jva,Gua[20]=fxa,Gua[21]=Lwa,Gua[22]=$wa,Gua[23]=hva,Gua[24]=iva,Gua[25]=kva,Gua[26]=Cwa,Gua[27]=Bwa,Gua[28]=Wwa,Gua[29]=Xwa,Gua[30]=Ywa,Gua[31]=lva,Gua[32]=ova,Gua[33]=Rwa,Gua[34]=gxa,Gua[35]=nva,Gua[36]=nva,Gua[37]=nva,Gua[38]=Zwa,Gua[39]=Dwa,Gua[40]=Awa,Gua[41]=Yva,Gua[42]=Qwa,function(){var e,t,r,i,a,s,n,o,u;for(t=0;t<=255;t++)for(e=0;e<=15;e++)a=e,u=o=n=s=void 0,n=kua[7&(s=255&(i=t))],o=lua[s>>>3],u=a>>8&255)],o=lua[s>>>3],u|=a>>16&255)],o=lua[s>>>3],r=u|=a>loadBitBltDestForm: destBitsSize != destPitch * destHeight, expected "+eua+"*"+_ta+"="+eua*_ta+", got "+e)}Xta=Xta.wordsOrBytes()}return!0}function fwa(e){return gwa(e,!1)}function gwa(e,t){if(Ita=e,xua=t,Uta=wua.fetchIntegerofObject(jta,Ita),wua.failed()||Uta<0||Ata-2>loadBitBltSourceForm: sourceBitsSize != sourcePitch * sourceHeight, expected "+Tua+"*"+Pua+"="+Tua*Pua+", got "+e)}Lua=Lua.wordsOrBytes()}return!0}())return!1;if(!function(){var e,t,r,i;if(Pta=Rta=Ota=0,Qta=Sta=Tta=null,(t=wua.fetchPointerofObject(dta,Ita)).isNil)return!0;if(Pta=tta,i=!1,wua.isWords(t))r=Ssa(t),Qta=t.words,i=!0;else{if(!(wua.isPointers(t)&&3<=Ssa(t)))return!1;if(Tta=jwa(wua.fetchPointerofObject(0,t)),Sta=jwa(wua.fetchPointerofObject(1,t)),(e=wua.fetchPointerofObject(2,t)).isNil)r=0;else{if(!wua.isWords(e))return!1;r=Ssa(e),Qta=e.words}Pta|=sta}if(0!=(r&r-1))return!1;Rta=r-1,Ota=0,512===r&&(Ota=3);4096===r&&(Ota=4);32768===r&&(Ota=5);0===r?(Qta=null,Rta=0):Pta|=rta;i&&axa();!function(e,t){return!e||!t||0===e[Bta]&&0===e[zta]&&0===e[pta]&&0===e[$sa]&&16711680===t[Bta]&&65280===t[zta]&&255===t[pta]&&4278190080===t[$sa]}(Tta,Sta)?Pta|=qta:Tta=Sta=null;return!0}())return!1;0==(Pta&sta)&&axa(),Vua=Xva(lta,Ita,0),Wua=Xva(mta,Ita,0)}return!!function(){var e;if(Eua)return!(rua=null);if(wua.isPointers(sua)&&4<=Ssa(sua))e=wua.fetchPointerofObject(vta,sua),tua=wua.fetchIntegerofObject(xta,sua),wua.isWords(e)||(Eua=!0);else{if(wua.isPointers(sua)||!wua.isWords(sua))return!1;tua=Ssa(e=sua)}return rua=e.wordsOrBytes(),!0}()&&(Mta=Xva(bta,Ita,0),Nta=Xva(cta,Ita,0),Lta=Xva(ata,Ita,fua),Kta=Xva(_sa,Ita,_ta),!wua.failed()&&(Mta<0&&(Lta+=Mta,Mta=0),Nta<0&&(Kta+=Nta,Nta=0),fua>>2],h=0,o=Xua,l=mua,c=e,t===(tta|rta))for(;n=Xsa(u,o)&r,h|=Wsa(Qta[n&Rta]&i,l),l+=s,0!=(4294967264&(o+=a))&&(Rua?o+=32:o-=32,u=Lua[(Qua+=4)>>>2]),0!=--c;);else for(;h|=Wsa(owa(n=Xsa(u,o)&r,t)&i,l),l+=s,0!=(4294967264&(o+=a))&&(Rua?o+=32:o-=32,u=Lua[(Qua+=4)>>>2]),0!=--c;);return Xua=o,h}function zwa(e,t){var r,i,a;return e<0||t<0||(i=e>>>14)>=Uua||(a=t>>>14)>=Pua?0:(r=a*Tua+4*Xsa(i,cva),Xsa(Lua[r>>>2],Xua=dva[i&bva])&eva)}function Awa(e,t){var r,i,a,s,n;if(32===Zta)return e===t?0:t;for(n=Bua[i=Zta],a=0,s=1;s<=dua;s++)(e&n)===(r=t&n)&&(r=0),a|=r,n=Wsa(n,i);return a}function Bwa(e,t){return qwa(~e,t,Zta,dua)}function Cwa(e,t){return 0===e?t:e|qwa(~e,t,Zta,dua)}function Dwa(e,t){var r,i,a,s,n;if(1===dua)return t;if(r=0,a=Wsa(1,Zta)-1,s=Wsa(a,(dua-1)*Zta),r|=Wsa(t&a,i=32-Zta)|Xsa(t&s,i),dua<=2)return r;for(n=2;n<=dua>>1;n++)a=Wsa(a,Zta),s=Xsa(s,Zta),r|=Wsa(t&a,i-=2*Zta)|Xsa(t&s,i);return r}function Ewa(){return fwa(wua.stackValue(wua.methodArgumentCount()))?(Hva(),wua.failed()?null:(cxa(),wua.failed()?null:(wua.pop(wua.methodArgumentCount()),22===Uta||32===Uta?(wua.pop(1),wua.pushInteger(Jta)):void 0))):wua.primitiveFail()}function Fwa(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d;if(6!==wua.methodArgumentCount())return wua.primitiveFail();if(c=wua.stackIntegerValue(0),a=wua.stackObjectValue(1),u=wua.stackObjectValue(2),Rsa(a)!==wua.classArray()||Rsa(u)!==wua.classArray())return wua.primitiveFail();if(256!==Ssa(u))return wua.primitiveFail();if(wua.failed())return null;if(s=Ssa(a)-2,r=wua.stackIntegerValue(3),h=wua.stackIntegerValue(4),d=wua.stackObjectValue(5),!wua.isBytes(d))return wua.primitiveFail();if(!(0>1,l=1;l<=u;l++)if(gua+=a,(r-=s)<0&&(hua+=h,r+=u),l>1,l=1;l<=s;l++)if(hua+=h,(r-=u)<0&&(gua+=a,r+=s),l=nta+12))return wua.primitiveFail();(a=vua-1)<=0&&(a=1);_=Wva(nta,Ita),r=Wva(nta+3,Ita),(O=Pva(_,r,a))<0&&(_=r-a*O);b=Wva(nta+1,Ita),r=Wva(nta+4,Ita),(S=Pva(b,r,a))<0&&(b=r-a*S);v=Wva(nta+9,Ita),r=Wva(nta+6,Ita),(l=Pva(v,r,a))<0&&(v=r-a*l);c=Wva(nta+10,Ita),r=Wva(nta+7,Ita),(s=Pva(c,r,a))<0&&(c=r-a*s);if(wua.failed())return;if(2===wua.methodArgumentCount())if(w=wua.stackIntegerValue(1),(g=wua.stackValue(0)).isNil){if(Nua<16)return wua.primitiveFail()}else{if(Ssa(g)>>=1;for(eva=Bua[Nua],bva=Wsa(1,cva=5-fva)-1,e=0;e<=bva;e++)dva[e]=Rua?32-Wsa(e+1,fva):Wsa(e,fva)})(),1>>2]),Xta[aua>>>2]=cua&p):(n=Xta[aua>>>2],p=u(i&d,n&cua),n=cua&p|n&~cua,Xta[aua>>>2]=n),aua+=4,I=2===r?(cua=Aua,y):(cua=Zsa,dua),0!=--r;);_+=O,b+=S,v+=l,c+=s,aua+=Yta}}(),Eta=0>>=8),u=255&(p>>>=8),o=255&(p>>>=8),255!=(c=255&Vta)&&(o=o*c>>>8,u=u*c>>>8,a=a*c>>>8,d=d*c>>>8),s=255&(l=t),b=255&(i=Wta),$ua&&(s=$ua[s],b=$ua[b]),255<(f=(s*(255-d)>>>8)+(b*d>>>8))&&(f=255),pua&&(f=pua[f]),s=255&(l>>>=8),b=255&(i>>>=8),$ua&&(s=$ua[s],b=$ua[b]),255<(r=(s*(255-a)>>>8)+(b*a>>>8))&&(r=255),pua&&(r=pua[r]),s=255&(l>>>=8),b=255&(i>>>=8),$ua&&(s=$ua[s],b=$ua[b]),255<(h=(s*(255-u)>>>8)+(b*u>>>8))&&(h=255),pua&&(h=pua[h]),i>>>=8,255<(n=((255&(l>>>=8))*(255-o)>>>8)+o)&&(n=255),(((n<<8)+h<<8)+r<<8)+f)}function Qwa(e,t){return 0===e?t:function(e,t,r,i){var a,s,n,o,u,l;for(l=Bua[r],s=0,o=1;o<=i;o++)n=Xsa(e&l,(o-1)*r),a=Xsa(t&l,(o-1)*r),32!==r&&(a=16===r?(n=4278190080|Swa(n),4278190080|Swa(a)):(n=4278190080|Uwa(n,r,32),4278190080|Uwa(a,r,32))),u=Owa(n,a),32!==r&&(u=Uwa(u,32,r)),s|=Wsa(u,(o-1)*r),l=Wsa(l,r);return s}(e,t,Zta,dua)}function Rwa(e,t){var r,i,a,s,n,o,u,l,c,h;for(n=Bua[Zta],o=16===Zta?(i=5,31):(i=8,255),c=cua,u=t,s=e,l=1;l<=dua;l++)0<(c&n)&&(h=u&n,r=s&n,a=Zta<16?r==h?0:1:((a=wwa(r,h,i,3))&o)+(Xsa(a,i)&o)+(Xsa(Xsa(a,i),i)&o),Jta+=a),c=Xsa(c,Zta),s=Xsa(s,Zta),u=Xsa(u,Zta);return t}function Swa(e){return(31&e)<<3|(992&e)<<6|(31744&e)<<9}function Uwa(e,t,r){var i,a,s,n;return 0<(i=r-t)?(n=Wsa(1,t)-1,a=(s=Wsa(e,i))&(n=Wsa(n,i)),n=Wsa(n,r),a+((s=Wsa(s,i))&n)+(Wsa(s,i)&Wsa(n,r))):0===i?5===t?32767&e:8===t?16777215&e:e:0===e?e:(n=Wsa(1,r)-1,a=(s=Xsa(e,i=t-r))&n,n=Wsa(n,r),0===(a=a+((s=Xsa(s,i))&n)+(Xsa(s,i)&Wsa(n,r)))?1:a)}function Wwa(e,t){return Zta<16?swa(e,t,Zta,dua):16===Zta?swa(e,t,5,3)+(swa(e>>>16,t>>>16,5,3)<<16):swa(e,t,8,4)}function Xwa(e,t){return Zta<16?twa(e,t,Zta,dua):16===Zta?twa(e,t,5,3)+(twa(e>>>16,t>>>16,5,3)<<16):twa(e,t,8,4)}function Ywa(e,t){var r;return r=~e,Zta<16?twa(r,t,Zta,dua):16===Zta?twa(r,t,5,3)+(twa(r>>>16,t>>>16,5,3)<<16):twa(r,t,8,4)}function Zwa(e,t){return Zta<16?uwa(e,t,Zta,dua):16===Zta?uwa(e,t,5,3)+(uwa(e>>>16,t>>>16,5,3)<<16):uwa(e,t,8,4)}function $wa(e,t){return Zta<16?wwa(e,t,Zta,dua):16===Zta?wwa(e,t,5,3)+(wwa(e>>>16,t>>>16,5,3)<<16):wwa(e,t,8,4)}function _wa(e){return!1!=((wua=e).majorVersion()==Psa)&&wua.minorVersion()>=Qsa}function axa(){var e,t;if(e=t=0,!(Nua<=8)){if(16===Nua&&(e=5),32===Nua&&(e=8),0===Ota){if(Zta<=8)return;16===Zta&&(t=5),32===Zta&&(t=8)}else t=Ota;bxa(e,t)}}function bxa(e,t){var r,i,a=[0,0,0,0],s=[0,0,0,0];0!=(r=t-e)&&(r<=0?(i=Wsa(1,t)-1,s[Bta]=Wsa(i,2*e-r),s[zta]=Wsa(i,e-r),s[pta]=Wsa(i,0-r),s[$sa]=0):(i=Wsa(1,e)-1,s[Bta]=Wsa(i,2*e),s[zta]=Wsa(i,e),s[pta]=i),a[Bta]=3*r,a[zta]=2*r,a[pta]=r,a[$sa]=0,Tta=a,Sta=s,Pta=Pta|tta|qta)}function cxa(){wua.showDisplayBitsLeftTopRightBottom($ta,Dta,Fta,Eta,Cta)}function exa(e,t){return e}function fxa(e,t){return e-t}function gxa(e,t){var r,i,a,s,n,o;if((Pta&(tta|rta))!=(tta|rta))return t;for(r=Bua[Zta],a=t,n=cua,s=1;s<=dua;s++)0!=(n&r)&&(o=a&r,ixa(i=Zta<16?o:Uwa(o,16===Zta?5:8,Ota),hxa(i)+1)),n=Xsa(n,Zta),a=Xsa(a,Zta);return t}function hxa(e){return Qta[e&Rta]}function ixa(e,t){return Qta[e&Rta]=t}function kxa(){var e,t,r,i;if(uua){if(!_ua&&!lwa())return;r=_ua,i=!1,"number"==typeof(e=wua.fetchPointerofObject(vta,$ta))&&(r(e=e,Dta,Fta,Eta-Dta,Cta-Fta),Xta=eua=0,i=!0),Fua||"number"==typeof(t=wua.fetchPointerofObject(vta,Oua))&&(t=t,i&&t===e||r(t,0,0,0,0),Lua=Tua=0),uua=!1}}function oxa(e,t,r,i,a,s,n,o){var u,l,c,h,f,d,p,b,m,v,g,k,_,S,y,I,O,w,F;b=Bua[Zta],l=0,m=2===n?(c=t>>1,f=r>>1,p=i>>1,a>>1):(c=Usa(t,n),f=Usa(r,n),p=Usa(i,n),Usa(a,n)),d=e;do{y=Yua,g=Zua,I=O=S=k=0,w=0,h=n;do{for(F=y,_=g,u=n;v=zwa(F,_),25===Uta&&0===v||(++w,k+=255&(v=Nua<16?s[v]:16===Nua?Swa(v):v),S+=v>>>8&255,O+=v>>>16&255,I+=v>>>24),F+=c,_+=f,0!=--u;);y+=p,g+=m}while(0!=--h);l|=Wsa((v=0===w||25===Uta&&w>1?0:(4===w?(O>>>=2,S>>>=2,k>>>=2,I>>>=2):(O=Usa(O,w),S=Usa(S,w),k=Usa(k,w),I=Usa(I,w)),0===(v=(I<<24)+(O<<16)+(S<<8)+k)&&0>2)===DIa&&sIa===BIa&&sIa===uIa&&BIa===uIa),!1===vIa.failed())}function IIa(){var e,t,r,i,a;for(i=0,r=zIa;i>1,i=sIa>>2,f=1;f<=xIa;f++)for(c=rIa(1,f),h=c>>1,m=sIa,v=c,t=0|Math.floor(m/v),l=1;l<=h;l++)for(o=(b=(l-1)*t)=oIa}function FJa(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function IJa(){return HJa}function JJa(){var e,t,r,i,a,s;if(e=GJa.stackObjectValue(0),a=GJa.stackObjectValue(1),GJa.failed())return null;if(GJa.success(GJa.isWords(e)),GJa.success(GJa.isWords(a)),GJa.failed())return null;if(i=FJa(e),GJa.success(i===FJa(a)),GJa.failed())return null;for(s=a.wordsAsFloat32Array(),t=e.wordsAsFloat32Array(),r=0;r<=i-1;r++)s[r]=s[r]+t[r];GJa.pop(1)}function KJa(){var e,t,r,i,a;if(a=GJa.stackFloatValue(0),r=GJa.stackObjectValue(1),GJa.failed())return null;if(GJa.success(GJa.isWords(r)),GJa.failed())return null;for(t=FJa(r),i=r.wordsAsFloat32Array(),e=0;e<=t-1;e++)i[e]=i[e]+a;GJa.pop(1)}function LJa(){var e,t,r;return t=GJa.stackIntegerValue(0),r=GJa.stackObjectValue(1),GJa.failed()?null:(GJa.success(GJa.isWords(r)),GJa.success(0=EJa}function MLa(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function NLa(e,t){return new Int32Array(e.buffer,e.byteOffset+4*t)}function QLa(e,t){var r,i,a,s;return r=e[0],a=e[1],(i=t[0]-r)*i+(s=t[1]-a)*s}function SLa(){return PLa}function VLa(e){console.log(PLa+": "+e)}function WLa(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S,y,I,O,w,F,C,x,A,P,$,V,Y,M,j,N,q,B,W,E,L,T,R,Q,D,U,z,X,G;if(M=OLa.stackValue(11),j=OLa.stackValue(10),N=OLa.stackValue(9),q=OLa.stackValue(8),B=OLa.stackValue(7),W=OLa.stackValue(6),E=OLa.stackValue(5),L=OLa.stackValue(4),T=OLa.stackIntegerValue(3),R=OLa.stackValue(2),Q=OLa.stackValue(1),D=OLa.stackValue(0),OLa.failed())return null;if(OLa.failed())return VLa("failed 1"),null;if(OLa.success(OLa.isWords(M)&&OLa.isWords(j)&&OLa.isWords(N)&&OLa.isWords(q)&&OLa.isWords(B)&&OLa.isWords(W)&&OLa.isWords(E)&&OLa.isWords(L)&&OLa.isWords(R)&&OLa.isWords(Q)&&OLa.isWords(D)),OLa.failed())return VLa("failed 2"),null;if(OLa.success(OLa.isMemberOf(M,"PointArray")&&OLa.isMemberOf(j,"PointArray")),OLa.failed())return VLa("failed 3"),null;if(f=M.wordsAsInt32Array(),v=j.wordsAsInt32Array(),k=N.wordsAsInt32Array(),u=q.wordsAsInt32Array(),p=B.wordsAsInt32Array(),c=W.wordsAsInt32Array(),P=E.wordsAsInt32Array(),e=L.wordsAsInt32Array(),S=R.wordsAsInt32Array(),V=Q.wordsAsInt32Array(),_=D.wordsAsInt32Array(),g=MLa(j)>>>1,F=MLa(N)>>>1,l=MLa(q)>>>1,t=MLa(W),h=MLa(R),OLa.success(h===MLa(Q)&&h===MLa(D)&&l=F-1&&MLa(M)>>>1>=F&&l-1<=t&&l<=g&&MLa(E)>=F-1&&MLa(L)>=l-1),OLa.failed())return VLa("failed 5"),null;if(C=T>>>1,b=(r=1&T)?0:C*C>>>10,_[V[S[0]=0]=0]=2,O=0-b,!((d=l)-1<=g&&d-1<=t))return OLa.primitiveFail(),null;for(I=1;I<=d;I++)O=O+(c[i=I-1]+QLa(NLa(v,i<<1),f)>>>7)+b,V[I]=O,S[I]=O*I,_[I]=I+1;for(O=V[0]-b,w=1;w<=F;w++){for(y=(a=w-1)<<1,A=S[0],O=O+(p[a]+QLa(NLa(f,y),v)>>>7)+b,V[0]=O,S[0]=O*w,_[0]=w+1,d=l,I=1;I<=d;I++)s=(i=I-1)<<1,x=S[I],Y=S[i],m=p[a]+QLa(NLa(f,y),NLa(v,I<<1))>>>7,0===(O=V[I])?x+=m:(x=x+O+m*_[I],m+=O),o=c[i]+QLa(NLa(v,s),NLa(f,w<<1))>>>7,0===(O=V[i])?Y+=o:(Y=Y+O+o*_[i],o+=O),r?A=1<<29:A+=(QLa(NLa(u,s),NLa(k,y))+QLa(NLa(v,s),NLa(f,y)))*(16+(z=e[i],X=P[a],G=void 0,180<(G=Math.abs(X-z))&&(G=360-G),G*G>>>6))>>>11,$=A<=x&&A<=Y?(n=A,O=0,1):x<=Y?(n=x,O=m+b,_[I]+1):(n=Y,O=o+b,_[i]+1),A=S[I],S[I]=Math.min(n,1<<29),V[I]=Math.min(O,1<<29),_[I]=$;O=V[0]}return U=n,OLa.failed()||OLa.popthenPush(13,U),null}function XLa(){return OLa.failed()||OLa.popthenPush(1,2e3),null}function YLa(e){return!1!=((OLa=e).majorVersion()==KLa)&&OLa.minorVersion()>=LLa}function oNa(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function qNa(e,t){return 0|Math.floor(e/t)}function rNa(e,t){return 31>>r)}function EOa(){return rOa}function GOa(e,t){var r,i,a,s,n;if(i=e[0]>>>24,TNa>>24&255))return-1}return-1}function IOa(){var e,t,r,i,a,s,n,o;return r=t=cOa[vNa],i=cOa[wNa],n=cOa[QNa],o=cOa[$Na],0!==n&&0!==o&&(r=qNa(r,n),i=qNa(i,o)),e=(i>>>3)*cOa[tNa]+(r>>>3),s=((7&i)<<3)+(7&r),a=bOa[e][s],++t<8*cOa[SNa]?cOa[vNa]=t:(cOa[vNa]=0,cOa[wNa]++),a}function JOa(){var e,t,r,i,a,s,n,o;return r=t=eOa[vNa],i=eOa[wNa],n=eOa[QNa],o=eOa[$Na],0!==n&&0!==o&&(r=qNa(r,n),i=qNa(i,o)),e=(i>>>3)*eOa[tNa]+(r>>>3),s=((7&i)<<3)+(7&r),a=dOa[e][s],++t<8*eOa[SNa]?eOa[vNa]=t:(eOa[vNa]=0,eOa[wNa]++),a}function KOa(){var e,t,r,i,a,s,n,o;return r=t=uOa[vNa],i=uOa[wNa],n=uOa[QNa],o=uOa[$Na],0!==n&&0!==o&&(r=qNa(r,n),i=qNa(i,o)),e=(i>>>3)*uOa[tNa]+(r>>>3),s=((7&i)<<3)+(7&r),a=tOa[e][s],++t<8*uOa[SNa]?uOa[vNa]=t:(uOa[vNa]=0,uOa[wNa]++),a}function LOa(){var e;return 4!==iOa.methodArgumentCount()?iOa.primitiveFail():(hOa=iOa.stackIntegerValue(0),e=iOa.stackObjectValue(1),iOa.failed()?null:iOa.isWords(e)&&3===oNa(e)?(sOa=e.wordsAsInt32Array(),e=iOa.stackObjectValue(2),iOa.failed()?null:iOa.isWords(e)?(kOa=oNa(e),jOa=e.wordsAsInt32Array(),e=iOa.stackObjectValue(3),iOa.failed()?null:SOa(e)?(function(){var e,t;for(uOa[vNa]=0,e=uOa[wNa]=0;e<=kOa-1;e++)t=KOa(),t+=sOa[PNa],t=Math.min(t,VNa),sOa[PNa]=t&hOa,t&=VNa-hOa,t=Math.max(t,1),jOa[e]=4278190080+(t<<16)+(t<<8)+t}(),void iOa.pop(4)):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail())}function MOa(){var e,t,r;return 4!==iOa.methodArgumentCount()?iOa.primitiveFail():(hOa=iOa.stackIntegerValue(0),e=iOa.stackObjectValue(1),iOa.failed()?null:iOa.isWords(e)&&3===oNa(e)?(sOa=e.wordsAsInt32Array(),e=iOa.stackObjectValue(2),iOa.failed()?null:iOa.isWords(e)?(kOa=oNa(e),jOa=e.wordsAsInt32Array(),e=iOa.stackObjectValue(3),iOa.failed()?null:iOa.isPointers(e)&&3===oNa(e)&&SOa(iOa.fetchPointerofObject(0,e))?(t=iOa.fetchPointerofObject(1,e),wOa(cOa,t)&&xOa(bOa,t)?(r=iOa.fetchPointerofObject(2,e),wOa(eOa,r)&&xOa(dOa,r)?(function(){var e,t,r,i,a,s,n;for(uOa[vNa]=0,uOa[wNa]=0,cOa[vNa]=0,cOa[wNa]=0,eOa[vNa]=0,a=eOa[wNa]=0;a<=kOa-1;a++)n=KOa(),t=IOa(),t-=ZNa,r=JOa(),s=n+(HNa*(r-=ZNa)>>16)+sOa[YNa],s=Math.min(s,VNa),s=Math.max(s,0),sOa[YNa]=s&hOa,s&=VNa-hOa,s=Math.max(s,1),i=n-(ANa*t>>16)-(DNa*r>>16)+sOa[PNa],i=Math.min(i,VNa),i=Math.max(i,0),sOa[PNa]=i&hOa,i&=VNa-hOa,i=Math.max(i,1),e=n+(JNa*t>>16)+sOa[uNa],e=Math.min(e,VNa),e=Math.max(e,0),sOa[uNa]=e&hOa,e&=VNa-hOa,e=Math.max(e,1),jOa[a]=4278190080+(s<<16)+(i<<8)+e}(),void iOa.pop(4)):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail())}function NOa(){var e,t,r,i;return 5!==iOa.methodArgumentCount()?iOa.primitiveFail():(r=iOa.stackObjectValue(0),iOa.failed()?null:function(e){var t,r,i;if(!(oNa(e)<5)&&iOa.isPointers(e)&&"number"!=typeof(t=iOa.fetchPointerofObject(0,e))&&iOa.isBytes(t)&&(oOa=t.bytes,r=(i=t).bytes?i.bytes.length:i.words?4*i.words.length:0,pOa=iOa.fetchIntegerofObject(1,e),qOa=iOa.fetchIntegerofObject(2,e),mOa=iOa.fetchIntegerofObject(3,e),nOa=iOa.fetchIntegerofObject(4,e),!iOa.failed()&&!(r>>4,0!==(r&=15)){if(a+=s,r=POa(DOa(r),r),a<0||yNa<=a)return iOa.primitiveFail();e[lOa[a]]=r}else{if(15!=s)return;a+=s}++a}}(e,uOa),iOa.failed()?null:(i=iOa.stackValue(0),iOa.storeIntegerofObjectwithValue(1,i,pOa),iOa.storeIntegerofObjectwithValue(3,i,mOa),iOa.storeIntegerofObjectwithValue(4,i,nOa),iOa.storeIntegerofObjectwithValue(XNa,iOa.stackValue(3),uOa[XNa]),void iOa.pop(5))))):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail())}function OOa(){var e,t;return 2!==iOa.methodArgumentCount()?iOa.primitiveFail():(e=iOa.stackObjectValue(0),iOa.failed()?null:iOa.isWords(e)&&oNa(e)===yNa?(t=e.wordsAsInt32Array(),e=iOa.stackObjectValue(1),iOa.failed()?null:iOa.isWords(e)&&oNa(e)===yNa?(function(e,t){var r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S=new Array(64);for(a=0;a<=xNa-1;a++){for(r=-1,n=1;n<=xNa-1;n++)-1===r&&0!==e[n*xNa+a]&&(r=n);if(-1===r)for(i=e[a]*t[0]<<2,s=0;s<=xNa-1;s++)S[s*xNa+a]=i;else d=(m=((v=e[2*xNa+a]*t[2*xNa+a])+(g=e[6*xNa+a]*t[6*xNa+a]))*CNa)+g*(0-KNa),p=m+v*ENa,l=(o=(v=e[a]*t[a])+(g=e[4*xNa+a]*t[4*xNa+a])<<13)+p,f=o-p,c=(u=v-g<<13)+d,h=u-d,o=e[7*xNa+a]*t[7*xNa+a],u=e[5*xNa+a]*t[5*xNa+a],d=e[3*xNa+a]*t[3*xNa+a],m=o+(p=e[xNa+a]*t[xNa+a]),v=u+d,_=((g=o+d)+(k=u+p))*GNa,g*=0-LNa,k*=0-BNa,o=(o*=zNa)+(m*=0-FNa)+(g+=_),u=(u*=MNa)+(v*=0-NNa)+(k+=_),d=(d*=ONa)+v+g,p=(p*=INa)+m+k,S[a]=l+p>>11,S[7*xNa+a]=l-p>>11,S[+xNa+a]=c+d>>11,S[6*xNa+a]=c-d>>11,S[2*xNa+a]=h+u>>11,S[5*xNa+a]=h-u>>11,S[3*xNa+a]=f+o>>11,S[4*xNa+a]=f-o>>11}for(a=0;a<=yNa-xNa;a+=xNa)d=(m=((v=S[a+2])+(g=S[a+6]))*CNa)+g*(0-KNa),p=m+v*ENa,l=(o=S[a]+S[a+4]<<13)+p,f=o-p,c=(u=S[a]-S[a+4]<<13)+d,h=u-d,o=S[a+7],u=S[a+5],d=S[a+3],m=o+(p=S[a+1]),v=u+d,_=((g=o+d)+(k=u+p))*GNa,g*=0-LNa,k*=0-BNa,o=(o*=zNa)+(m*=0-FNa)+(g+=_),u=(u*=MNa)+(v*=0-NNa)+(k+=_),d=(d*=ONa)+v+g,b=(l+(p=(p*=INa)+m+k)>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a]=b,b=(l-p>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+7]=b,b=(c+d>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+1]=b,b=(c-d>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+6]=b,b=(h+u>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+2]=b,b=(h-u>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+5]=b,b=(f+o>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+3]=b,b=(f-o>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+4]=b}(e.wordsAsInt32Array(),t),void iOa.pop(2)):iOa.primitiveFail()):iOa.primitiveFail())}function POa(e,t){return e=nNa}function SOa(e){return wOa(uOa,e)&&xOa(tOa,e)}function WQa(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function XQa(e,t){return 0|Math.floor(e/t)}function YQa(e,t){return e-XQa(e,t)*t|0}function fRa(e,t){var r,i;return 0===e?0<=t?90:270:(r=t/e,i=Math.atan(r),0<=e?0<=t?i/.0174532925199433:360+i/.0174532925199433:180+i/.0174532925199433)}function gRa(e){var t,r;return r=(t=90-e)/360|0,t<0&&--r,.0174532925199433*(t-360*r)}function hRa(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b;if(l=$Qa.stackValue(0),t=$Qa.stackValue(1),b=$Qa.stackValue(2),f=$Qa.stackValue(3),i=$Qa.stackIntegerValue(4),s=$Qa.stackIntegerValue(5),a=$Qa.stackValue(6),$Qa.failed())return null;if(!$Qa.isWords(a))return $Qa.primitiveFail(),null;if(!$Qa.isWords(f))return $Qa.primitiveFail(),null;if(!$Qa.isWords(b))return $Qa.primitiveFail(),null;if(!$Qa.isWords(t))return $Qa.primitiveFail(),null;if(!$Qa.isBytes(l))return $Qa.primitiveFail(),null;if(i*s!==WQa(a))return $Qa.primitiveFail(),null;if(o=WQa(f),WQa(b)!==o)return $Qa.primitiveFail(),null;if(WQa(t)!==o)return $Qa.primitiveFail(),null;if(WQa(l)!==o)return $Qa.primitiveFail(),null;for(h=f.wordsAsFloat32Array(),p=b.wordsAsFloat32Array(),e=t.words,u=l.bytes,r=a.words,n=0;n<=o-1;n++)c=0|h[n],d=0|p[n],0!==u[n]&&0<=c&&0<=d&&c>>16,e<0?0-a:a}function nRa(){var e;if(e=$Qa.stackIntegerValue(0),$Qa.failed())return null;_Qa=65536&e,$Qa.pop(1)}function oRa(){var e,t,r,i,a,s,n,o,u,l,c,h;if(l=$Qa.stackIntegerValue(0),u=$Qa.stackIntegerValue(1),o=$Qa.stackValue(2),i=$Qa.stackValue(3),$Qa.failed())return null;if((a=WQa(i))!==WQa(o))return $Qa.primitiveFail(),null;if(l<-32)return $Qa.primitiveFail(),null;if(8>>0-h:31=VQa}function QRa(){var e,t,r;return e=$Qa.stackFloatValue(0),t=$Qa.stackValue(1),r=$Qa.stackIntegerValue(2),$Qa.failed()?null:!$Qa.isWords(t)||WQa(t)>>16,e<0?0-a:a}function o_a(){var e;if(e=_$a.stackIntegerValue(0),_$a.failed())return null;a_a=65536&e,_$a.pop(1)}function p_a(){var e,t,r,i,a,s,n,o,u,l,c,h;if(l=_$a.stackIntegerValue(0),u=_$a.stackIntegerValue(1),o=_$a.stackValue(2),i=_$a.stackValue(3),_$a.failed())return null;if((a=X$a(i))!==X$a(o))return _$a.primitiveFail(),null;if(l<-32)return _$a.primitiveFail(),null;if(8>>0-h:31=l[a];else for(c=o.words,r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]>=r[a];else if(s)for(i=o.wordsAsFloat32Array(),l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]>=l[a];else for(i=o.wordsAsFloat32Array(),r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]>=r[a];_$a.pop(4),_$a.push(u)}function H_a(){var e,t,r,i,a,s,n,o,u,l,c;if(l=_$a.stackObjectValue(0),e=_$a.stackValue(1),u=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(u)),_$a.success(_$a.isBytes(l)),_$a.failed())return null;if(o=X$a(u),_$a.success(o===X$a(l)),_$a.failed())return null;if(n="number"==typeof e,_$a.isMemberOf(u,"WordArray"))if(n)for(c=u.words,s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]>=s;else for(c=u.words,r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]>=r;else if(n)for(i=u.wordsAsFloat32Array(),s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]>=s;else for(i=u.wordsAsFloat32Array(),r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]>=r;_$a.pop(4),_$a.push(l)}function I_a(){var e,t,r,i,a,s,n,o,u,l,c;if(u=_$a.stackObjectValue(0),e=_$a.stackObjectValue(1),o=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(e)),_$a.success(_$a.isWords(o)),_$a.success(_$a.isBytes(u)),_$a.failed())return null;if(n=X$a(e),_$a.success(n===X$a(o)),_$a.success(n===X$a(u)),_$a.failed())return null;if(s=_$a.isMemberOf(e,"WordArray"),_$a.isMemberOf(o,"WordArray"))if(s)for(c=o.words,l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]>l[a];else for(c=o.words,r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]>r[a];else if(s)for(i=o.wordsAsFloat32Array(),l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]>l[a];else for(i=o.wordsAsFloat32Array(),r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]>r[a];_$a.pop(4),_$a.push(u)}function J_a(){var e,t,r,i,a,s,n,o,u,l,c;if(l=_$a.stackObjectValue(0),e=_$a.stackValue(1),u=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(u)),_$a.success(_$a.isBytes(l)),_$a.failed())return null;if(o=X$a(u),_$a.success(o===X$a(l)),_$a.failed())return null;if(n="number"==typeof e,_$a.isMemberOf(u,"WordArray"))if(n)for(c=u.words,s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]>s;else for(c=u.words,r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]>r;else if(n)for(i=u.wordsAsFloat32Array(),s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]>s;else for(i=u.wordsAsFloat32Array(),r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]>r;_$a.pop(4),_$a.push(l)}function K_a(){var e,t,r,i,a,s,n,o,u,l,c;if(u=_$a.stackObjectValue(0),e=_$a.stackObjectValue(1),o=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(e)),_$a.success(_$a.isWords(o)),_$a.success(_$a.isBytes(u)),_$a.failed())return null;if(n=X$a(e),_$a.success(n===X$a(o)),_$a.success(n===X$a(u)),_$a.failed())return null;if(s=_$a.isMemberOf(e,"WordArray"),_$a.isMemberOf(o,"WordArray"))if(s)for(c=o.words,l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]<=l[a];else for(c=o.words,r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]<=r[a];else if(s)for(i=o.wordsAsFloat32Array(),l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]<=l[a];else for(i=o.wordsAsFloat32Array(),r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]<=r[a];_$a.pop(4),_$a.push(u)}function L_a(){var e,t,r,i,a,s,n,o,u,l,c;if(l=_$a.stackObjectValue(0),e=_$a.stackValue(1),u=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(u)),_$a.success(_$a.isBytes(l)),_$a.failed())return null;if(o=X$a(u),_$a.success(o===X$a(l)),_$a.failed())return null;if(n="number"==typeof e,_$a.isMemberOf(u,"WordArray"))if(n)for(c=u.words,s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]<=s;else for(c=u.words,r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]<=r;else if(n)for(i=u.wordsAsFloat32Array(),s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]<=s;else for(i=u.wordsAsFloat32Array(),r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]<=r;_$a.pop(4),_$a.push(l)}function M_a(){var e,t,r,i,a,s,n,o,u,l,c;if(u=_$a.stackObjectValue(0),e=_$a.stackObjectValue(1),o=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(e)),_$a.success(_$a.isWords(o)),_$a.success(_$a.isBytes(u)),_$a.failed())return null;if(n=X$a(e),_$a.success(n===X$a(o)),_$a.success(n===X$a(u)),_$a.failed())return null;if(s=_$a.isMemberOf(e,"WordArray"),_$a.isMemberOf(o,"WordArray"))if(s)for(c=o.words,l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]>>0,m[i]=r);if(!b&&!o)for(m=v.words,h=l.words,i=d-1;i<=p-1;i++)1===a[i]&&(m[i]=h[c+i-d]);_$a.pop(4)}function $_a(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g;if(f=_$a.stackObjectValue(0),e=_$a.stackObjectValue(1),h=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(e)),_$a.success(_$a.isWords(h)),_$a.success(_$a.isWords(f)),_$a.failed())return null;if(c=X$a(e),_$a.success(c===X$a(h)),_$a.success(c===X$a(f)),_$a.failed())return null;if(u=_$a.isMemberOf(e,"WordArray"),l=_$a.isMemberOf(h,"WordArray"),u&&l){if(!_$a.isMemberOf(f,"WordArray"))return _$a.primitiveFail(),null}else if(!_$a.isMemberOf(f,"KedamaFloatArray"))return _$a.primitiveFail(),null;if(l)if(u)for(v=h.words,m=e.words,g=f.words,o=0;o<=c-1;o++)b=Z$a(p=v[o],d=m[o]),g[o]=b;else for(v=h.words,a=e.wordsAsFloat32Array(),n=f.wordsAsFloat32Array(),o=0;o<=c-1;o++)i=(p=v[o])/(t=a[o]),i=Math.floor(i),n[o]=p-i*t;else if(u)for(s=h.wordsAsFloat32Array(),m=e.words,n=f.wordsAsFloat32Array(),o=0;o<=c-1;o++)i=(r=s[o])/(d=m[o]),i=Math.floor(i),n[o]=r-i*d;else for(s=h.wordsAsFloat32Array(),a=e.wordsAsFloat32Array(),n=f.wordsAsFloat32Array(),o=0;o<=c-1;o++)i=(r=s[o])/(t=a[o]),i=Math.floor(i),n[o]=r-i*t;_$a.pop(4),_$a.push(f)}function __a(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b;if(f=_$a.stackObjectValue(0),e=_$a.stackValue(1),h=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(h)),_$a.success(_$a.isWords(f)),_$a.failed())return null;if(c=X$a(h),_$a.success(c===X$a(f)),_$a.failed())return null;if(u="number"==typeof e,l=_$a.isMemberOf(h,"WordArray"),u&&l){if(!_$a.isMemberOf(f,"WordArray"))return _$a.primitiveFail(),null}else if(!_$a.isMemberOf(f,"KedamaFloatArray"))return _$a.primitiveFail(),null;if(l)if(u)for(p=h.words,o=e,b=f.words,n=0;n<=c-1;n++)b[n]=Z$a(p[n],o);else for(p=h.words,t=_$a.floatValueOf(e),s=f.wordsAsFloat32Array(),n=0;n<=c-1;n++)i=(d=p[n])/t,i=Math.floor(i),s[n]=d-i*t;else if(u)for(a=h.wordsAsFloat32Array(),o=e,s=f.wordsAsFloat32Array(),n=0;n<=c-1;n++)i=(r=a[n])/o,i=Math.floor(i),s[n]=r-i*o;else for(a=h.wordsAsFloat32Array(),t=_$a.floatValueOf(e),s=f.wordsAsFloat32Array(),n=0;n<=c-1;n++)i=(r=a[n])/t,i=Math.floor(i),s[n]=r-i*t;_$a.pop(4),_$a.push(f)}function a0a(){var e,t,r,i,a,s,n,o,u,l,c,h,f;if(l=_$a.stackObjectValue(0),e=_$a.stackObjectValue(1),u=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(e)),_$a.success(_$a.isWords(u)),_$a.success(_$a.isWords(l)),_$a.failed())return null;if(o=X$a(e),_$a.success(o===X$a(u)),_$a.success(o===X$a(l)),_$a.failed())return null;if(s=_$a.isMemberOf(e,"WordArray"),n=_$a.isMemberOf(u,"WordArray"),s&&n){if(!_$a.isMemberOf(l,"WordArray"))return _$a.primitiveFail(),null}else if(!_$a.isMemberOf(l,"KedamaFloatArray"))return _$a.primitiveFail(),null;if(n)if(s)for(h=u.words,c=e.words,f=l.words,a=0;a<=o-1;a++)f[a]=h[a]-c[a];else for(h=u.words,t=e.wordsAsFloat32Array(),i=l.wordsAsFloat32Array(),a=0;a<=o-1;a++)i[a]=h[a]-t[a];else if(s)for(r=u.wordsAsFloat32Array(),c=e.words,i=l.wordsAsFloat32Array(),a=0;a<=o-1;a++)i[a]=r[a]-c[a];else for(r=u.wordsAsFloat32Array(),t=e.wordsAsFloat32Array(),i=l.wordsAsFloat32Array(),a=0;a<=o-1;a++)i[a]=r[a]-t[a];_$a.pop(4),_$a.push(l)}function b0a(){var e,t,r,i,a,s,n,o,u,l,c,h,f;if(c=_$a.stackObjectValue(0),e=_$a.stackValue(1),l=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(l)),_$a.success(_$a.isWords(c)),_$a.failed())return null;if(u=X$a(l),_$a.success(u===X$a(c)),_$a.failed())return null;if(n="number"==typeof e,o=_$a.isMemberOf(l,"WordArray"),n&&o){if(!_$a.isMemberOf(c,"WordArray"))return _$a.primitiveFail(),null}else if(!_$a.isMemberOf(c,"KedamaFloatArray"))return _$a.primitiveFail(),null;if(o)if(n)for(h=l.words,s=e,f=c.words,a=0;a<=u-1;a++)f[a]=h[a]-s;else for(h=l.words,t=_$a.floatValueOf(e),i=c.wordsAsFloat32Array(),a=0;a<=u-1;a++)i[a]=h[a]-t;else if(n)for(r=l.wordsAsFloat32Array(),s=e,i=c.wordsAsFloat32Array(),a=0;a<=u-1;a++)i[a]=r[a]-s;else for(r=l.wordsAsFloat32Array(),t=_$a.floatValueOf(e),i=c.wordsAsFloat32Array(),a=0;a<=u-1;a++)i[a]=r[a]-t;_$a.pop(4),_$a.push(c)}function c0a(e){var t;return 0<(t=90-e/.0174532925199433)||(t+=360),t}function d0a(){var e,t,r,i,a,s,n;if(e=_$a.stackFloatValue(0),r=_$a.stackValue(1),n=_$a.stackIntegerValue(2),i=_$a.stackIntegerValue(3),s=_$a.stackIntegerValue(4),_$a.failed())return null;if(!_$a.isWords(r))return _$a.primitiveFail(),null;if(!(n<=X$a(r)&&1<=i&&i<=n))return _$a.primitiveFail(),null;if(t=r.wordsAsFloat32Array(),_$a.failed())return null;for(a=i;a<=n;a++)t[a-1]=n_a(s)*e;_$a.pop(5)}function e0a(){var e,t,r,i,a,s,n;if(e=_$a.stackFloatValue(0),a=_$a.stackValue(1),n=_$a.stackIntegerValue(2),t=_$a.stackIntegerValue(3),s=_$a.stackIntegerValue(4),_$a.failed())return null;if(!_$a.isWords(a))return _$a.primitiveFail(),null;if(!(n<=X$a(a)&&1<=t&&t<=n))return _$a.primitiveFail(),null;if(i=a.words,_$a.failed())return null;for(r=t;r<=n;r++)i[r-1]=n_a(s)*e|0;_$a.pop(5)}function f0a(){var e,t;return e=_$a.stackIntegerValue(0),_$a.failed()?null:(t=n_a(e),_$a.failed()?null:(_$a.pop(2),void _$a.pushInteger(t)))}function g0a(){var e,t,r,i,a;return t=_$a.stackFloatValue(0),e=_$a.stackFloatValue(1),a=_$a.stackFloatValue(2),i=_$a.stackFloatValue(3),_$a.failed()?null:(r=g_a(i-e,a-t),360<(r+=90)&&(r-=360),_$a.failed()?null:(_$a.pop(5),void _$a.pushFloat(r)))}function h0a(){var e,t,r,i,a,s,n;return t=_$a.stackFloatValue(0),e=_$a.stackFloatValue(1),a=_$a.stackFloatValue(2),i=_$a.stackFloatValue(3),_$a.failed()?null:(s=e-i,n=t-a,r=Math.sqrt(s*s+n*n),_$a.failed()?null:(_$a.pop(5),void _$a.pushFloat(r)))}function i0a(e,t,r,i,a,s,n){var o,u;(u=i)<0&&(1===s&&(u+=a),2===s&&(u=0),3===s&&(u=0-u,o=r[e],r[e]=o<3.141592653589793?3.141592653589793-o:9.42477796076938-o)),a<=u&&(1===n&&(u-=a),2===n&&(u=a-1e-6),3===n&&(u=a-1e-6-(u-a),o=r[e],r[e]=o<3.141592653589793?3.141592653589793-o:9.42477796076938-o)),t[e]=u}function j0a(e,t,r,i,a,s,n){var o;(o=i)<0&&(1===s&&(o+=a),2===s&&(o=0),3===s&&(o=0-o,r[e]=6.283185307179586-r[e])),a<=o&&(1===n&&(o-=a),2===n&&(o=a-1e-6),3===n&&(o=a-1e-6-(o-a),r[e]=6.283185307179586-r[e])),t[e]=o}function k0a(){var e,t,r,i,a,s,n,o,u,l;if(u=_$a.stackValue(0),r=_$a.stackValue(1),n=_$a.stackValue(2),_$a.failed())return null;if(!_$a.isBytes(n))return _$a.primitiveFail(),null;if(!_$a.isWords(r))return _$a.primitiveFail(),null;if(l=X$a(r),u.isFloat)a=!1;else{if(!_$a.isWords(u))return _$a.primitiveFail(),null;if(X$a(u)!==l)return _$a.primitiveFail(),null;a=!0}for(s=n.bytes,t=r.wordsAsFloat32Array(),a?o=u.wordsAsFloat32Array():e=h_a(e=_$a.floatValueOf(u)),i=0;i<=l-1;i++)1===s[i]&&(a&&(e=h_a(e=o[i])),t[i]=e);if(_$a.failed())return null;_$a.pop(3)}function l0a(e){return!1!=((_$a=e).majorVersion()==V$a)&&_$a.minorVersion()>=W$a}function m0a(){var e,t,r;return e=_$a.stackFloatValue(0),t=_$a.stackValue(1),r=_$a.stackIntegerValue(2),_$a.failed()?null:!_$a.isWords(t)||X$a(t)>=1);jgb=sgb*dgb[Sfb]|0,function(e,t,r){var i,a,s,n,o,u,l,c,h,f,d,p,b,m;f=(p=sgb*e|0)/sgb,h=r,a=(l=t)<=0?1:1-(u=(1-f)/l)/(Math.exp(u)-1);o=vfb*(h+1),i=Math.cos(o),d=Math.sin(o),m=function(e,t,r,i){var a,s,n,o,u,l,c;if(0<(o=Qgb(0,e,t,r,i)))for(u=0,a=o,s=Qgb(l=1,e,t,r,i);0=pgb),fgb.failed()?null:(function(e,t,r){var i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S;(function(e){var t,r,i,a,s,n,o,u,l,c,h;c=.6*Igb((dgb=e)[Neb]),h=.6*Igb(dgb[Peb]),t=.4*Igb(dgb[Eeb]),i=.15*Igb(dgb[Geb]),s=.06*Igb(dgb[Ieb]),o=.04*Igb(dgb[Keb]),r=.15*Igb(dgb[Feb]),a=.06*Igb(dgb[Heb]),n=.04*Igb(dgb[Jeb]),u=.022*Igb(dgb[Leb]),l=.03*Igb(dgb[Meb]),8<=cgb&&(16e3<=qgb?Rgb(Mfb,7500,600):cgb=6);7<=cgb&&(16e3<=qgb?Rgb(Lfb,6500,500):cgb=6);6<=cgb&&Rgb(Jfb,dgb[mfb],dgb[Zeb]);5<=cgb&&Rgb(Hfb,dgb[lfb],dgb[Xeb]);Rgb(Efb,dgb[kfb],dgb[Veb]),Rgb(Bfb,dgb[jfb],dgb[Teb]),Rgb(yfb,dgb[ifb],dgb[Reb]),Rgb(wfb,dgb[hfb],dgb[Qeb]),Rgb(Pfb,dgb[ofb],dgb[_eb]),Rgb(Ufb,dgb[rfb],dgb[bfb]),Bgb(Rfb,dgb[pfb],dgb[afb]),Bgb(Wfb,dgb[sfb],dgb[cfb]),Sgb(Qfb,dgb[ofb],dgb[_eb],c),Sgb(Vfb,dgb[rfb],dgb[bfb],h),Sgb(xfb,dgb[hfb],dgb[Qeb],t),Sgb(Afb,dgb[ifb],dgb[Reb],i),Sgb(Dfb,dgb[jfb],dgb[Teb],s),Sgb(Gfb,dgb[kfb],dgb[Veb],o),Sgb(zfb,dgb[ifb],dgb[Seb],r),Sgb(Cfb,dgb[jfb],dgb[Ueb],a),Sgb(Ffb,dgb[kfb],dgb[Web],n),Sgb(Ifb,dgb[lfb],dgb[Yeb],u),Sgb(Kfb,dgb[mfb],dgb[$eb],l)})(e),0=Aeb}function gkb(e){return"number"==typeof e?nkb.classSmallInteger():e.sqClass}function hkb(e){return e.bytes?e.bytes.length:e.words?4*e.words.length:0}function ikb(e,t){return 0|Math.floor(e/t)}function jkb(e,t){return e-ikb(e,t)*t|0}function kkb(e,t){return 31>>t}function rkb(e,t,r){var i,a,s,n,o,u,l,c,h;if(t<1||r<1)return nkb.primitiveFail();if(a=e,!((u=Math.min(r,zkb((h=a).bytes,hkb(h))))>3),i=1+(u-1>>3),n=jkb(t-1,8),s=7-jkb(u-1,8),o==i)return l=kkb(255,n)&lkb(255,s),0!=(Ukb(a,o)&l);if(0!==lkb(Ukb(a,o),n))return 1;for(c=1+o;c<=i-1;c++)if(0!==Ukb(a,c))return 1;return 0!=(255&kkb(Ukb(a,i),s))}}function skb(e,t){var r,i,a;return a=nkb.instantiateClassindexableSize(gkb(e),t),i=(r=hkb(e))>>=16,r+=16),t<256||(t>>>=8,r+=8),t<16||(t>>>=4,r+=4),t<4||(t>>>=2,r+=2),t<2||(t>>>=1,++r),r+t}function Kkb(e){var t,r,i,a,s,n;for(s=(n=e)<0?nkb.classLargeNegativeInteger():nkb.classLargePositiveInteger(),t=Akb(n),i=(r=nkb.instantiateClassindexableSize(s,t)).bytes,a=1;a<=t;a++)i[a-1]=Ekb(n,a);return r}function Lkb(e,t){var r,i,a,s;return i=hkb(e),0===(s=zkb(e.bytes,i))?0:(r=s+t+7>>3,a=nkb.instantiateClassindexableSize(gkb(e),r),function(e,t,r,i,a){var s,n,o,u,l,c,h;for(s=e>>3,l=jkb(e,8),h=s-1,u=0;u<=h;u++)i[u]=0;if(0===l)return Gkb(i,s,a-1,t,0);for(c=8-l,h=r-1,u=n=0;u<=h;u++)o=t[u],i[u+s]=255&(n|kkb(o,l)),n=lkb(o,c);0!==n&&(i[a-1]=n)}(t,e.bytes,i,a.bytes,r),a)}function Mkb(e,t,r){var i,a,s,n,o;return a=(o=zkb(e.bytes,r))+7>>3,(n=o-t)<=0?nkb.instantiateClassindexableSize(gkb(e),0):(s=7+n>>3,i=nkb.instantiateClassindexableSize(gkb(e),s),function(e,t,r,i,a){var s,n,o,u,l,c,h,f;if(n=e>>3,0===(l=jkb(e,8)))return Gkb(i,0,a-1,t,n);for(c=8-l,o=lkb(t[n],l),h=r-1,s=f=1+n;s<=h;s++)u=t[s],i[s-f]=255&(o|kkb(u,c)),o=lkb(u,l);0!==o&&(i[a-1]=o)}(t,e.bytes,a,i.bytes,s),i)}function Nkb(e,t){var r,i,a,s,n,o,u,l,c,h;return l=hkb(e),c=hkb(t),n=gkb(e),u=l<=c?(s=e,i=l,h=t,c):(s=t,i=c,h=e,l),r=nkb.instantiateClassindexableSize(n,u),0<(a=function(e,t,r,i,a){var s,n,o;for(n=t-1,s=o=0;s<=n;s++)o=(o>>>8)+e[s]+r[s],a[s]=255&o;for(n=i-1,s=t;s<=n;s++)o=(o>>>8)+r[s],a[s]=255&o;return o>>>8}(s.bytes,i,h.bytes,u,r.bytes))&&(o=nkb.instantiateClassindexableSize(n,u+1),xkb(r.bytes,o.bytes,u),(r=o).bytes[u]=a),r}function Okb(e,t,r){var i,a,s,n,o,u,l,c,h;if("number"==typeof e){if(e<0)return nkb.primitiveFail();s=Kkb(e)}else{if(gkb(e)===nkb.classLargeNegativeInteger())return nkb.primitiveFail();s=e}if("number"==typeof t){if(t<0)return nkb.primitiveFail();n=Kkb(t)}else{if(gkb(t)===nkb.classLargeNegativeInteger())return nkb.primitiveFail();n=t}return u=(l=hkb(s))<(c=hkb(n))?(i=l,a=s,o=c,n):(i=c,a=n,o=l,s),h=nkb.instantiateClassindexableSize(nkb.classLargePositiveInteger(),o),function(e,t,r,i,a,s){var n,o;if(o=r-1,e!==mkb)if(e!==pkb){if(e!==qkb)return nkb.primitiveFail();for(n=0;n<=o;n++)s[n]=t[n]^i[n];for(o=a-1,n=r;n<=o;n++)s[n]=i[n]}else{for(n=0;n<=o;n++)s[n]=t[n]|i[n];for(o=a-1,n=r;n<=o;n++)s[n]=i[n]}else{for(n=0;n<=o;n++)s[n]=t[n]&i[n];for(o=a-1,n=r;n<=o;n++)s[n]=0}}(r,a.bytes,i,u.bytes,o,h.bytes),nkb.failed()?0:_kb(h)}function Pkb(e,t){var r,i;return i=hkb(e),(r=hkb(t))!==i?i>>8,c=255&d,f=m<3?0:r[m-3];(y>>8),c=e[v-1]*(255&o),n=r[p-1]-u-(255&c),r[p-1]=255&n,u=h+(c>>>8)-(n>>=8),++p;if(0>>8)+r[p-1]+e[v-1],r[p-1]=255&u,++p;a[s-b]=o}}(n.bytes,Rkb(n),s.bytes,Rkb(s),o.bytes,Rkb(o)),s=Mkb(s,u,Rkb(n)-1),a=nkb.instantiateClassindexableSize(nkb.classArray(),2),nkb.stObjectatput(a,1,o),nkb.stObjectatput(a,2,s)),a}function Rkb(e){return("number"==typeof e?Akb:hkb)(e)}function Skb(e,t,r,i){var a,s,n,o;return n=hkb(e),o=hkb(t),n<=(s=hkb(r))&&o<=s&&0<=i&&i<=255?(a=nkb.instantiateClassindexableSize(nkb.classLargePositiveInteger(),s),function(e,t,r,i,a,s,n,o){var u,l,c,h,f,d,p,b;for(d=t-1,f=i-1,h=s-1,l=c=0;l<=d;l++){for(b=o[0]+e[l]*r[0],b+=(p=b*n&255)*a[0],u=1;u<=f;u++)b=(b>>>8)+o[u]+e[l]*r[u]+p*a[u],o[u-1]=255&b;for(u=i;u<=h;u++)b=(b>>>8)+o[u]+p*a[u],o[u-1]=255&b;b=(b>>>8)+c,o[h]=255&b,c=b>>>8}for(l=t;l<=h;l++){for(b=o[0],b+=(p=b*n&255)*a[0],u=1;u<=h;u++)b=(b>>>8)+o[u]+p*a[u],o[u-1]=255&b;b=(b>>>8)+c,o[h]=255&b,c=b>>>8}if(0!==c||1!==wkb(a,o,s))for(l=b=0;l<=h;l++)b=b+o[l]-a[l],o[l]=255&b,b>>=8}(e.bytes,n,t.bytes,o,r.bytes,s,i,a.bytes),_kb(a)):nkb.primitiveFail()}function Tkb(e,t,r){var i,a,s,n,o,u,l,c;return o=(c=hkb(e))<=(l=hkb(t))?(n=e,s=c,i=t,l):(n=t,s=l,i=e,c),a=r?nkb.classLargeNegativeInteger():nkb.classLargePositiveInteger(),u=nkb.instantiateClassindexableSize(a,o+s),function(e,t,r,i,a){var s,n,o,u,l,c,h,f;if(!(1===t&&0===e[0]||1===i&&0===r[0]))for(f=t-1,c=i-1,l=0;l<=f;l++)if(0!==(o=e[l])){for(h=l,n=u=0;n<=c;n++)u=(s=(s=r[n])*o+u+a[h])>>>8,a[h]=255&s,++h;a[h]=u}}(n.bytes,s,i.bytes,o,u.bytes),Zkb(u)}function Ukb(e,t){return t>hkb(e)?0:Alb(e,t)}function Vkb(e,t){var r,i,a,s,n,o,u,l,c,h;if(u=gkb(e)===nkb.classLargeNegativeInteger(),(l=hkb(e))===(c=hkb(t))){for(;1>=8;for(s=t;s<=i-1;s++)n+=r[s],a[s]=255&n,n>>=8}(s.bytes,r,i.bytes,o,a.bytes),(h?$kb:_kb)(a)}function Wkb(){return okb}function Ykb(e){var t,r;if("number"==typeof e)return 1;if(0!==(r=Rkb(e))&&0!==Alb(e,r)){if(4Ekb(1073741823,4);if(!(Alb(e,4)(r=i)?(a=1,nkb.failed()||nkb.popthenPush(2,a),null):(a=e(t=i)?(a=1,nkb.failed()||nkb.popthenPush(3,a),null):(a=e=fkb}function Alb(e,t){return e.bytes[t-1]}function Wsb(e){return"number"==typeof e?Ysb.classSmallInteger():e.sqClass}function Xsb(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function ctb(){return btb}function dtb(e){return Ysb.failed()?null:Ysb.isWords(e)&&6===Xsb(e)?e.wordsAsFloat32Array():(Ysb.primitiveFail(),null)}function etb(e){var t,r;if(!Ysb.failed()){if(Wsb(e)!==Ysb.classPoint())return Ysb.primitiveFail();if(!(t="number"==typeof(r=Ysb.fetchPointerofObject(0,e)))&&!r.isFloat)return Ysb.primitiveFail();if(Zsb=t?r:Ysb.floatValueOf(r),!(t="number"==typeof(r=Ysb.fetchPointerofObject(1,e)))&&!r.isFloat)return Ysb.primitiveFail();$sb=t?r:Ysb.floatValueOf(r)}}function gtb(e){var t,r,i,a,s;if(a=Zsb-e[2],s=$sb-e[5],0===(t=e[0]*e[4]-e[1]*e[3]))return Ysb.primitiveFail();t=1/t,r=a*e[4]-e[1]*s,i=e[0]*s-a*e[3],_sb=r*t,atb=i*t}function htb(e){_sb=Zsb*e[0]+$sb*e[1]+e[2],atb=Zsb*e[3]+$sb*e[4]+e[5]}function itb(e){return-1073741824<=e&&_sb<=1073741823}function jtb(e){var t,r,i,a,s,n,o,u,l,c,h,f,d;if(i=dtb(a=Ysb.stackObjectValue(0)),r=dtb(Ysb.stackObjectValue(1)),t=dtb(Ysb.stackObjectValue(2)),Ysb.failed())return null;n=r,o=i,u=(s=t)[0]*n[0]+s[1]*n[3],l=s[0]*n[1]+s[1]*n[4],c=s[0]*n[2]+s[1]*n[5]+s[2],h=s[3]*n[0]+s[4]*n[3],f=s[3]*n[1]+s[4]*n[4],d=s[3]*n[2]+s[4]*n[5]+s[5],o[0]=u,o[1]=l,o[2]=c,o[3]=h,o[4]=f,o[5]=d,Ysb.popthenPush(e+1,a)}function ktb(e){var t;if(etb(Ysb.stackObjectValue(0)),t=dtb(Ysb.stackObjectValue(1)),Ysb.failed())return null;gtb(t),Ysb.failed()||qtb(e)}function ltb(e){var t,r,i,a,s,n,o,u,l,c,h;return i=Ysb.stackObjectValue(0),h=Ysb.stackObjectValue(1),a=dtb(Ysb.stackObjectValue(2)),Ysb.failed()?null:Wsb(h)!==Wsb(i)||!Ysb.isPointers(h)||2!==Xsb(h)?Ysb.primitiveFail():(etb(Ysb.fetchPointerofObject(0,h)),Ysb.failed()?null:(l=Zsb,c=$sb,gtb(a),o=s=_sb,u=n=atb,etb(Ysb.fetchPointerofObject(1,h)),Ysb.failed()?null:(t=Zsb,r=$sb,gtb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),u=Math.min(u,atb),n=Math.max(n,atb),Zsb=t,$sb=c,gtb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),u=Math.min(u,atb),n=Math.max(n,atb),Zsb=l,$sb=r,gtb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),u=Math.min(u,atb),n=Math.max(n,atb),Ysb.failed()||(i=rtb(i,o,u,s,n)),void(Ysb.failed()||Ysb.popthenPush(e+1,i)))))}function mtb(e){var t;if(t=dtb(Ysb.stackObjectValue(0)),Ysb.failed())return null;Ysb.pop(1),Ysb.pushBool(1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&1===t[4]&&0===t[5])}function ntb(e){var t;if(t=dtb(Ysb.stackObjectValue(0)),Ysb.failed())return null;Ysb.pop(1),Ysb.pushBool(1===t[0]&&0===t[1]&&0===t[3]&&1===t[4])}function otb(e){var t;if(etb(Ysb.stackObjectValue(0)),t=dtb(Ysb.stackObjectValue(1)),Ysb.failed())return null;htb(t),qtb(e)}function ptb(e){var t,r,i,a,s,n,o,u,l,c,h;return i=Ysb.stackObjectValue(0),h=Ysb.stackObjectValue(1),a=dtb(Ysb.stackObjectValue(2)),Ysb.failed()?null:Wsb(h)!==Wsb(i)||!Ysb.isPointers(h)||2!==Xsb(h)?Ysb.primitiveFail():(etb(Ysb.fetchPointerofObject(0,h)),Ysb.failed()?null:(l=Zsb,c=$sb,htb(a),o=s=_sb,u=n=atb,etb(Ysb.fetchPointerofObject(1,h)),Ysb.failed()?null:(t=Zsb,r=$sb,htb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),u=Math.min(u,atb),n=Math.max(n,atb),Zsb=t,$sb=c,htb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),u=Math.min(u,atb),n=Math.max(n,atb),Zsb=l,$sb=r,htb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),i=rtb(i,o,u=Math.min(u,atb),s,n=Math.max(n,atb)),void(Ysb.failed()||Ysb.popthenPush(e+1,i)))))}function qtb(e){return atb+=.5,itb(_sb+=.5)&&itb(atb)?void Ysb.popthenPush(e+1,Ysb.makePointwithxValueyValue(0|_sb,0|atb)):Ysb.primitiveFail()}function rtb(e,t,r,i,a){var s,n,o,u,l,c,h;return itb(u=t+.5)&&itb(n=i+.5)&&itb(l=r+.5)&&itb(o=a+.5)?(Ysb.pushRemappableOop(e),c=Ysb.makePointwithxValueyValue(0|u,0|l),Ysb.pushRemappableOop(c),s=Ysb.makePointwithxValueyValue(0|n,0|o),c=Ysb.popRemappableOop(),h=Ysb.popRemappableOop(),Ysb.storePointerofObjectwithValue(0,h,c),Ysb.storePointerofObjectwithValue(1,h,s),h):Ysb.primitiveFail()}function stb(e){return!1!=((Ysb=e).majorVersion()==Usb)&&Ysb.minorVersion()>=Vsb}function Tub(e,t){return e-(r=e,i=t,(0|Math.floor(r/i))*t)|0;var r,i}function Xub(e,t,r){var i,a,s;for(i=0;i<=3;i++)t[r+i-1]=255&(a=e,31<(s=8*(3-i))?0:a>>>s);return r+4}function Yub(e,t,r){return e<=223?(t[r-1]=e,r+1):e<=7935?(t[r-1]=224+(e>>8),t[r]=Tub(e,256),r+2):(t[r-1]=255,Xub(e,t,r+1))}function Zub(){return Wub}function $ub(e){var t,r,i,a,s,n,o,u;if(Vub.stackValue(3),t=Vub.stackBytes(2),r=Vub.stackBytes(1),i=Vub.stackBytes(0),Vub.failed())return null;for(o=t.length,u=r.length,n=1;n<=Math.min(o,u);n++)if((a=i[t[n-1]])!==(s=i[r[n-1]]))return a>>8&255)==(o=255&c)&&(c>>>16&255)==o&&(c>>>24&255)==o,s=n;s>>2))return Vub.primitiveFail(),null;if(1==(s=3&a))for(n=r[u-1],++u,n|=n<<8,n|=n<<16,l=1;l<=f;l++)t[c-1]=n,++c;if(2==s){for(n=0,l=1;l<=4;l++)n=n<<8|r[u-1],++u;for(l=1;l<=f;l++)t[c-1]=n,++c}if(3==s)for(h=1;h<=f;h++){for(n=0,l=1;l<=4;l++)n=n<<8|r[u-1],++u;t[c-1]=n,++c}}if(Vub.failed())return null;Vub.pop(e)}function cvb(e){var t,r,i,a,s;if(Vub.stackValue(3),t=Vub.stackBytes(2),r=Vub.stackBytes(1),i=Vub.stackIntegerValue(0),Vub.failed())return null;if(256!==r.length)return Vub.failed()||Vub.popthenPush(e+1,0),null;for(a=i,s=t.length;a<=s&&0===r[t[a-1]];)++a;return s>>14)+101*s&16383)&268435455;return Vub.failed()||Vub.popthenPush(e+1,a),null}function gvb(e){var t,r,i,a,s;if(Vub.stackValue(4),t=Vub.stackBytes(3),r=Vub.stackIntegerValue(2),i=Vub.stackIntegerValue(1),a=Vub.stackBytes(0),Vub.failed())return null;for(s=r;s<=i;s++)t[s-1]=a[t[s-1]];if(Vub.failed())return null;Vub.pop(e)}function hvb(e){return!1!=((Vub=e).majorVersion()==Qub)&&Vub.minorVersion()>=Rub}function axb(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function bxb(e,t){return 0|Math.floor(e/t)}function cxb(e,t){return e-bxb(e,t)*t|0}function fxb(e,t,r,i,a){var s,n,o,u,l,c,h;n=bxb(r,60),u=(1e3-i)*a,l=(1e3-bxb(i*(s=cxb(r,60)),60))*a,c=(1e3-bxb(i*(60-s),60))*a,h=bxb(1e3*a,3922),u=bxb(u,3922),l=bxb(l,3922),c=bxb(c,3922),0===n&&(o=(h<<16)+(c<<8)+u),1===n&&(o=(l<<16)+(h<<8)+u),2===n&&(o=(u<<16)+(h<<8)+c),3===n&&(o=(u<<16)+(l<<8)+h),4===n&&(o=(c<<16)+(u<<8)+h),5===n&&(o=(h<<16)+(u<<8)+l),0===o&&(o=1),e[t]=o}function gxb(e){return dxb.success(dxb.isWordsOrBytes(e)),dxb.failed()?0:e.wordsAsFloat64Array()}function hxb(e){return dxb.success(dxb.isWords(e)),dxb.failed()?0:e.words}function ixb(){return exb}function jxb(e,t,r,i,a){var s,n;return 0==(n=a-i)?0:(s=e===a?bxb(60*(t-r),n):t===a?120+bxb(60*(r-e),n):240+bxb(60*(e-t),n))<0?s+360:s}function kxb(e,t,r){var i,a;return 0===e?t:0===t?e:(0===(a=((i=1024-r)*(e>>>16&255)+r*(t>>>16&255)>>10<<16)+(i*(e>>>8&255)+r*(t>>>8&255)>>10<<8)+(i*(255&e)+r*(255&t)>>10))&&(a=1),a)}function lxb(e,t,r,i,a){var s,n,o,u,l,c,h;return(u=t>>>10)<-1||i<=u||(c=r>>>10)<-1||a<=c?0:(l=1023&t,-1===u&&(l=u=0),u===i-1&&(l=0),h=1023&r,-1===c&&(h=c=0),c===a-1&&(h=0),o=16777215&e[n=c*i+u],0>>16&255,i+=h>>>8&255,e+=255&h,++o);c=0===o?0:(bxb(f,o)<<16)+(bxb(i,o)<<8)+bxb(e,o),u[m*p+b]=c}return dxb.pop(3),0}function nxb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b;if(n=dxb.stackValue(2),c=dxb.stackValue(1),p=dxb.stackIntegerValue(0),s=hxb(n),b=axb(n),l=hxb(c),dxb.success(axb(c)===b),dxb.failed())return null;for(a=0;a<=b-1;a++)0!=(h=16777215&s[a])&&((o=u=f=h>>>16&255)<(r=h>>>8&255)&&(o=r),o<(e=255&h)&&(o=e),r=n>>1),dxb.failed())return null;for(a=s.wordsAsInt16Array(),e=t.wordsAsInt16Array(),i&&o++,r=1;r<=n;r++)e[u++]=a[o],o+=2;return dxb.pop(3),0}function rxb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k;if(o=dxb.stackValue(3),l=dxb.stackValue(2),v=dxb.stackIntegerValue(1),h=dxb.stackIntegerValue(0),n=hxb(o),u=hxb(l),m=axb(o),dxb.success(axb(l)===m),dxb.failed())return null;for(s=bxb(m,v),t=v>>1,r=(s=bxb(m,v))>>1,d=h/100,g=0;g<=v-1;g++)for(k=0;k<=s-1;k++)i=(g-t)/t,a=(k-r)/r,b=(f=Math.pow(Math.sqrt(i*i+a*a),d))<=1?(e=Math.atan2(a,i),p=1024*(t+f*Math.cos(e)*t)|0,1024*(r+f*Math.sin(e)*r)|0):(p=1024*g,1024*k),c=lxb(n,p,b,v,s),u[k*v+g]=c;return dxb.pop(4),0}function sxb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k;if(o=hxb(dxb.stackValue(11)),l=dxb.stackIntegerValue(10),u=dxb.stackIntegerValue(9),c=hxb(dxb.stackValue(8)),f=dxb.stackIntegerValue(7),h=dxb.stackIntegerValue(6),m=dxb.stackIntegerValue(5),v=dxb.stackIntegerValue(4),a=dxb.stackIntegerValue(3),s=dxb.stackIntegerValue(2),i=dxb.stackIntegerValue(1),t=dxb.stackIntegerValue(0),dxb.success(0<=m&&0<=v),dxb.success(m+2*i<=l),dxb.success(v+2*t<=u),dxb.success(0<=a&&0<=s),dxb.success(a+i<=f),dxb.success(s+t<=h),dxb.failed())return null;for(k=0;k<=t-1;k++)for(b=l*(v+2*k)+m,r=f*(s+k)+a,g=0;g<=i-1;g++)p=16711680&(d=o[b]),n=65280&d,e=255&d,p+=16711680&(d=o[b+1]),n+=65280&d,e+=255&d,p+=16711680&(d=o[b+l]),n+=65280&d,e+=255&d,p+=16711680&(d=o[b+l+1]),n+=65280&d,e+=255&d,c[r]=p>>>2&16711680|n>>>2&65280|e>>>2,b+=2,++r;return dxb.pop(12),0}function txb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_;if(o=hxb(dxb.stackValue(11)),l=dxb.stackIntegerValue(10),u=dxb.stackIntegerValue(9),c=hxb(dxb.stackValue(8)),f=dxb.stackIntegerValue(7),h=dxb.stackIntegerValue(6),v=dxb.stackIntegerValue(5),g=dxb.stackIntegerValue(4),a=dxb.stackIntegerValue(3),s=dxb.stackIntegerValue(2),i=dxb.stackIntegerValue(1),t=dxb.stackIntegerValue(0),dxb.success(0<=v&&0<=g),dxb.success(v+2*i<=l),dxb.success(g+2*t<=u),dxb.success(0<=a&&0<=s),dxb.success(a+i<=f),dxb.success(s+t<=h),dxb.failed())return null;for(_=0;_<=t-1;_++)for(m=l*(g+2*_)+v,r=f*(s+_)+a,k=0;k<=i-1;k++)b=(16711680&(d=o[m]))+(16711680&(p=o[m+l+1]))>>>1&16711680,n=(65280&d)+(65280&p)>>>1&65280,e=(255&d)+(255&p)>>>1,c[r]=n|e|b,m+=2,++r;return dxb.pop(12),0}function uxb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p;if(s=dxb.stackValue(2),l=dxb.stackValue(1),d=dxb.stackIntegerValue(0),a=hxb(s),p=axb(s),u=hxb(l),dxb.success(axb(l)===p),dxb.failed())return null;for(i=0;i<=p-1;i++)0!=(c=16777215&a[i])&&((n=o=h=c>>>16&255)<(r=c>>>8&255)&&(n=r),n<(e=255&c)&&(n=e),r>>16&255)<(r=c>>>8&255)&&(n=r),n<(e=255&c)&&(n=e),r>>10)*i+(a>>>10)],p=a>>>10>>10>>10>>16&255)+_*(p>>>16&255)+S*(b>>>16&255)+y*(m>>>16&255))>>>20&255)<<16,l|=((v=k*(d>>>8&255)+_*(p>>>8&255)+S*(b>>>8&255)+y*(m>>>8&255))>>>20&255)<<8,0===(l|=(v=k*(255&d)+_*(255&p)+S*(255&b)+y*(255&m))>>>20&255)&&(l=1)),n[f*c+h]=l,a+=I;s+=O}return dxb.pop(6),0}function yxb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S,y,I,O,w,F,C,x,A,P,$,V,Y;if(g=dxb.stackValue(5),y=dxb.stackValue(4),$=dxb.stackIntegerValue(3),v=hxb(g),S=hxb(y),r=axb(g),F=dxb.stackIntegerValue(2),e=dxb.stackValue(1),i=dxb.stackValue(0),t=gxb(e),a=gxb(i),dxb.success(axb(y)===r),dxb.failed())return null;for(b=bxb(r,$),s=cxb(Math.random(),F)-1,C=0;C<=s/2-1;C++)for(V=cxb(Math.random(),$),Y=cxb(Math.random(),b),O=cxb(Math.random(),8),d=-4;d<=4;d++)for(p=-4;p<=4;p++)(o=d*d+p*p)<25&&0>1)<(r=(l=bxb(_,y))>>1)?(v=r/(b=t),1):(v=1,(b=r)=_wb}function SocketPlugin(){return{getModuleName:function(){return"SocketPlugin (http-only)"},interpreterProxy:null,primHandler:null,handleCounter:0,needProxy:new Set,status:0,lookupCache:{localhost:{address:[127,0,0,1],validUntil:Number.MAX_SAFE_INTEGER}},lastLookup:null,lookupSemaIdx:0,TCP_Socket_Type:0,Resolver_Uninitialized:0,Resolver_Ready:1,Resolver_Busy:2,Resolver_Error:3,Socket_InvalidSocket:-1,Socket_Unconnected:0,Socket_WaitingForConnection:1,Socket_Connected:2,Socket_OtherEndClosed:3,Socket_ThisEndClosed:4,setInterpreter:function(e){return this.interpreterProxy=e,this.primHandler=this.interpreterProxy.vm.primHandler,!0},_signalSemaphore:function(e){e<=0||this.primHandler.signalSemaphoreWithIndex(e)},_signalLookupSemaphore:function(){this._signalSemaphore(this.lookupSemaIdx)},_getAddressFromLookupCache:function(e,t){if(e){if(e.match(/^\d+\.\d+\.\d+\.\d+$/)){var r=e.split(".").map(function(e){return+e});if(r.every(function(e){return e<=255}))return new Uint8Array(r)}var i=this.lookupCache[e];if(i&&(t||i.validUntil>=Date.now()))return new Uint8Array(i.address)}return null},_addAddressFromResponseToLookupCache:function(e){if(e&&0===e.Status&&e.Question&&e.Answer){var t=function(e,t){e[t]&&e[t].replace&&(e[t]=e[t].replace(/\.$/,""))},r=e.Question[0];t(r,"name"),e.Answer.forEach(function(e){t(e,"name"),t(e,"data")});var i=r.name,a=null,s=86400;e.Answer.some(function(e){if(e.name===i){if(e.TTL&&(s=Math.min(s,e.TTL)),1===e.type)return a=e.data.split(".").map(function(e){return+e}),!0;5===e.type&&(i=e.data)}return!1})&&(this.lookupCache[r.name]={address:a,validUntil:Date.now()+1e3*s})}},_compareAddresses:function(e,r){return e.every(function(e,t){return r[t]===e})},_reverseLookupNameForAddress:function(t){var r=this,i=null;return Object.keys(this.lookupCache).some(function(e){return!!r._compareAddresses(t,r.lookupCache[e].address)&&(i=e,!0)}),i||t.join(".")},_newSocketHandle:function(e,t,r,i){var c=this;return{hostAddress:null,host:null,port:null,connSemaIndex:t,readSemaIndex:r,writeSemaIndex:i,webSocket:null,sendBuffer:null,sendTimeout:null,response:null,responseReadUntil:0,responseReceived:!1,status:c.Socket_Unconnected,_signalConnSemaphore:function(){c._signalSemaphore(this.connSemaIndex)},_signalReadSemaphore:function(){c._signalSemaphore(this.readSemaIndex)},_signalWriteSemaphore:function(){c._signalSemaphore(this.writeSemaIndex)},_otherEndClosed:function(){this.status=c.Socket_OtherEndClosed,this.webSocket=null,this._signalConnSemaphore()},_hostAndPort:function(){return this.host+":"+this.port},_requestNeedsProxy:function(){return c.needProxy.has(this._hostAndPort())},_getURL:function(e,t){var r="";(t||this._requestNeedsProxy())&&(r="object"==typeof SqueakJS&&SqueakJS.options.proxy||"https://corsproxy.io/?");return 443!==this.port?r+="http://"+this._hostAndPort()+e:r+="https://"+this.host+e,r},_performRequest:function(){if(this.webSocket)this._performWebSocketSend();else{var e=new TextDecoder("utf-8").decode(this.sendBuffer),t=this.sendBuffer.findIndex(function(e,t,r){return"\r"===r[t]&&"\r"===r[t+2]&&"\n"===r[t+1]&&"\n"===r[t+3]});this.sendBuffer=0<=t?this.sendBuffer.subarray(t+4):null;var r=e.split("\r\n\r\n")[0].split("\n"),i=r[0].split(" "),a=i[0];if("GET"!==a&&"PUT"!==a&&"POST"!==a)return this._otherEndClosed(),-1;for(var s=i[1],n=!1,o=!1,u=null,l=1;l>>8,n[3]=255&e.length,4):127===i?(n[2]=e.length>>>56,n[3]=e.length>>>48&255,n[4]=e.length>>>40&255,n[5]=e.length>>>32&255,n[6]=e.length>>>24&255,n[7]=e.length>>>16&255,n[8]=e.length>>>8&255,n[9]=255&e.length,10):2;var o=new Uint8Array(4);n.set(o,s),s+=4;var u=e;n.set(u,s),e=n}this.response&&this.response.length?this.response.push(e):this.response=[e],this.responseReceived=!0,this._signalReadSemaphore()},_performWebSocketSend:function(){var e,t=15&this.sendBuffer[0];if(0==t)return console.error("No support for WebSocket frame continuation yet!"),!0;if(1==t)e=!1;else{if(2!=t)return 8==t?(this.webSocket.close(),void(this.webSocket=null)):9==t||10==t?void 0:void console.error("Unsupported WebSocket frame opcode "+t);e=!0}var r,i,a=this.sendBuffer[1],s=a>>>7,n=127&a;r=126===n?(n=this.sendBuffer[2]<<8|this.sendBuffer[3],4):127===n?(n=this.sendBuffer[2]<<56|this.sendBuffer[3]<<48|this.sendBuffer[4]<<40|this.sendBuffer[5]<<32|this.sendBuffer[6]<<24|this.sendBuffer[7]<<16|this.sendBuffer[8]<<8|this.sendBuffer[9],10):2,s&&(i=this.sendBuffer.subarray(r,r+4),r+=4);var o,u=this.sendBuffer.subarray(r,r+n);r+=n,s&&(u=u.map(function(e,t){return e^i[3&t]})),o=e?u:Squeak.bytesAsString(u),this.sendBuffer=this.sendBuffer.subarray(r),this.webSocket.send(o),0e){var r=t.subarray(e);r?this.response[0]=r:this.response.shift(),t=t.subarray(0,e)}else this.response.shift();return this.responseReceived&&0===this.response.length&&!this.webSocket&&(this.responseSentCompletly=!0),t},send:function(e,t,r){null!==this.sendTimeout&&self.clearTimeout(this.sendTimeout),this.lastSend=Date.now();var i=e.bytes.subarray(t,r);if(null===this.sendBuffer)this.sendBuffer=i.slice();else{var a=this.sendBuffer.byteLength+i.byteLength,s=new Uint8Array(a);s.set(this.sendBuffer,0),s.set(i,this.sendBuffer.byteLength),this.sendBuffer=s}return this.sendTimeout=self.setTimeout(this._performRequest.bind(this),50),i.byteLength}}},primitiveHasSocketAccess:function(e){return this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.trueObject()),!0},primitiveInitializeNetwork:function(e){return 1===e&&(this.lookupSemaIdx=this.interpreterProxy.stackIntegerValue(0),this.status=this.Resolver_Ready,this.interpreterProxy.pop(e),!0)},primitiveResolverNameLookupResult:function(e){if(0!==e)return!1;if(!this.lastLookup||!this.lastLookup.substr)return this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0;var t=this._getAddressFromLookupCache(this.lastLookup,!0);return this.interpreterProxy.popthenPush(e+1,t?this.primHandler.makeStByteArray(t):this.interpreterProxy.nilObject()),!0},primitiveResolverStartNameLookup:function(e){if(1!==e)return!1;var t=this.lastLookup=this.interpreterProxy.stackValue(0).bytesAsString();if(this._getAddressFromLookupCache(t,!1))this.status=this.Resolver_Ready,this._signalLookupSemaphore();else{var r="https://9.9.9.9:5053/dns-query?name="+encodeURIComponent(this.lastLookup)+"&type=A",i=!1;if(self.fetch){var a=this;self.fetch(r,{method:"GET",mode:"cors",credentials:"omit",cache:"no-store",referrer:"no-referrer",referrerPolicy:"no-referrer"}).then(function(e){return e.json()}).then(function(e){a._addAddressFromResponseToLookupCache(e)}).catch(function(e){console.error("Name lookup failed",e)}).then(function(){t===a.lastLookup&&(a.status=a.Resolver_Ready,a._signalLookupSemaphore())}),i=!0}else{a=this;var s=function(){t===a.lastLookup&&(a.status=a.Resolver_Ready,a._signalLookupSemaphore())},n=new XMLHttpRequest;n.open("GET",r,!0),n.timeout=2e3,n.responseType="json",n.onload=function(e){a._addAddressFromResponseToLookupCache(this.response),s()},n.onerror=function(){console.error("Name lookup failed",n.statusText),s()},n.send(),i=!0}i&&(this.status=this.Resolver_Busy,this._signalLookupSemaphore())}return this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0},primitiveResolverAddressLookupResult:function(e){if(0!==e)return!1;if(!this.lastLookup||!this.lastLookup.every)return this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0;var t=this._reverseLookupNameForAddress(this.lastLookup),r=this.primHandler.makeStString(t);return this.interpreterProxy.popthenPush(e+1,r),!0},primitiveResolverStartAddressLookup:function(e){return 1===e&&(this.lastLookup=this.interpreterProxy.stackBytes(0),this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),this.status=this.Resolver_Ready,this._signalLookupSemaphore(),!0)},primitiveResolverStatus:function(e){return 0===e&&(this.interpreterProxy.popthenPush(e+1,this.status),!0)},primitiveResolverAbortLookup:function(e){return 0===e&&(this.lastLookup=null,this.status=this.Resolver_Ready,this._signalLookupSemaphore(),this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0)},primitiveSocketRemoteAddress:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;return void 0!==t&&(this.interpreterProxy.popthenPush(e+1,t.hostAddress?this.primHandler.makeStByteArray(t.hostAddress):this.interpreterProxy.nilObject()),!0)},primitiveSocketRemotePort:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;return void 0!==t&&(this.interpreterProxy.popthenPush(e+1,t.port),!0)},primitiveSocketConnectionStatus:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;if(void 0===t)return!1;var r=t.status;return void 0===r&&(r=this.Socket_InvalidSocket),this.interpreterProxy.popthenPush(e+1,r),!0},primitiveSocketConnectToPort:function(e){if(3!==e)return!1;var t=this.interpreterProxy.stackObjectValue(2).handle;if(void 0===t)return!1;var r=this.interpreterProxy.stackBytes(1),i=this.interpreterProxy.stackIntegerValue(0);return t.connect(r,i),this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0},primitiveSocketCloseConnection:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;return void 0!==t&&(t.close(),this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0)},primitiveSocketCreate3Semaphores:function(e){if(7!==e)return!1;var t=this.interpreterProxy.stackIntegerValue(0),r=this.interpreterProxy.stackIntegerValue(1),i=this.interpreterProxy.stackIntegerValue(2),a=this.interpreterProxy.stackIntegerValue(3);if(this.interpreterProxy.stackIntegerValue(5)!==this.TCP_Socket_Type)return!1;var s="{SqueakJS Socket #"+ ++this.handleCounter+"}",n=this.primHandler.makeStString(s);return n.handle=this._newSocketHandle(a,i,r,t),this.interpreterProxy.popthenPush(e+1,n),!0},primitiveSocketDestroy:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;return void 0!==t&&(t.destroy(),this.interpreterProxy.popthenPush(e+1,t.status),!0)},primitiveSocketReceiveDataAvailable:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;if(void 0===t)return!1;var r=this.interpreterProxy.falseObject();return t.dataAvailable()&&(r=this.interpreterProxy.trueObject()),this.interpreterProxy.popthenPush(e+1,r),!0},primitiveSocketReceiveDataBufCount:function(e){if(4!==e)return!1;var t=this.interpreterProxy.stackObjectValue(3).handle;if(void 0===t)return!1;var r=this.interpreterProxy.stackObjectValue(2),i=this.interpreterProxy.stackIntegerValue(1)-1,a=this.interpreterProxy.stackIntegerValue(0);if(i+a>r.bytes.length)return!1;var s=t.recv(a);return r.bytes.set(s,i),this.interpreterProxy.popthenPush(e+1,s.length),!0},primitiveSocketSendDataBufCount:function(e){if(4!==e)return!1;var t=this.interpreterProxy.stackObjectValue(3).handle;if(void 0===t)return!1;var r=this.interpreterProxy.stackObjectValue(2),i=this.interpreterProxy.stackIntegerValue(1)-1;if(i<0)return!1;var a=i+this.interpreterProxy.stackIntegerValue(0);if(a>r.length)return!1;var s=t.send(r,i,a);return this.interpreterProxy.popthenPush(e+1,s),!0},primitiveSocketSendDone:function(e){return 1===e&&(this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.trueObject()),!0)},primitiveSocketListenWithOrWithoutBacklog:function(e){return!(e<2)&&(this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0)}}}function registerSocketPlugin(){"object"==typeof Squeak&&Squeak.registerExternalModule?Squeak.registerExternalModule("SocketPlugin",SocketPlugin()):self.setTimeout(registerSocketPlugin,100)}function SpeechPlugin(){return{getModuleName:function(){return"SpeechPlugin"},interpreterProxy:null,primHandler:null,voiceInput:null,semaphoreIndex:null,shouldListen:!1,recognition:null,synth:self.speechSynthesis,setInterpreter:function(e){return this.interpreterProxy=e,this.primHandler=this.interpreterProxy.vm.primHandler,!0},primitiveSpeak:function(e){var t,r;if(1===e)t=this.interpreterProxy.stackValue(0).bytesAsString();else{if(2!==e)return!1;t=this.interpreterProxy.stackValue(1).bytesAsString();var i=this.interpreterProxy.stackValue(0).bytesAsString();r=this.synth.getVoices().filter(function(e){return e.name===i})}var a=new SpeechSynthesisUtterance(t);return r&&0>15))&&(u=32767),u<-32767&&(u=-32767),t[o-1]=u,p[f-1]=u,32767<(u=t[++o-1]+(s>>15))&&(u=32767),u<-32767&&(u=-32767),t[o-1]=u,b[f-1]=u,f=WHb(f,d)+1}if(_Hb.failed())return null;_Hb.storeIntegerofObjectwithValue(11,e,f),_Hb.pop(3)}function dIb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S,y,I;if(e=_Hb.stackValue(5),t=_Hb.stackIntegerValue(4),r=_Hb.stackInt16Array(3),i=_Hb.stackIntegerValue(2),a=_Hb.stackIntegerValue(1),s=_Hb.stackIntegerValue(0),k=_Hb.fetchIntegerofObject(3,e),_=_Hb.fetchIntegerofObject(4,e),S=_Hb.fetchIntegerofObject(5,e),d=_Hb.fetchIntegerofObject(7,e),I=_Hb.fetchInt16ArrayofObject(8,e),y=_Hb.fetchIntegerofObject(9,e),b=_Hb.fetchIntegerofObject(10,e),m=_Hb.fetchIntegerofObject(11,e),p=_Hb.fetchIntegerofObject(14,e),v=_Hb.fetchIntegerofObject(15,e),g=_Hb.fetchIntegerofObject(16,e),_Hb.failed())return null;for(n=0!==p&&0!==g,u=i+t-1,f=i;f<=u;f++)h=k*I[b>>15]>>15,n?(l=p*I[v>>15],(v=WHb(v+g,y))<0&&(v+=y),(b=WHb(b+m+l,y))<0&&(b+=y)):b=WHb(b+m,y),0>15))&&(c=32767),c<-32767&&(c=-32767),r[o-1]=c),0>15))&&(c=32767),c<-32767&&(c=-32767),r[o-1]=c),0!==_&&(k+=_,(0<_&&S<=k||_<0&&k<=S)&&(k=S,_=0));if(d-=t,_Hb.failed())return null;_Hb.storeIntegerofObjectwithValue(3,e,k),_Hb.storeIntegerofObjectwithValue(4,e,_),_Hb.storeIntegerofObjectwithValue(7,e,d),_Hb.storeIntegerofObjectwithValue(10,e,b),_Hb.storeIntegerofObjectwithValue(15,e,v),_Hb.pop(5)}function eIb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S,y,I,O,w,F,C,x,A;if(e=_Hb.stackValue(5),t=_Hb.stackIntegerValue(4),r=_Hb.stackInt16Array(3),i=_Hb.stackIntegerValue(2),a=_Hb.stackIntegerValue(1),s=_Hb.stackIntegerValue(0),C=_Hb.fetchIntegerofObject(3,e),x=_Hb.fetchIntegerofObject(4,e),A=_Hb.fetchIntegerofObject(5,e),g=_Hb.fetchIntegerofObject(7,e),y=_Hb.fetchIntegerofObject(8,e),_=_Hb.fetchInt16ArrayofObject(10,e),I=_Hb.fetchInt16ArrayofObject(11,e),k=_Hb.fetchIntegerofObject(16,e),S=_Hb.fetchIntegerofObject(17,e),F=_Hb.fetchIntegerofObject(18,e),O=_Hb.fetchIntegerofObject(19,e),w=_Hb.fetchIntegerofObject(20,e),_Hb.failed())return null;for(l=_!==I,n=a*C>>15,o=s*C>>15,u=2*i-1,c=i+t-1,v=i;v<=c;v++){if(S<(m=(O+=w)>>9)&&y>9),(d=m+1)>k){if(k>9)}f=O&XHb,p=h=_[m-1]*(YHb-f)+_[d-1]*f>>9,l&&(p=I[m-1]*(YHb-f)+I[d-1]*f>>9),0>15))&&(b=32767),b<-32767&&(b=-32767),r[u-1]=b),++u,0>15))&&(b=32767),b<-32767&&(b=-32767),r[u-1]=b),++u,0!==x&&(C+=x,(0>15,o=s*C>>15)}if(g-=t,_Hb.failed())return null;_Hb.storeIntegerofObjectwithValue(3,e,C),_Hb.storeIntegerofObjectwithValue(4,e,x),_Hb.storeIntegerofObjectwithValue(7,e,g),_Hb.storeIntegerofObjectwithValue(19,e,O),_Hb.pop(5)}function fIb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S;if(e=_Hb.stackValue(5),t=_Hb.stackIntegerValue(4),r=_Hb.stackInt16Array(3),i=_Hb.stackIntegerValue(2),a=_Hb.stackIntegerValue(1),s=_Hb.stackIntegerValue(0),k=_Hb.fetchIntegerofObject(3,e),_=_Hb.fetchIntegerofObject(4,e),S=_Hb.fetchIntegerofObject(5,e),p=_Hb.fetchIntegerofObject(7,e),b=_Hb.fetchInt16ArrayofObject(8,e),m=_Hb.fetchIntegerofObject(9,e),v=_Hb.fetchIntegerofObject(10,e),g=_Hb.fetchIntegerofObject(11,e),_Hb.failed())return null;for(u=i+t-1,f=h=m,d=i;d<=u;d++)g<=(h=f+v)&&(h=ZHb+(h-g)),n=b[(f>>15)-1]+b[(h>>15)-1]>>1,c=(b[(f>>15)-1]=n)*k>>15,f=h,0>15))&&(l=32767),l<-32767&&(l=-32767),r[o-1]=l),0>15))&&(l=32767),l<-32767&&(l=-32767),r[o-1]=l),0!==_&&(k+=_,(0<_&&S<=k||_<0&&k<=S)&&(k=S,_=0));if(m=h,p-=t,_Hb.failed())return null;_Hb.storeIntegerofObjectwithValue(3,e,k),_Hb.storeIntegerofObjectwithValue(4,e,_),_Hb.storeIntegerofObjectwithValue(7,e,p),_Hb.storeIntegerofObjectwithValue(9,e,m),_Hb.pop(5)}function gIb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S;if(e=_Hb.stackValue(5),t=_Hb.stackIntegerValue(4),r=_Hb.stackInt16Array(3),i=_Hb.stackIntegerValue(2),a=_Hb.stackIntegerValue(1),s=_Hb.stackIntegerValue(0),k=_Hb.fetchIntegerofObject(3,e),_=_Hb.fetchIntegerofObject(4,e),S=_Hb.fetchIntegerofObject(5,e),d=_Hb.fetchIntegerofObject(7,e),b=_Hb.fetchInt16ArrayofObject(8,e),m=_Hb.fetchIntegerofObject(10,e),g=_Hb.fetchIntegerofObject(11,e),p=_Hb.fetchIntegerofObject(12,e),v=_Hb.fetchIntegerofObject(13,e),_Hb.failed())return null;for(o=i+t-1,u=i,f=p+(g>>>16);f<=m&&u<=o;)h=b[f-1]*k>>15,0>15))&&(c=32767),c<-32767&&(c=-32767),r[n-1]=c),0>15))&&(c=32767),c<-32767&&(c=-32767),r[n-1]=c),0!==_&&(k+=_,(0<_&&S<=k||_<0&&k<=S)&&(k=S,_=0)),$Hb<=(g+=v)&&(p+=l=g>>>16,g-=l<<16),f=p+(g>>>16),++u;if(d-=t,_Hb.failed())return null;_Hb.storeIntegerofObjectwithValue(3,e,k),_Hb.storeIntegerofObjectwithValue(4,e,_),_Hb.storeIntegerofObjectwithValue(7,e,d),_Hb.storeIntegerofObjectwithValue(11,e,g),_Hb.storeIntegerofObjectwithValue(12,e,p),_Hb.pop(5)}function hIb(e){return!1!=((_Hb=e).majorVersion()==THb)&&_Hb.minorVersion()>=UHb}function BKb(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function CKb(e,t){return 0|Math.floor(e/t)}function GKb(e){return EKb.success(EKb.isWords(e)),EKb.failed()?0:e.words}function HKb(){return FKb}function IKb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v;if(l=EKb.stackValue(4),i=EKb.stackValue(3),d=EKb.stackIntegerValue(2),n=EKb.stackIntegerValue(1),t=EKb.stackIntegerValue(0),u=GKb(l),r=GKb(i),EKb.success(BKb(l)===BKb(i)),EKb.success(BKb(l)===d*n),EKb.failed())return null;for(e=(2*t+1)*(2*t+1),m=0;m<=n-1;m++)for((h=m-t)<0&&(h=0),n<=(s=m+t)&&(s=n-1),p=0;p<=d-1;p++){for((c=p-t)<0&&(c=0),d<=(a=p+t)&&(a=d-1),f=0,v=h;v<=s;v++)for(o=v*d,b=c;b<=a;b++)f+=u[o+b];r[m*d+p]=CKb(f,e)}EKb.pop(5)}function JKb(){var e,t,r,i,a;if(r=EKb.stackValue(1),i=EKb.stackIntegerValue(0),t=GKb(r),a=BKb(r),EKb.failed())return null;for(e=0;e<=a-1;e++)t[e]=t[e]*i>>>10;EKb.pop(2)}function KKb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k;if(p=EKb.stackValue(6),r=EKb.stackValue(5),b=EKb.stackIntegerValue(4),i=EKb.stackIntegerValue(3),n=EKb.stackIntegerValue(2),u=EKb.stackIntegerValue(1),h=EKb.stackIntegerValue(0),f=GKb(p),e=GKb(r),EKb.success(BKb(r)===b*i),EKb.success(BKb(r)===BKb(p)*n*n),EKb.failed())return null;for((l=0)<(4&u)&&(l+=65536),0<(2&u)&&(l+=256),0<(1&u)&&++l,d=-1,v=0;v<=CKb(i,n)-1;v++)for(m=0;m<=CKb(b,n)-1;m++)for(g=f[++d],255<(a=(k=h)<0?k<-31?0:g>>>0-k:31=AKb}function LLb(e){return"number"==typeof e?bMb.classSmallInteger():e.sqClass}function MLb(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function NLb(e){return e.bytes?e.bytes.length:e.words?4*e.words.length:0}function PLb(e,t){return e-(r=e,i=t,(0|Math.floor(r/i))*t)|0;var r,i}function QLb(e,t){return 31>>7)],qMb[r]++,++DMb,++zMb===BMb||0==(4095&zMb)&&dNb()}function RMb(e,t,r,i,a){var s,n,o,u,l,c,h;if(h=t<<16|r,XLb<=t)return h;if(!(0<(o=e-(c=uMb[fNb(e+YLb-1)]))&&o>2t))return bMb.primitiveFail();for(hMb|=QLb(t,iMb),iMb+=e;8<=iMb&&FMb>>=8,iMb-=8}function XMb(){var e,t,r,i,a;return 3!==bMb.methodArgumentCount()?bMb.primitiveFail():(t=bMb.stackIntegerValue(0),e=bMb.stackIntegerValue(1),r=bMb.stackIntegerValue(2),i=bMb.stackObjectValue(3),bMb.failed()?null:function(e){var t;if(bMb.isPointers(e)&&15<=MLb(e)&&(t=bMb.fetchPointerofObject(0,e),bMb.isBytes(t))){if(0===eMb){if(!OMb(e))return;if(MLb(e)=BMb&&(rMb=t.words,t=bMb.fetchPointerofObject(eMb+7,e),bMb.isWords(t)&&MLb(t)===WLb&&(AMb=t.words,t=bMb.fetchPointerofObject(eMb+8,e),bMb.isWords(t)&&MLb(t)===VLb))))))return qMb=t.words,zMb=bMb.fetchIntegerofObject(eMb+9,e),DMb=bMb.fetchIntegerofObject(eMb+10,e),!bMb.failed()}}(i)?(a=function(e,t,r){var i,a,s,n,o,u,l,c,h;if(e>>16),h=65535&(l=RMb(s+1,n,o,t,r)),(c=l>>>16)<=n&&YLb<=n){for(i=QMb(n,s-o),u=1;u<=n-1;u++)TMb(++s);a=!1,++s}else i=PMb(kMb[s]),++s<=e&&!i&&(TMb(s),a=!0,o=h,n=c);if(i)return jMb=s,!0}return jMb=s,!1}(r,e,t),bMb.failed()||(bMb.storeIntegerofObjectwithValue(eMb+2,i,wMb),bMb.storeIntegerofObjectwithValue(eMb+3,i,jMb),bMb.storeIntegerofObjectwithValue(eMb+9,i,zMb),bMb.storeIntegerofObjectwithValue(eMb+10,i,DMb)),void(bMb.failed()||(bMb.pop(4),bMb.pushBool(a)))):bMb.primitiveFail())}function YMb(){var e,t,r,i,a,s;if(2!==bMb.methodArgumentCount())return bMb.primitiveFail();if(e=bMb.stackIntegerValue(0),i=bMb.stackObjectValue(1),bMb.failed())return null;if(!bMb.isWords(i))return bMb.primitiveFail();for(s=MLb(i),a=i.wordsAsInt32Array(),r=0;r<=s-1;r++)t=a[r],a[r]=e<=t?t-e:0;bMb.pop(2)}function ZMb(){var e,t;if(2!==bMb.methodArgumentCount())return bMb.primitiveFail();if(e=bMb.stackValue(0),!bMb.isWords(e))return bMb.primitiveFail();if(nMb=e.words,oMb=MLb(e),e=bMb.stackValue(1),!bMb.isWords(e))return bMb.primitiveFail();if(xMb=e.words,yMb=MLb(e),t=bMb.stackValue(2),!bMb.isPointers(t))return bMb.primitiveFail();if(0===dMb){if(!function(e){var t;for(t=LLb(e);!t.isNil&&13<=t.classInstSize();)t=t.superclass();return!t.isNil&&(dMb=t.classInstSize(),1)}(t))return bMb.primitiveFail();if(MLb(t)>>16)-1)&&(a+=iNb(r)),c=gNb(nMb,oMb),e=65535&c,0<(r=c>>>16)&&(e+=iNb(r)),s<=GMb+a)return hMb=o,iMb=n,JMb=u;for(l=(t=GMb)-e,i=1;i<=a;i++)kMb[t+i]=kMb[l+i];GMb+=a}}(),void(bMb.failed()||(bMb.storeIntegerofObjectwithValue(2,t,GMb+1),bMb.storeIntegerofObjectwithValue(dMb+0,t,KMb),bMb.storeIntegerofObjectwithValue(dMb+1,t,hMb),bMb.storeIntegerofObjectwithValue(dMb+2,t,iMb),bMb.storeIntegerofObjectwithValue(dMb+4,t,JMb+1),bMb.pop(2)))):bMb.primitiveFail()):bMb.primitiveFail()))}function $Mb(){var e,t,r,i,a,s,n,o;if(4!==bMb.methodArgumentCount())return bMb.primitiveFail();if(r=bMb.stackObjectValue(0),o=bMb.stackIntegerValue(1),n=bMb.stackIntegerValue(2),e=bMb.positive32BitValueOf(bMb.stackValue(3)),bMb.failed())return 0;if(!(bMb.isBytes(r)&&n<=o&&0>>16&65535,i=--n;i<=o;i++)a=PLb(a+t[i],65521),s=PLb(s+a,65521);e=(s<<16)+a,bMb.popthenPush(5,bMb.positive32BitIntegerFor(e))}function _Mb(){var e,t,r,i,a,s;if(4!==bMb.methodArgumentCount())return bMb.primitiveFail();if(t=bMb.stackObjectValue(0),s=bMb.stackIntegerValue(1),a=bMb.stackIntegerValue(2),r=bMb.positive32BitValueOf(bMb.stackValue(3)),bMb.failed())return 0;if(!(bMb.isBytes(t)&&a<=s&&0>>8;bMb.popthenPush(5,bMb.positive32BitIntegerFor(r))}function aNb(){var e,t,r,i,a,s;return 4!==bMb.methodArgumentCount()?bMb.primitiveFail():(t=bMb.stackObjectValue(0),i=bMb.stackObjectValue(1),e=bMb.stackObjectValue(2),r=bMb.stackObjectValue(3),a=bMb.stackObjectValue(4),bMb.failed()?null:function(e){var t;if(0===eMb){if(!OMb(e))return;if(MLb(e)=eMb+3&&(t=bMb.fetchPointerofObject(0,e),bMb.isBytes(t)?(kMb=t.bytes,lMb=NLb(t),FMb=bMb.fetchIntegerofObject(1,e),GMb=bMb.fetchIntegerofObject(2,e),hMb=bMb.fetchIntegerofObject(eMb+0,e),iMb=bMb.fetchIntegerofObject(eMb+1,e),!bMb.failed()):bMb.primitiveFail())}(a)&&bMb.isPointers(t)&&2<=MLb(t)&&bMb.isPointers(i)&&2<=MLb(i)&&bMb.isPointers(r)&&3<=MLb(r)&&bMb.isPointers(e)&&3<=MLb(e)?(s=function(e,t,r,i){var a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k;if(g=bMb.fetchPointerofObject(0,e),b=bMb.fetchIntegerofObject(1,e),p=bMb.fetchIntegerofObject(2,e),!(b<=p&&bMb.isBytes(g)&&p<=NLb(g)))return bMb.primitiveFail();if(f=g.bytes,g=bMb.fetchPointerofObject(0,t),!(bMb.isWords(g)&&p<=MLb(g)&&bMb.fetchIntegerofObject(1,t)===b&&bMb.fetchIntegerofObject(2,t)===p))return bMb.primitiveFail();if(n=g.words,g=bMb.fetchPointerofObject(0,r),!bMb.isWords(g))return bMb.primitiveFail();if(d=MLb(g),m=g.words,g=bMb.fetchPointerofObject(1,r),!bMb.isWords(g)||d!==MLb(g))return bMb.primitiveFail();if(v=g.words,g=bMb.fetchPointerofObject(0,i),!bMb.isWords(g))return bMb.primitiveFail();if(u=MLb(g),o=g.words,g=bMb.fetchPointerofObject(1,i),!bMb.isWords(g)||u!==MLb(g))return bMb.primitiveFail();l=g.words,WMb(0,0),k=0;for(;b>>7)])=KLb}function dNb(){var e;return zMb===BMb||0==(4095&zMb)&&(!(10*DMb<=zMb)&&(!((e=zMb-DMb)<=DMb)&&4*e<=DMb))}function fNb(e){return t=kMb[e],(wMb<<5^t)&SLb;var t}function gNb(e,t){var r,i,a,s;if(r=e[0]>>>24,_Lb>>24&255))return bMb.primitiveFail(),0}return 0}function iNb(e){for(var t,r,i,a;iMb>>a,iMb-=e,t}Object.extend||(Object.extend=function(e){for(var t=1;t>0)+t:[e,t]}}),Object.subclass("Squeak.Object","initialization",{initInstanceOf:function(e,t,r,i){this.sqClass=e,this.hash=r;var a=e.pointers[Squeak.Class_format],s=(a>>1&63)+(a>>10&192)-1;this._format=a>>7&15,this._format<8?6!=this._format?0>10&255;l=this.decodeWords(1+c,o,a);this.pointers=this.decodePointers(1+c,l,e),this.bytes=this.decodeBytes(u-(1+c),o,1+c,3&this._format)}else 8<=this._format?0>1:r[s]||42424242}return i},decodeWords:function(e,t,r){for(var i=new DataView(t.buffer,t.byteOffset),a=new Uint32Array(e),s=0;s>4]),r.push(t[15&this.bytes[a]]),i=256*i+this.bytes[a];var s=e?"-":"",n=9007199254740991");case"LargePositiveInteger":return this.bytesAsNumberString(!1);case"LargeNegativeInteger":return this.bytesAsNumberString(!0);case"Character":var r=this.pointers?this.pointers[0]:this.hash;return"$"+String.fromCharCode(r)+" ("+r.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 4>>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:63<++e?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,r){this.bytes&&(this._format|=3&-this.bytes.length);var i=t,a=this.snapshotSize(),s=(15&this._format)<<8|(4095&this.hash)<<17;switch(a.header){case 2:e.setUint32(t,a.body<<2|Squeak.HeaderTypeSizeAndClass),t+=4,e.setUint32(t,this.sqClass.oop|Squeak.HeaderTypeSizeAndClass),t+=4,e.setUint32(t,s|Squeak.HeaderTypeSizeAndClass),t+=4;break;case 1:e.setUint32(t,this.sqClass.oop|Squeak.HeaderTypeClass),t+=4,e.setUint32(t,s|a.body<<2|Squeak.HeaderTypeClass),t+=4;break;case 0:var n=r.compactClasses.indexOf(this.sqClass)+1;e.setUint32(t,s|n<<12|a.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>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 8<=e&&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=5;t<=6;t++){var r=this.pointers[t];if(r&&r.pointers)for(e=6;e<=7;e++){var i;if((i=r.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{var r=(e=e||this.className()).replace(/[^A-Za-z0-9]/g,"_");r="UndefinedObject"===r?"nil":"True"===r?"true_":"False"===r?"false_":(/^[AEIOU]/.test(r)?"an":"a")+r,(t=new Function("return function "+r+"() {};")()).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 511>19):e},methodClassForSuper:function(){return this.pointers[this.methodNumLits()].pointers[Squeak.Assn_value]},methodNeedsLargeFrame:function(){return 0<(131072&this.pointers[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)}}),Squeak.Object.subclass("Squeak.ObjectSpur","initialization",{initInstanceOf:function(e,t,r,i){this.sqClass=e,this.hash=r;var a=e.pointers[Squeak.Class_format],s=65535&a,n=a>>16&31;(this._format=n)<12?n<10?0>(n?3:1),f=32767&h,d=(c=n?this.decodeWords64(1+f,u,a):this.decodeWords(1+f,u,a),n?2*(1+f):1+f);this.pointers=this.decodePointers(1+f,c,e,s,n),this.bytes=this.decodeBytes(l-d,u,d,3&this._format),n&&(this.pointers[0]=2147483648&u[1]|h);break;default:throw Error("Unknown object format: "+this._format)}this.mark=!1},decodeWords64:function(e,t,r){for(var i=new Array(e),a=0;a>1:a.makeLargeFromSmall((o-(o>>>0))/4294967296>>>0,o>>>0):o>>1;else if(2==(3&o)){if(o<0||8589934591>>(a?3:2))}else a&&4==(7&o)?s[n]=this.decodeSmallFloat((o-(o>>>0))/4294967296>>>0,o>>>0,a):(s[n]=r[o]||42424242,s[n])}return s},decodeSmallFloat:function(e,t,r){var i=0,a=0,s=(8&t)<<28;return 0==(e|4294967280&t)?i=s:(i=939524096+(e>>>4)|s,a=t>>>4|(15&e)<<28),r.makeFloat(new Uint32Array([a,i]))},overhead64:function(e){var t=0,r=0,i=0;if(this._format<=5)t=-2&e.length;else if(24<=this._format){var a=1==(1&(t=1+(e[0]>>3&32767))),s=28<=this._format;a&&(t+=s?1:-1),i=e.length/2,r=e.length-t}else i=(r=e.length)/2;return{bytes:4*t,sizeHeader:255<=r&&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 r=e[t[this.oop][Squeak.Class_name]];if(r&&16<=r._format&&r._format<24){var i=t[r.oop],a=r.decodeBytes(i.length,i,0,7&r._format);return Squeak.bytesAsString(a)}return"Class"},renameFromImage:function(e,t,r){var i=r[this.sqClass];if(!i)return this;var a=i.instProto||i.classInstProto(i.classNameFromImage(e,t));if(!a)return this;var s=new a;return s.oop=this.oop,s.sqClass=this.sqClass,s._format=this._format,s.hash=this.hash,s}},"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=255<=e?2:0;return e+=1&e,(e+=2)<4&&(e=4),{header:t,body:e}},writeTo:function(e,t,r,i){var a=this.isFloat?2:this.words?this.words.length:this.pointers?this.pointers.length:0;this.bytes&&(a+=this.bytes.length+3>>>2,this._format|=3&-this.bytes.length);var s=t,n=this._format<<24|4194303&this.sqClass.hash,o=a<<24|4194303&this.hash;if(255<=a&&(e.setUint32(t,a,r),t+=4,o=255<<24|4194303&this.hash,e.setUint32(t,o,r),t+=4),e.setUint32(t,n,r),t+=4,e.setUint32(t,o,r),t+=4,this.isFloat)e.setFloat64(t,this.float,r),t+=8;else if(this.words)for(var u=0;u>16&31},classInstSize:function(){return 65535&this.pointers[Squeak.Class_format]},classInstIsBytes:function(){var e=this.classInstFormat();return 16<=e&&e<=23},classInstIsPointers:function(){return this.classInstFormat()<=6},classByteSizeOfInstance:function(e){var t=this.classInstFormat(),r=this.classInstSize();return r+=t<9?e:16<=t?(e+3)/4|0:12<=t?(e+1)/2|0:10<=t?e:2*e,r+=1&r,(r+=255<=r?4:2)<4&&(r=4),4*r}},"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()}}),Object.subclass("Squeak.Image","about",{about:function(){}},"initializing",{initialize:function(e){this.headRoom=1e8,this.totalMemory=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(a,t,r){console.log("squeak: reading "+this.name+" ("+a.byteLength+" bytes)"),this.startupTime=Date.now();for(var i=new DataView(a),s=!1,n=0,e=function(){var e=i.getUint32(n,s);return n+=4,e},o=e,u=4,l=function(e,t){if(t){for(var r=[];r.length>>24;255===Y&&(Y=$,$=e(),V=e());D=F+n-8-O;var M=4194303&$;U=4194303&V,z=l(Y,(R=$>>>24&31)<10&&0>>2,L=o(),T=o();break;case Squeak.HeaderTypeClass:L=T-Squeak.HeaderTypeClass,E=(T=o())>>>2&63;break;case Squeak.HeaderTypeShort:E=T>>>2&63,L=T>>>12&31;break;case Squeak.HeaderTypeFree:throw Error("Unexpected free block")}var R,Q,D=n-4-O,U=T>>>17&4095,z=l(--E,(R=T>>>8&15)<5);(Q=new Squeak.Object).initFromImage(D,L,R,U),L<32&&(Q.hash|=268435456),_&&(_.nextObject=Q),this.oldSpaceCount++,_=Q,y[v+D]=Q,I[D]=z}this.firstOldObject=y[v+4],this.lastOldObject=Q,this.lastOldObject.nextObject=null,this.oldSpaceBytes=m}this.totalMemory=this.oldSpaceBytes+this.headRoom,this.totalMemory=1e6*Math.ceil(this.totalMemory/1e6);var X=y[g],G=this.isSpur?this.spurClassTable(y,I,C,X):I[y[I[X.oop][Squeak.splOb_CompactClasses]].oop],H=null;for(Q=this.firstOldObject,_=null;Q;)_=H,H=Q.renameFromImage(y,I,G),_?_.nextObject=H:this.firstOldObject=H,y[v+Q.oop]=H,Q=Q.nextObject;this.lastOldObject=H,this.lastOldObject.nextObject=null;var Z=y[g],K=I[y[I[Z.oop][Squeak.splOb_CompactClasses]].oop],J=y[I[Z.oop][Squeak.splOb_ClassFloat]];this.isSpur&&(this.initImmediateClasses(y,I,Z),K=this.spurClassTable(y,I,C,Z),d=this.getCharacter.bind(this),this.initSpurOverrides());var ee=this.firstOldObject,te=0,re=function(){if(ee){for(var e=te+(this.oldSpaceCount/20|0);ee&&te=s.length)return 0;t=2147483652+4*n,s[n++]=e}else{if(a+e.totalBytes()>i.byteLength)return 0;t=a+4*(e.snapshotSize().header+1),a=e.writeTo(i,a,this),l.push(e)}u[e.oop]=t}return t}function h(){for(var e=this.firstOldObject;e;)e.mark=!1,e=e.nextObject;return this.weakObjects=null,!1}for(c=c.bind(this),h=h.bind(this),c(r);0>>2,p=a(),b=a();break;case Squeak.HeaderTypeClass:p=b-Squeak.HeaderTypeClass,d=(b=a())>>>2&63;break;case Squeak.HeaderTypeShort:d=b>>>2&63,p=b>>>12&31;break;case Squeak.HeaderTypeFree:throw Error("Unexpected free block")}var m=n,v=b>>>8&15,g=b>>>17&4095,k=r(--d,v),_=new Squeak.Object;_.initFromImage(m+c,p,v,g),u.nextObject=_,this.oldSpaceCount++,u=_,h[m]=_,f[m+c]=k}_.nextObject=l;for(var S=0;S>>3;var r=(e>>=3)<0;r&&(e=-e,0!==(t=-t)&&e--);var i=0===e?4:e<=255?5:e<=65535?6:e<=16777215?7:8,a=r?this.largeNegIntClass:this.largePosIntClass,s=new a.instProto;this.registerObjectSpur(s),this.hasNewInstances[a.oop]=!0,s.initInstanceOfLargeInt(a,i);for(var n=s.bytes,o=0;o<4;o++)n[o]=255&t,t>>=8;for(o=4;o>=8;return s},ensureClassesInTable:function(){for(var e=this.firstOldObject,t=1024;e;){var r=e.sqClass;if(0===r.hash&&this.enterIntoClassTable(r),r.hash>t&&(t=r.hash),this.classTable[r.hash]!==r)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,r,i){return e.setUint32(t,167772178,r),t+=4,e.setUint32(t,536870912,r),t+=4,t+=128},writeClassTable:function(e,t,r,i,a){e.setUint32(t,4104,r),t+=4,e.setUint32(t,4278190080,r),t+=4,e.setUint32(t,33554448,r),t+=4,e.setUint32(t,4278190080,r),t+=4;for(var s=0;s>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(n(this.formatVersion()),n(64),n(t+this.oldSpaceBytes+16),n(this.firstOldObject.addr()),n(o(this.specialObjectsArray)),this.savedHeaderWords.forEach(n),n(t+this.oldSpaceBytes+16);s<64;)n(0);var u=this.firstOldObject,l=0;for(s=u.writeTo(r,s,i,o),u=u.nextObject,l++,s=u.writeTo(r,s,i,o),u=u.nextObject,l++,s=u.writeTo(r,s,i,o),u=u.nextObject,l++,s=this.writeFreeLists(r,s,i,o),s=this.writeClassTable(r,s,i,o,e);u;)s=u.writeTo(r,s,i,o),u=u.nextObject,l++;if(n(1241513987),n(8388608),n(0),n(0),s!==r.byteLength)throw Error("wrong image size");if(l!==this.oldSpaceCount)throw Error("wrong object count");var c=Date.now()-a;return console.log("Wrote "+l+" objects in "+c+" ms, image size "+s+" bytes"),r.buffer},storeImageSegmentSpur:function(e,t,r){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}}),Object.subclass("Squeak.Interpreter","initialization",{initialize:function(e,t){console.log("squeak: initializing interpreter "+Squeak.vmVersion),this.Squeak=Squeak,this.image=e,(this.image.vm=this).primHandler=new Squeak.Primitives(this,t),this.loadImageState(),this.hackImage(),this.initVMState(),this.loadInitialContext(),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>wordSize",literal:{index:1,old:8,hack:4},enabled:!0},{method:"ReleaseBuilder class>>prepareEnvironment",bytecode:{pc:28,old:216,hack:135},enabled:("object"==typeof location?location.hash:"").includes("wizard=false")}].forEach(function(t){try{var e=t.enabled&&this.findMethod(t.method);if(e){var r=t.primitive,i=t.bytecode,a=t.literal,s=!0;r?e.pointers[0]|=r:i&&e.bytes[i.pc]===i.old?e.bytes[i.pc]=i.hack:i&&e.bytes[i.pc]===i.hack?s=!1:a&&e.pointers[a.index].pointers[1]===a.old?e.pointers[a.index].pointers[1]=a.hack:a&&e.pointers[a.index].pointers[1]===a.hack?s=!1:(s=!1,console.warn("Not hacking "+t.method)),s&&console.warn("Hacking "+t.method)}}catch(e){console.error("Failed to hack "+t.method+" with error "+e)}},this)}},"interpreting",{interpretOne:function(e){if(this.method.methodSignFlag())return this.interpretOneSistaWithExtensions(e,0,0);if(!this.method.compiled){var t,r,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 r=this.nextByte(),void this.send(this.method.methodGetSelector(31&r),r>>5,!1);case 132:return void this.doubleExtendedDoAnything(this.nextByte());case 133:return r=this.nextByte(),void this.send(this.method.methodGetSelector(31&r),r>>5,!0);case 134:return r=this.nextByte(),void this.send(this.method.methodGetSelector(63&r),r>>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 r=this.nextByte(),void this.push(this.homeContext.pointers[i.Context_tempFrameStart+this.nextByte()].pointers[r]);case 141:return r=this.nextByte(),void(this.homeContext.pointers[i.Context_tempFrameStart+this.nextByte()].pointers[r]=this.top());case 142:return r=this.nextByte(),void(this.homeContext.pointers[i.Context_tempFrameStart+this.nextByte()].pointers[r]=this.pop());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 r=this.nextByte(),this.pc+=256*((7&t)-4)+r,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 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,r){var i,a,s=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[s.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[s.Context_tempFrameStart+(7&i)]);case 72:case 73:case 74:case 75:return void this.push(this.homeContext.pointers[s.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==r?void this.push(this.exportThisContext()):void this.nono();case 83:return void this.push(this.top());case 84:case 85:case 86:case 87: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[s.BlockContext_caller]);case 94:return 0==t?void this.doReturn(this.pop(),this.activeContext.pointers[s.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 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[s.Context_tempFrameStart+(7&i)]=this.pop());case 216:return void this.pop();case 217:return void this.nono();case 218:case 219:case 220:case 221:case 222:case 223:return void this.nono();case 224:return a=this.nextByte(),void this.interpretOneSistaWithExtensions(e,(t<<8)+a,r);case 225:return a=this.nextByte(),void this.interpretOneSistaWithExtensions(e,t,(r<<8)+(a<128?a:a-256));case 226:return a=this.nextByte(),void this.push(this.receiver.pointers[a+(t<<8)]);case 227:return a=this.nextByte(),void this.push(this.method.methodGetLiteral(a+(t<<8)).pointers[s.Assn_value]);case 228:return a=this.nextByte(),void this.push(this.method.methodGetLiteral(a+(t<<8)));case 229:return a=this.nextByte(),void this.push(this.homeContext.pointers[s.Context_tempFrameStart+a]);case 230:return void this.nono();case 231:return void this.pushNewArray(this.nextByte());case 232:return a=this.nextByte(),void this.push(a+(r<<8));case 233:return a=this.nextByte(),void this.push(this.image.getCharacter(a+(r<<8)));case 234:return a=this.nextByte(),void this.send(this.method.methodGetSelector((a>>3)+(t<<5)),(7&a)+(r<<3),!1);case 235:a=this.nextByte();var n=this.method.methodGetSelector((a>>3)+(t<<5));return 64<=r?void this.sendSuperDirected(n,(7&a)+((63&r)<<3)):void this.send(n,(7&a)+(r<<3),!0);case 236:return void this.nono();case 237:var o=this.nextByte()+(r<<8);return this.pc+=o,void(o<0&&this.interruptCheckCounter--<=0&&this.checkForInterrupts());case 238:return void this.jumpIfTrue(this.nextByte()+(r<<8));case 239:return void this.jumpIfFalse(this.nextByte()+(r<<8));case 240:return this.receiver.dirty=!0,void(this.receiver.pointers[this.nextByte()+(t<<8)]=this.pop());case 241:return(u=this.method.methodGetLiteral(this.nextByte()+(t<<8))).dirty=!0,void(u.pointers[s.Assn_value]=this.pop());case 242:return void(this.homeContext.pointers[s.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 u;return(u=this.method.methodGetLiteral(this.nextByte()+(t<<8))).dirty=!0,void(u.pointers[s.Assn_value]=this.top());case 245:return void(this.homeContext.pointers[s.Context_tempFrameStart+this.nextByte()]=this.top());case 246:case 247:return void this.nono();case 248:return void this.callPrimBytecode(245);case 249:return void this.pushFullClosure(t);case 250:return void this.pushClosureCopyExtended(t,r);case 251:return a=this.nextByte(),void this.push(this.homeContext.pointers[s.Context_tempFrameStart+this.nextByte()].pointers[a]);case 252:return a=this.nextByte(),void(this.homeContext.pointers[s.Context_tempFrameStart+this.nextByte()].pointers[a]=this.top());case 253:return a=this.nextByte(),void(this.homeContext.pointers[s.Context_tempFrameStart+this.nextByte()].pointers[a]=this.pop());case 254:case 255:return void this.nono()}throw Error("not a bytecode: "+i)},interpret:function(e,t){if(this.frozen)return"frozen";for(this.isIdle=!1,this.breakOutOfInterpreter=!1,this.breakOutTick=this.primHandler.millisecondClockValue()+(e||500);!1===this.breakOutOfInterpreter;)this.method.compiled?this.method.compiled(this):this.interpretOne();if("function"==typeof this.breakOutOfInterpreter)return this.breakOutOfInterpreter(t);var r="break"==this.breakOutOfInterpreter?"break":this.isIdle?this.nextWakeupTick?Math.max(1,this.nextWakeupTick-this.primHandler.millisecondClockValue()):"sleep":0;return t&&t(r),r},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 r=function(){if(this.frozen=!1,!t)throw Error("no continue function");t(0)}.bind(this);return e&&self.setTimeout(function(){e(r)},0),r},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.nextWakeupTick&&(this.nextWakeupTick=0,(t=this.specialObjects[Squeak.splOb_TheTimerSemaphore]).isNil||this.primHandler.synchronousSignal(t));if(0=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 r=this.method.methodGetLiteral(t);r.dirty=!0,r.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 r=this.method.methodGetLiteral(t);r.dirty=!0,r.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 r=this.method.methodGetLiteral(t);r.dirty=!0,r.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=127>4,i=256*this.nextByte()+this.nextByte(),a=this.encodeSqueakPC(this.pc,this.method),s=this.newClosure(t,a,r);if(s.pointers[Squeak.Closure_outerContext]=this.activeContext,(this.reclaimableContextCount=0)>3&7)+8*this.div(e,16),n=i+(t<<8),o=this.encodeSqueakPC(this.pc,this.method),u=this.newClosure(a,o,s);if(u.pointers[Squeak.Closure_outerContext]=this.activeContext,(this.reclaimableContextCount=0)>6&1)?this.vm.nilObj:this.activeContext;var n=this.method.methodGetLiteral(a),o=this.newFullClosure(t,s,n);if(1==(i>>7&1))throw Error("on-stack receiver not yet supported");if(o.pointers[Squeak.ClosureFull_receiver]=this.receiver,(this.reclaimableContextCount=0)Squeak.Message_lookupClass&&(i.pointers[Squeak.Message_lookupClass]=r),i},primitivePerform:function(e){var t=this.stackValue(e-1),r=this.stackValue(e),i=e-1,a=this.sp-i,s=this.activeContext.pointers;this.arrayCopy(s,1+a,s,a,i),this.sp--;var n=this.findSelectorInClass(t,i,this.getClass(r));return this.executeNewMethod(r,n.method,n.argCount,n.primIndex,n.mClass,t),!0},primitivePerformWithArgs:function(e,t){var r=t?3:2,i=this.stackValue(r),a=this.stackValue(r-1),s=this.stackValue(r-2);if(s.sqClass!==this.specialObjects[Squeak.splOb_ClassArray])return!1;var n=t?this.top():this.getClass(i);if(t)for(var o=this.getClass(i);o!==n;)if((o=o.pointers[Squeak.Class_superclass]).isNil)return!1;var u=s.pointersSize(),l=this.sp-(r-1),c=this.activeContext.pointers;this.arrayCopy(s.pointers,0,c,l,u),this.sp+=u-e;var h=this.findSelectorInClass(a,u,n);return this.executeNewMethod(i,h.method,h.argCount,h.primIndex,h.mClass,a),!0},primitiveInvokeObjectAsMethod:function(e,t){for(var r=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassArray],e),i=0;i=Squeak.MinSmallInt&&e<=Squeak.MaxSmallInt)return this.popNandPush(2,e),!0;if(-4294967295<=e&&e<=4294967295){var t=e<0,r=t?-e:e,i=t?Squeak.splOb_ClassLargeNegativeInteger:Squeak.splOb_ClassLargePositiveInteger,a=this.instantiateClass(this.specialObjects[i],4),s=a.bytes;return s[0]=255&r,s[1]=r>>8&255,s[2]=r>>16&255,s[3]=r>>24&255,this.popNandPush(2,a),!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 r=e/t|0;return r*t===e?r: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(31>t===e?r:Squeak.NonSmallInt}},"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,r,i){for(var a=t;a>"+t.bytesAsString():(i=i||this.activeContext.contextMethod(),this.allMethodsDo(function(e,t,r){if(t===i)return a=e.className()+">>"+r.bytesAsString()}),a||(e?"("+e.pointers[Squeak.Context_receiver]+")>>?":"?>>?"));var a},allInstancesOf:function(e,t){"string"==typeof e&&(e=this.globalNamed(e));for(var r=[],i=this.image.someInstanceOf(e);i;)t?t(i):r.push(i),i=this.image.nextInstanceAfter(i);return r},globalNamed:function(r){return this.allGlobalsDo(function(e,t){if(e.bytesAsString()===r)return t})},allGlobalsDo:function(e){for(var t=this.getGlobals(),r=0;rt+200&&(e.isNil||r.push("..."),r=r.slice(0,t).concat(["..."]).concat(r.slice(-200)));for(var a=[],s=r.length;0>")[0],s=e.split(">>")[1];return this.allMethodsDo(function(e,t,r){if(s.length==r.bytesSize()&&s==r.bytesAsString()&&a==e.className())return i=t}),i},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,r){if(!this.isContext(e))return"NOT A CONTEXT: "+t(e);function t(e){var t="number"==typeof e||"object"==typeof e?e.sqInstName():"<"+e+">";return(t=JSON.stringify(t).slice(1,-1)).length>r-3&&(t=t.slice(0,r-3)+"..."),t}r=r||72;for(var i="number"==typeof e.pointers[Squeak.BlockContext_argumentCount],a=e.pointers[Squeak.Context_closure],s=!i&&!a.isNil,n=i?e.pointers[Squeak.BlockContext_home]:e,o=s?a.pointers[Squeak.Closure_numArgs]:n.pointers[Squeak.Context_method].methodTempCount(),u=this.decodeSqueakSP(0),l=n.contextSizeWithStack(this)-1,c=u+1,h=c+o-1,f="",d=u;d<=l;d++){var p="";d==u?p="=rcvr":d<=h&&(p="=tmp"+(d-c)),f+="\nctx["+d+"]"+p+": "+t(n.pointers[d])}if(i){f+="\n";var b=e.pointers[Squeak.BlockContext_argumentCount],m=this.decodeSqueakSP(1),v=m+b,g=e===this.activeContext?this.sp:e.pointers[Squeak.Context_stackPointer];for(d=m;d<=g;d++){p="";d<=v&&(p="=arg"+(d-m)),f+="\nblk["+d+"]"+p+": "+t(e.pointers[d])}}return f},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],r="Active: "+this.printProcess(t,!0),i=e.pointers[Squeak.ProcSched_processLists].pointers,a=i.length-1;0<=a;a--)for(var s=i[a].pointers[Squeak.LinkedList_firstLink];!s.isNil;)r+="\nRunnable: "+this.printProcess(s),s=s.pointers[Squeak.Link_nextLink];for(var n=this.specialObjects[Squeak.splOb_ClassSemaphore],o=this.image.someInstanceOf(n);o;){for(s=o.pointers[Squeak.LinkedList_firstLink];!s.isNil;)r+="\nWaiting: "+this.printProcess(s),s=s.pointers[Squeak.Link_nextLink];o=this.image.nextInstanceAfter(o)}return r},printProcess:function(e,t){var r=e.pointers[Squeak.Proc_suspendedContext],i=e.pointers[Squeak.Proc_priority],a=this.printStack(t?null:r),s=this.printContext(r);return e.toString()+" at priority "+i+"\n"+a+s+"\n"},printByteCodes:function(e,t,r,i){return e=e||this.method,new Squeak.InstructionPrinter(e,this).printInstructions(t,r,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)r=this.specialSelectors[2*(e-96)];else if(128<=e&&e<=175)r=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(120<=e&&e<=125)return!0;if(e<131||200==e)return!1;if(176<=e)return!0;if(e<=134){var t;if(132===e){if(1>5)return!1;t=this.method.bytes[this.pc+2]}else t=this.method.bytes[this.pc+1]&(134===e?63:31);var r=this.method.methodGetLiteral(t);if("blockCopy:"!==r.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(208<=t)e=this.method.methodGetLiteral(15&t);else if(176<=t)e=this.specialSelectors[2*(t-176)];else if(t<=134){var r;if(132===t){if(1>5)return null;r=this.method.bytes[this.pc+2]}else r=this.method.bytes[this.pc+1]&(134===t?63:31);e=this.method.methodGetLiteral(r)}}if(e){var i=e.bytesAsString();if("blockCopy:"!==i)return i}}}),Object.subclass("Squeak.InterpreterProxy","initialization",{VM_PROXY_MAJOR:1,VM_PROXY_MINOR:11,initialize:function(t){this.vm=t,this.remappableOops=[],Object.defineProperty(this,"successFlag",{get:function(){return t.primHandler.success},set:function(e){t.primHandler.success=e}})},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&&-1073741824<=e&&e<=1073741823},isArray:function(e){return e.sqClass===this.vm.specialObjects[Squeak.splOb_ClassArray]},isMemberOf:function(e,t){var r=e.sqClass.pointers[Squeak.Class_name].bytes;if(t.length!==r.length)return!1;for(var i=0;i=e.pointers.length)return this.successFlag=!1;e.pointers[t]=r}},"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]},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,r,i,a){if(t>5,!0);if(6===e)return r.send(this.method.methodGetLiteral(63&i),i>>6,!1)}if(7===e)return r.doPop();if(8===e)return r.doDup();if(9===e)return r.pushActiveContext();i=this.method.bytes[this.pc++];if(10===e)return i<128?r.pushNewArray(i):r.popIntoNewArray(i-128);n=this.method.bytes[this.pc++];if(11===e)return r.callPrimitive(i+256*n);if(12===e)return r.pushRemoteTemp(i,n);if(13===e)return r.storeIntoRemoteTemp(i,n);if(14===e)return r.popIntoRemoteTemp(i,n);var o=this.method.bytes[this.pc++];return r.pushClosureCopy(i>>4,15&i,256*n+o)}}),Squeak.InstructionStream.subclass("Squeak.InstructionStreamSista","decoding",{interpretNextInstructionFor:function(e){return this.interpretNextInstructionExtFor(e,0,0)},interpretNextInstructionExtFor:function(e,t,r){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 a=this.method.bytes[this.pc++];switch(i){case 224:return this.interpretNextInstructionExtFor(e,(t<<8)+a,r);case 225:return this.interpretNextInstructionExtFor(e,t,(r<<8)+(a<128?a:a-256));case 226:return e.pushReceiverVariable(a+(t<<8));case 227:return e.pushLiteralVariable(this.method.methodGetLiteral(a+(t<<8)));case 228:return e.pushConstant(this.method.methodGetLiteral(a+(t<<8)));case 229:return e.pushTemporaryVariable(a);case 231:return a<128?e.pushNewArray(a):e.popIntoNewArray(a-128);case 232:return e.pushConstant(a+(r<<8));case 233:return e.pushConstant("$"+a+(r<<8));case 234:return e.send(this.method.methodGetSelector((a>>3)+(t<<5)),(7&a)+(r<<3),!1);case 235:var s=this.method.methodGetSelector((a>>3)+(t<<5));return 64<=r?e.sendSuperDirected(s):e.send(s,(7&a)+(r<<3),!0);case 237:return e.jump(a+(r<<8));case 238:return e.jumpIf(!0,a+(r<<8));case 239:return e.jumpIf(!1,a+(r<<8));case 240:return e.popIntoReceiverVariable(a+(t<<8));case 241:return e.popIntoLiteralVariable(this.method.methodGetLiteral(a+(t<<8)));case 242:return e.popIntoTemporaryVariable(a);case 243:return e.storeIntoReceiverVariable(a+(t<<8));case 244:return e.storeIntoLiteralVariable(this.method.methodGetLiteral(a+(t<<8)));case 245:return e.storeIntoTemporaryVariable(a)}var n=this.method.bytes[this.pc++];switch(i){case 248:return e.callPrimitive(a+(n<<8));case 249:var o=a+(t<<8),u=63&n,l=this.method.methodGetLiteral(o);return e.pushFullClosure(o,u,l.methodNumArgs());case 250:var c=(7&a)+8*this.mod(t,16),h=(u=(a>>3&7)+8*this.div(t,16),n+(r<<8));return e.pushClosureCopy(u,c,h);case 251:return e.pushRemoteTemp(a,n);case 252:return e.storeIntoRemoteTemp(a,n);case 253:return e.popIntoRemoteTemp(a,n)}throw Error("Unknown bytecode: "+i)}}),Object.subclass("Squeak.InstructionPrinter","initialization",{initialize:function(e,t){this.method=e,this.vm=t}},"printing",{printInstructions:function(e,t,r){this.indent=e,this.highlight=t,this.highlightPC=r,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;tthis.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())},blockReturnTop:function(){this.print("blockReturn")},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,r){this.print((r?"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,r){var i=this.scanner.pc,a=i+r;this.print("closure("+i+"-"+(a-1)+"): "+e+" copied, "+t+" args");for(var s=i;sthis.endPC&&(this.endPC=a)},pushFullClosure:function(e,t,r){this.print("pushFullClosure: (self literalAt: "+e+") numCopied: "+t+" numArgs: "+r)},callPrimitive:function(e){this.print("primitive: "+e)}}),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,r){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 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.vm.warnOnce("missing primitive: 20 (primitiveRemLargeIntegers)"),!1;case 21:return this.vm.warnOnce("missing primitive: 21 (primitiveAddLargeIntegers)"),!1;case 22:return this.vm.warnOnce("missing primitive: 22 (primitiveSubtractLargeIntegers)"),!1;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.vm.warnOnce("missing primitive: 29 (primitiveMultiplyLargeIntegers)"),!1;case 30:return this.vm.warnOnce("missing primitive: 30 (primitiveDivideLargeIntegers)"),!1;case 31:return this.vm.warnOnce("missing primitive: 31 (primitiveModLargeIntegers)"),!1;case 32:return this.vm.warnOnce("missing primitive: 32 (primitiveDivLargeIntegers)"),!1;case 33:return this.vm.warnOnce("missing primitive: 33 (primitiveQuoLargeIntegers)"),!1;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 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,r);case 118:return this.primitiveDoPrimitiveWithArgs(t);case 119:return this.vm.flushMethodCacheForSelector(this.vm.top());case 120:return this.primitiveCalloutToFFI(t,r);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):!1;case 179:if(this.oldPrims)return this.namedPrimitive("SoundGenerationPlugin","primSampledSoundmixSampleCountintostartingAtpan",t);break;case 180:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primitiveMixFMSound",t):!1;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):!1;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","primitiveSocketListenOnPort",t):(this.vm.warnOnce("missing primitive: 218 (tryNamedPrimitiveInForWithArgs"),!1);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);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);case 238:if(this.oldPrims)return this.namedPrimitive("SerialPlugin","primitiveSerialPortOpen",t);case 239:if(this.oldPrims)return this.namedPrimitive("SerialPlugin","primitiveSerialPortClose",t);break;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,r);case 578:return this.vm.warnOnce("missing primitive: 578 (primitiveSuspendAndBackupPC)"),!1}return console.error("primitive "+e+" not implemented yet"),!1},namedPrimitive:function(e,t,r){var i=""===e?this:this.loadedModules[e];void 0===i&&(i=this.loadModule(e),this.loadedModules[e]=i);var a=!1,s=this.vm.sp;if(i){this.interpreterProxy.argCount=r;var n=i[t];"function"==typeof n?a=i[t](r):"string"==typeof n?a=this[n](r):this.vm.warnOnce("missing primitive: "+e+"."+t)}else this.vm.warnOnce("missing module: "+e+" ("+t+")");return(!0===a||!1!==a&&this.success)&&this.vm.sp!==s-r&&!this.vm.frozen&&this.vm.warnOnce("stack unbalanced after primitive "+e+"."+t,"error"),!0===a||!1===a?a:this.success},doNamedPrimitive:function(e,t){if(t.pointersSize()<2)return!1;var r=t.pointers[1];if(4!==r.pointersSize())return!1;this.primMethod=t;var i=r.pointers[0].bytesAsString(),a=r.pointers[1].bytesAsString();return this.namedPrimitive(i,a,e)},fakePrimitive:function(e,t,r){return this.vm.warnOnce("faking primitive: "+e),void 0===t?this.vm.popN(r):this.vm.popNandPush(r+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 r=t.initialiseModule;return"function"==typeof r?t.initialiseModule():"string"==typeof r&&this[r](),this.interpreterProxy.failed()?(console.log("Module initialization failed: "+e),null):(console.log("Loaded module: "+e),t)},loadModuleDynamically:function(e){},patchModule:function(e,t){var r=this.patchModules[t];for(var i in r)e[i]=r[i]},unloadModule:function(e){var t=this.loadedModules[e];if(!e||!t||t===this)return null;delete this.loadedModules[e];var r=t.unloadModule;return"function"==typeof r?t.unloadModule(this):"string"==typeof r&&this[r](this),console.log("Unloaded module: "+e),t},loadFunctionFrom:function(e,t){var r=""===t?this:this.loadedModules[t];if(void 0===r&&(r=this.loadModule(t),this.loadedModules[t]=r),!r)return null;var i=r[e];return"function"==typeof i?i.bind(r):"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 r=Object.keys(this.builtinModules);return this.popNandPushIfOK(e+1,this.makeStObject(r[t]))},primitiveListLoadedModule:function(e){var t=this.stackInteger(0)-1;if(!this.success)return!1;var r=[];for(var i in this.loadedModules){var a=this.loadedModules[i];if(a){var s=a.getModuleName?a.getModuleName():i;r.push(s)}}return this.popNandPushIfOK(e+1,this.makeStObject(r[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(0<=e&&e<=Squeak.MaxSmallInt)return e;for(var t=this.vm.specialObjects[Squeak.splOb_ClassLargePositiveInteger],r=this.vm.instantiateClass(t,4),i=r.bytes,a=0;a<4;a++)i[a]=e>>>8*a&255;return r},pos53BitIntFor:function(e){if(e<=4294967295)return this.pos32BitIntFor(e);if(9007199254740991=Squeak.MinSmallInt&&e<=Squeak.MaxSmallInt)return e;for(var t=e<0,r=t?-e:e,i=t?Squeak.splOb_ClassLargeNegativeInteger:Squeak.splOb_ClassLargePositiveInteger,a=this.vm.instantiateClass(this.vm.specialObjects[i],4),s=a.bytes,n=0;n<4;n++)s[n]=r>>>8*n&255;return a},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 r=t.bytesSize();if(r<=7){for(var i=t.bytes,a=0,s=0,n=1;s>>20&2047;return 0===r&&(t.setFloat64(0,e*Math.pow(2,64)),r=(t.getUint32(0)>>>20&2047)-64),r-1022},ldexp:function(e,t){for(var r=Math.min(3,Math.ceil(Math.abs(t)/1023)),i=e,a=0;athis.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))}},"utils",{floatOrInt:function(e){return e.isFloat?e.float:"number"==typeof e?e:0},positive32BitValueOf:function(e){if("number"==typeof e)return 0<=e?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,r=0,i=0,a=1;i<4;i++,a*=256)r+=t[i]*a;return r},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 r=e.sqClass,i=this.vm.specialObjects[t];!r.isNil;){if(r===i)return!0;r=r.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 r=this.vm.specialObjects[Squeak.splOb_ClassCharacter];return(t=this.vm.instantiateClass(r,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],r=this.vm.instantiateClass(t,2);return r.float=e,r},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(4294967295i.size)return this.success=!1,a;if(r)return a.pointers[s-1];if(a.isPointers())return a.pointers[s-1+i.ivarOffset];if(a.isWords())return i.convertChars?this.charFromInt(1073741823&a.words[s-1]):this.pos32BitIntFor(a.words[s-1]);if(a.isBytes())return i.convertChars?this.charFromInt(255&a.bytes[s-1]):255&a.bytes[s-1];var o=4*a.pointersSize();return s-1-o<0?(this.success=!1,a):255&a.bytes[s-1-o]},objectAtPut:function(e,t,r){var i,a=this.stackNonInteger(2),s=this.stackPos32BitInt(1);if(!this.success)return a;if(e){if((i=this.atPutCache[a.hash&this.atCacheMask]).array!==a)return this.success=!1,a}else{if(a.isFloat){var n=this.stackPos32BitInt(0);if(!this.success||1!=s&&2!=s)this.success=!1;else{var o=a.floatData();o.setUint32(1==s?0:4,n,!1),a.float=o.getFloat64(0)}return this.vm.stackValue(0)}i=this.makeAtCacheInfo(this.atPutCache,this.vm.specialSelectors[34],a,t,r)}if(s<1||s>i.size)return this.success=!1,a;var u,l=this.vm.stackValue(0);if(r)return a.dirty=!0,a.pointers[s-1]=l;if(a.isPointers())return a.dirty=!0,a.pointers[s-1+i.ivarOffset]=l;if(a.isWords()){if(t){if(l.sqClass!==this.vm.specialObjects[Squeak.splOb_ClassCharacter])return this.success=!1,l;if("number"!=typeof(u=this.charToInt(l)))return this.success=!1,l}else u=this.stackPos32BitInt(0);return this.success&&(a.words[s-1]=u),l}if(t){if(l.sqClass!==this.vm.specialObjects[Squeak.splOb_ClassCharacter])return this.success=!1,l;if("number"!=typeof(u=this.charToInt(l)))return this.success=!1,l}else{if("number"!=typeof l)return this.success=!1,l;u=l}if(u<0||255this.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),r=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassArray],t.length);return r.pointers=t,r},identityHash:function(e){return e.hash},identityHashSpur:function(e){var t=e.hash;return 0=t.pointers.length)return!1;for(var i=t.pointers[Squeak.Context_stackPointer];i=a)return!1;this.vm.popN(2);for(var s=0;s=a.length)return!1;if(e<2)t=a[i];else{if((t=this.stackInteger(0))<-32768||32767=a.length)return!1;if(e<2)t=this.signed32BitIntegerFor(a[i]);else{if(t=this.stackSigned32BitInt(0),!this.success)return!1;a[i]=t}return this.popNandPushIfOK(e+1,t),!0},primitiveConstantFill:function(e){var t=this.stackNonInteger(1),r=this.stackPos32BitInt(0);if(!this.success||!t.isWordsOrBytes())return!1;var i=t.words||t.bytes;if(i){if(i===t.bytes&&255t)a=r[t];else{if(!(t<0&&i&&i.length>-t-1))return!1;a=i[-t-1]}}return this.vm.popNandPush(e+1,this.makeStObject(a)),!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 r=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassArray],t),i=0;i","<=",">=","=","~=","*","/","\\\\","@","bitShift:","//","bitAnd:","bitOr:","at:","at:put:","size","next","nextPut:","atEnd","==","class","blockCopy:","value","value:","do:","new","new:","x","y"],this.doitCounter=0}},"accessing",{compile:function(e,t,r){if(!e.methodSignFlag())if(void 0===e.compiled)e.compiled=!1;else{this.singleStep=!1,this.debug=this.comments;var i=t&&t.className(),a=r&&r.bytesAsString();e.compiled=this.generate(e,i,a)}},enableSingleStepping:function(i,a,s){if(!i.compiled||!i.compiled.canSingleStep){this.singleStep=!0,this.debug=!0,a||this.vm.allMethodsDo(function(e,t,r){if(t===i)return a=e,s=r,!0});var e=a&&a.className(),t=s&&s.bytesAsString(),r=a&&a.allInstVarNames();i.compiled=this.generate(i,e,t,r),i.compiled.canSingleStep=!0}return!0},functionNameFor:function(e,t){if(void 0===e||"?"===e)return"DOIT_"+ ++this.doitCounter;if(!/[^a-zA-Z0-9:_]/.test(t))return(e+"_"+t).replace(/[: ]/g,"_");var r=t.replace(/./g,function(e){return{"|":"OR","~":"NOT","<":"LT","=":"EQ",">":"GT","&":"AND","@":"AT","*":"TIMES","+":"PLUS","\\":"MOD","-":"MINUS",",":"COMMA","/":"DIV","?":"IF"}[e]||"OPERATOR"});return e.replace(/[ ]/,"_")+"__"+r+"__"}},"generating",{generate:function(e,t,r,i){for(this.method=e,this.pc=0,this.endPC=0,this.prevPC=0,this.source=[],this.sourceLabels={},this.needsLabel={},this.sourcePos={},this.needsVar={},this.needsBreak=!1,t&&r&&this.source.push("// ",t,">>",r,"\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.done=!1;!this.done;){var a=e.bytes[this.pc++],s=0;switch(248&a){case 0:case 8:this.generatePush("inst[",15&a,"]");break;case 16:case 24:this.generatePush("temp[",6+(15&a),"]");break;case 32:case 40:case 48:case 56:this.generatePush("lit[",1+(31&a),"]");break;case 64:case 72:case 80:case 88:this.generatePush("lit[",1+(31&a),"].pointers[1]");break;case 96:this.generatePopInto("inst[",7&a,"]");break;case 104:this.generatePopInto("temp[",6+(7&a),"]");break;case 112:switch(a){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(a){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")}break;case 128:case 136:this.generateExtended(a);break;case 144:this.generateJump(1+(7&a));break;case 152:this.generateJumpIf(!1,1+(7&a));break;case 160:s=e.bytes[this.pc++],this.generateJump(256*((7&a)-4)+s);break;case 168:s=e.bytes[this.pc++],this.generateJumpIf(a<172,256*(3&a)+s);break;case 176:case 184:this.generateNumericOp(a);break;case 192:case 200:this.generateQuickPrim(a);break;case 208:case 216:this.generateSend("lit[",1+(15&a),"]",0,!1);break;case 224:case 232:this.generateSend("lit[",1+(15&a),"]",1,!1);break;case 240:case 248:this.generateSend("lit[",1+(15&a),"]",2,!1)}}var n=this.functionNameFor(t,r);return 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(),new Function("'use strict';\nreturn function "+n+"(vm) {\n"+this.source.join("")+"}")()},generateExtended:function(e){var t,r;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]")}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]")}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++],r=this.method.bytes[this.pc++],t>>5){case 0:return void this.generateSend("lit[",1+r,"]",31&t,!1);case 1:return void this.generateSend("lit[",1+r,"]",31&t,!0);case 2:return void this.generatePush("inst[",r,"]");case 3:return void this.generatePush("lit[",1+r,"]");case 4:return void this.generatePush("lit[",1+r,"].pointers[1]");case 5:return void this.generateStoreInto("inst[",r,"]");case 6:return void this.generatePopInto("inst[",r,"]");case 7:return void this.generateStoreInto("lit[",1+r,"].pointers[1]")}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=127<(t=this.method.bytes[this.pc++]),a=127&t;return void this.generateClosureTemps(a,i);case 139:return t=this.method.bytes[this.pc++],r=this.method.bytes[this.pc++],void this.generateCallPrimitive(t+256*r);case 140:return t=this.method.bytes[this.pc++],r=this.method.bytes[this.pc++],void this.generatePush("temp[",6+r,"].pointers[",t,"]");case 141:return t=this.method.bytes[this.pc++],r=this.method.bytes[this.pc++],void this.generateStoreInto("temp[",6+r,"].pointers[",t,"]");case 142:return t=this.method.bytes[this.pc++],r=this.method.bytes[this.pc++],void this.generatePopInto("temp[",6+r,"].pointers[",t,"]");case 143:var s=15&(t=this.method.bytes[this.pc++]),n=t>>4,o=(r=this.method.bytes[this.pc++])<<8|this.method.bytes[this.pc++];return void this.generateClosureCopy(s,n,o)}},generatePush:function(e,t,r,i,a){this.debug&&this.generateDebugCode("push",e,t,r,i,a),this.generateLabel(),this.needsVar[e]=!0,this.needsVar.stack=!0,this.source.push("stack[++vm.sp] = ",e),void 0!==t&&(this.source.push(t,r),void 0!==i&&this.source.push(i,a)),this.source.push(";\n")},generateStoreInto:function(e,t,r,i,a){this.debug&&this.generateDebugCode("store into",e,t,r,i,a),this.generateLabel(),this.needsVar[e]=!0,this.needsVar.stack=!0,this.source.push(e),void 0!==t&&(this.source.push(t,r),void 0!==i&&this.source.push(i,a)),this.source.push(" = stack[vm.sp];\n"),this.generateDirty(e,t)},generatePopInto:function(e,t,r,i,a){this.debug&&this.generateDebugCode("pop into",e,t,r,i,a),this.generateLabel(),this.needsVar[e]=!0,this.needsVar.stack=!0,this.source.push(e),void 0!==t&&(this.source.push(t,r),void 0!==i&&this.source.push(i,a)),this.source.push(" = stack[vm.sp--];\n"),this.generateDirty(e,t)},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(){this.debug&&this.generateDebugCode("block return"),this.generateLabel(),this.needsVar.stack=!0,this.source.push("vm.pc = ",this.pc,"; vm.doReturn(stack[vm.sp--], context.pointers[0]); return;\n"),this.needsBreak=!1},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 r=this.pc+t;this.debug&&this.generateDebugCode("jump if "+e+" to "+r),this.generateLabel(),this.needsVar.stack=!0,this.source.push("var cond = stack[vm.sp--]; if (cond === vm.",e,"Obj) {vm.pc = ",r,"; "),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[r]=!0,r>this.endPC&&(this.endPC=r)},generateQuickPrim:function(e){switch(this.debug&&this.generateDebugCode("quick send #"+this.specialSelectors[16+(15&e)]),this.generateLabel(),e){case 192: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 193: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 194: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 198: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 199: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 200: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 201:case 202:case 203: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,e){case 176: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 177: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 178: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 179: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 180: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 181: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 182: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 183: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 184: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 185: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 186: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 187:return void this.source.push("vm.success = true; if(!vm.primHandler.primitiveMakePoint(1, true)) { vm.pc = ",this.pc,"; vm.sendSpecial(11); return}\n");case 188: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 189: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 190: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 191: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,r,i,a){this.debug&&this.generateDebugCode("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,"; vm.send(",e,t,r,", ",i,", ",a,"); ","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 r=0;rthis.endPC&&(this.endPC=a)},generateCallPrimitive:function(e){this.debug&&this.generateDebugCode("call primitive "+e),this.generateLabel(),129===this.method.bytes[this.pc]&&(this.needsVar.stack=!0,this.source.push("if (vm.primFailCode) {stack[vm.sp] = vm.getErrorObjectFromPrimFailCode(); vm.primFailCode = 0;}\n"))},generateDirty:function(e,t){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[":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,r,i,a,s){this.needsBreak&&(this.source.push("if (vm.breakOutOfInterpreter) {vm.pc = ",this.prevPC,"; return}\n"),this.needsLabel[this.prevPC]=!0);for(var n=[],o=this.prevPC;o ",e),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[r]):this.source.push("inst var ",r);break;case"temp[":this.source.push("tmp",r-6),"]"!==i&&this.source.push("[",a,"]");break;case"lit[":var u=this.method.pointers[r];"]"===i?this.source.push(u):this.source.push(u.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 r=0;r<3;r++)this.source[this.sourceLabels[t]+r]="";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>u|(a&n)>>u+1,n>>>=1;r[i]=o}return{obj:e.obj,bits:r,depth:2,width:16,height:16,offsetX:e.offsetX,offsetY:e.offsetY,msb:!0,pixPerWord:16,pitch:1}},primitiveBeDisplay:function(e){var t=this.vm.stackValue(0);return this.vm.specialObjects[Squeak.splOb_TheDisplay]=t,this.vm.popN(e),!0},primitiveReverseDisplay:function(e){if(this.reverseDisplay=!this.reverseDisplay,this.redrawDisplay(),this.display.cursorCanvas){for(var t=this.display.cursorCanvas,r=t.getContext("2d"),i=r.getImageData(0,0,t.width,t.height),a=new Uint32Array(i.data.buffer),s=0;sr.left&&(r.left=e.left),e.rightr.top&&(r.top=e.top),e.bottom>16)+((255&O)<<16);h[f]=d}this.swappedColors=h}this.reverseDisplay&&(h=i?i.map(function(e){return 16777215^e}):(this.reversedColors||(this.reversedColors=h.map(function(e){return 16777215^e})),this.reversedColors));for(var p=(1<>>g&p],(g-=t.depth)<0&&(g=32-t.depth,k=t.bits[++v]);s++}break;case 16:for(b=a%2?0:16,m=0;m>>g;c[_++]=((31744&y)>>7)+((992&y)<<6)+((31&y)<<19)+4278190080,(g-=16)<0&&(g=16,k=t.bits[++v])}s++}break;case 32:var I=i?0:4278190080;for(m=0;m>16|(255&O)<<16|I;c[_++]=d}s++}break;default:throw Error("depth not implemented")}u.data!==l&&u.data.set(l),e.putImageData(u,r.left,r.top)}},primitiveDeferDisplayUpdates:function(e){var t=this.stackBoolean(0);return!!this.success&&(this.deferDisplayUpdates=t,this.vm.popN(e),!0)},primitiveForceDisplayUpdate:function(e){return this.vm.breakOut(),this.vm.popN(e),!0},primitiveScanCharacters:function(e){if(6!==e)return!1;var t=this.stackInteger(0),r=this.stackNonInteger(1),i=this.stackInteger(2),a=this.stackNonInteger(3),s=this.stackInteger(4),n=this.stackInteger(5);if(!this.success)return!1;if(r.pointersSize()<258||!a.isBytes())return!1;if(!(0r.pitch*r.height))return null;this.vm.warnOnce("loadForm(): "+r.bits.length+" !== "+r.pitch+"*"+r.height+"="+r.pitch*r.height)}return r},theDisplay:function(){return this.loadForm(this.vm.specialObjects[Squeak.splOb_TheDisplay])},displayDirty:function(e,t){this.deferDisplayUpdates||e!=this.vm.specialObjects[Squeak.splOb_TheDisplay]||this.displayUpdate(this.theDisplay(),t)},displayUpdate:function(e,t){this.showForm(this.display.context,e,t),this.display.lastTick=this.vm.lastTick,this.display.idle=0},primitiveBeep:function(e){var t=Squeak.startAudioOut();if(t){var r=t.createOscillator();r.connect(t.destination),r.type="square",r.frequency.value=880,r.start(),r.stop(t.currentTime+.05)}else this.vm.warnOnce("could not initialize audio");return this.popNIfOK(e)}}),Object.extend(Squeak,"files",{fsck:function(r,i,a,s){if(i=i||"",s=s||{dirs:0,files:0,bytes:0,deleted:0},!a&&(a={},Object.keys(Squeak.Settings).forEach(function(e){var t=e.match(/squeak-file(\.lz)?:(.*)$/);t&&(a[t[2]]=!0)}),window.SqueakDBFake&&Object.keys(SqueakDBFake.bigFiles).forEach(function(e){a[e]=!0}),"undefined"!=typeof indexedDB))return this.dbTransaction("readonly","fsck cursor",function(e){var t=e.openCursor();t.onsuccess=function(e){var t=e.target.result;t?(a[t.key]=!0,t.continue()):Squeak.fsck(r,i,a,s)},t.onerror=function(e){console.error("fsck failed")}});var e=Squeak.dirList(i);for(var t in e){var n=i+"/"+t;if(e[t][3])"squeak:"+n in Squeak.Settings?(Squeak.fsck(null,n,a,s),s.dirs++):(console.log("Deleting stale directory "+n),Squeak.dirDelete(n),s.deleted++);else a[n]?(a[n]=!1,s.files++,s.bytes+=e[t][4]):(console.log("Deleting stale file entry "+n),Squeak.fileDelete(n,!0),s.deleted++)}if(""===i){console.log("squeak fsck: "+s.dirs+" directories, "+s.files+" files, "+(s.bytes/1e6).toFixed(1)+" MBytes");var o=[];for(var n in a)a[n]&&o.push(n);if(0SqueakDBFake.bigFileThreshold)SqueakDBFake.bigFiles[t]||console.log("File "+t+" ("+e.byteLength+" bytes) too large, storing in memory only"),SqueakDBFake.bigFiles[t]=e;else{var r=Squeak.bytesAsString(new Uint8Array(e));if("object"==typeof LZString){var i=LZString.compressToUTF16(r);Squeak.Settings["squeak-file.lz:"+t]=i,delete Squeak.Settings["squeak-file:"+t]}else Squeak.Settings["squeak-file:"+t]=r}var a={};return setTimeout(function(){a.onsuccess&&a.onsuccess()},0),a},delete:function(e){delete Squeak.Settings["squeak-file:"+e],delete Squeak.Settings["squeak-file.lz:"+e],delete SqueakDBFake.bigFiles[e];var t={};return setTimeout(function(){t.onsuccess&&t.onsuccess()},0),t},openCursor:function(){var e={};return setTimeout(function(){e.onsuccess&&e.onsuccess({target:e})},0),e}}),SqueakDBFake},fileGet:function(e,r,i){i=i||function(e){console.log(e)};var a=this.splitFilePath(e);if(!a.basename)return i("Invalid path: "+e);if(Squeak.debugFiles){console.log("Reading "+a.fullname);var t=r;r=function(e){console.log("Read "+e.byteLength+" bytes from "+a.fullname),t(e)}}if(window.SqueakDBFake&&SqueakDBFake.bigFiles[a.fullname])return r(SqueakDBFake.bigFiles[a.fullname]);this.dbTransaction("readonly","get "+e,function(e){var t=e.get(a.fullname);t.onerror=function(e){i(e.target.error.name)},t.onsuccess=function(e){if(void 0!==this.result)return r(this.result);Squeak.fetchTemplateFile(a.fullname,function(e){r(e)},function(){if("undefined"==typeof indexedDB)return i("file not found: "+a.fullname);var e=Squeak.dbFake().get(a.fullname);e.onerror=function(e){i("file not found: "+a.fullname)},e.onsuccess=function(e){r(this.result)}})}})},filePut:function(e,t,r){var i=this.splitFilePath(e);if(!i.basename)return null;var a=this.dirList(i.dirname);if(!a)return null;var s=a[i.basename],n=this.totalSeconds();if(s){if(s[3])return null}else s=[i.basename,n,0,!1,0],a[i.basename]=s;return Squeak.debugFiles&&(console.log("Writing "+i.fullname+" ("+t.byteLength+" bytes)"),0>Squeak.FFIAtomicTypeShift){case Squeak.FFITypeVoid:return null;case Squeak.FFITypeBool:return!e.isFalse;case Squeak.FFITypeUnsignedInt8:case Squeak.FFITypeSignedInt8:case Squeak.FFITypeUnsignedInt16:case Squeak.FFITypeSignedInt16:case Squeak.FFITypeUnsignedInt32:case Squeak.FFITypeSignedInt32:case Squeak.FFITypeUnsignedInt64:case Squeak.FFITypeSignedInt64:case Squeak.FFITypeUnsignedChar8:case Squeak.FFITypeSignedChar8:case Squeak.FFITypeUnsignedChar16:case Squeak.FFITypeUnsignedChar32:if("number"==typeof e)return e;throw Error("FFI: expected integer, got "+e);case Squeak.FFITypeSingleFloat:case Squeak.FFITypeDoubleFloat:return"number"==typeof e?e:(e.isFloat,e.float);default:throw Error("FFI: unimplemented atomic arg type: "+i)}case Squeak.FFIFlagAtomicPointer:var i;switch(i=(r&Squeak.FFIAtomicTypeMask)>>Squeak.FFIAtomicTypeShift){case Squeak.FFITypeUnsignedChar8:if(e.bytes)return e.bytesAsString();throw Error("FFI: expected string, got "+e);case Squeak.FFITypeUnsignedInt8:if(e.bytes)return e.bytes;if(e.words)return e.wordsAsUint8Array();throw Error("FFI: expected bytes, got "+e);case Squeak.FFITypeUnsignedInt32:if(e.words)return e.words;throw Error("FFI: expected words, got "+e);case Squeak.FFITypeSignedInt32:if(e.words)return e.wordsAsInt32Array();throw Error("FFI: expected words, got "+e);case Squeak.FFITypeSingleFloat:if(e.words)return e.wordsAsFloat32Array();if(e.isFloat)return new Float32Array([e.float]);throw Error("FFI: expected floats, got "+e);case Squeak.FFITypeVoid:if(e.words)return e.words.buffer;if(e.bytes)return e.bytes.buffer;throw Error("FFI: expected words or bytes, got "+e);default:throw Error("FFI: unimplemented atomic array arg type: "+i)}default:throw Error("FFI: unimplemented arg type flags: "+r)}},ffiResultToSt:function(e,t){var r=t.pointers[0].words[0];switch(r&Squeak.FFIFlagMask){case Squeak.FFIFlagAtomic:switch(i=(r&Squeak.FFIAtomicTypeMask)>>Squeak.FFIAtomicTypeShift){case Squeak.FFITypeVoid:return this.vm.nilObj;case Squeak.FFITypeBool:return e?this.vm.trueObj:this.vm.falseObj;case Squeak.FFITypeUnsignedInt8:case Squeak.FFITypeSignedInt8:case Squeak.FFITypeUnsignedInt16:case Squeak.FFITypeSignedInt16:case Squeak.FFITypeUnsignedInt32:case Squeak.FFITypeSignedInt32:case Squeak.FFITypeUnsignedInt64:case Squeak.FFITypeSignedInt64:case Squeak.FFITypeUnsignedChar8:case Squeak.FFITypeSignedChar8:case Squeak.FFITypeUnsignedChar16:case Squeak.FFITypeUnsignedChar32:case Squeak.FFITypeSingleFloat:case Squeak.FFITypeDoubleFloat:if("number"!=typeof e)throw Error("FFI: expected number, got "+e);return this.makeStObject(e);default:throw Error("FFI: unimplemented atomic return type: "+i)}case Squeak.FFIFlagAtomicPointer:var i;switch(i=(r&Squeak.FFIAtomicTypeMask)>>Squeak.FFIAtomicTypeShift){case Squeak.FFITypeSignedChar8:case Squeak.FFITypeUnsignedChar8:return this.makeStString(e);default:return this.makeStExternalData(e,t)}default:throw Error("FFI: unimplemented return type flags: "+r)}},makeStExternalData:function(e,t){var r=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassExternalAddress],4);r.jsData=e;var i=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassExternalData],0);return i.pointers[0]=r,i.pointers[1]=t,i},primitiveCalloutToFFI:function(e,t){var r=t.pointers[1];if(!this.isKindOf(r,Squeak.splOb_ClassExternalFunction))return!1;for(var i=[],a=e-1;0<=a;a--)i.push(this.vm.stackValue(a));return this.calloutToFFI(e,r,i)},ffi_primitiveCalloutWithArgs:function(e){var t=this.stackNonInteger(1),r=this.stackNonInteger(0);return!!this.isKindOf(t,Squeak.splOb_ClassExternalFunction)&&this.calloutToFFI(e,t,r.pointers)},ffi_primitiveFFIGetLastError:function(e){return this.popNandPushIfOK(e+1,this.ffi_lastError)},ffi_primitiveFFIIntegerAt:function(e){var t=this.stackNonInteger(3),r=this.stackInteger(2),i=this.stackInteger(1),a=this.stackBoolean(0);if(!this.success)return!1;if(r<0||i<1||8=t.file.size)),!0)},primitiveFileClose:function(e){var t=this.stackNonInteger(0);return!(!this.success||!t.file)&&("string"==typeof t.file?this.fileConsoleFlush(t.file):(this.fileClose(t.file),this.vm.breakOut(),t.file=null),this.popNIfOK(e))},primitiveFileDelete:function(e){var t=this.stackNonInteger(0);if(!this.success)return!1;var r=this.filenameFromSqueak(t.bytesAsString());return this.success=Squeak.fileDelete(r),this.popNIfOK(e)},primitiveFileFlush:function(e){var t=this.stackNonInteger(0);return!(!this.success||!t.file)&&("string"==typeof t.file?this.fileConsoleFlush(t.file):(Squeak.flushFile(t.file),this.vm.breakOut()),this.popNIfOK(e))},primitiveFileGetPosition:function(e){var t=this.stackNonInteger(0);return!(!this.success||!t.file)&&(this.popNandPushIfOK(e+1,this.makeLargeIfNeeded(t.filePos)),!0)},makeFileHandle:function(e,t,r){var i=this.makeStString("squeakjs:"+e);return i.file=t,i.fileWrite=r,i.filePos=0,i},primitiveFileOpen:function(e){var t=this.stackBoolean(0),r=this.stackNonInteger(1);if(!this.success)return!1;var i=this.filenameFromSqueak(r.bytesAsString()),a=this.fileOpen(i,t);if(!a)return!1;var s=this.makeFileHandle(a.name,a,t);return this.popNandPushIfOK(e+1,s),!0},primitiveFileRead:function(a){var s=this.stackInteger(0),n=this.stackInteger(1)-1,e=this.stackNonInteger(2),o=this.stackNonInteger(3);if(!this.success||!e.isWordsOrBytes()||!o.file)return!1;if(!s)return this.popNandPushIfOK(a+1,0);var u=e.bytes;return u||(u=e.wordsAsUint8Array(),n*=4,s*=4),!(n<0||n+s>u.length)&&("string"==typeof o.file?(this.popNandPushIfOK(a+1,0),!0):this.fileContentsDo(o.file,function(e){if(!e.contents)return this.popNandPushIfOK(a+1,0);var t=e.contents,r=u;s=Math.min(s,e.size-o.filePos);for(var i=0;it&&(r.file.size=t,r.file.modified=!0,r.filePos>r.file.size&&(r.filePos=r.file.size)),this.popNIfOK(e))},primitiveDisableFileAccess:function(e){return this.fakePrimitive("FilePlugin.primitiveDisableFileAccess",0,e)},primitiveFileWrite:function(s){var n=this.stackInteger(0),o=this.stackInteger(1)-1,e=this.stackNonInteger(2),u=this.stackNonInteger(3);if(!this.success||!u.file||!u.fileWrite)return!1;if(!n)return this.popNandPushIfOK(s+1,0);var l=e.bytes;return l||(l=e.wordsAsUint8Array(),o*=4,n*=4),!!l&&(!(o<0||o+n>l.length)&&("string"==typeof u.file?(this.fileConsoleWrite(u.file,l,o,n),this.popNandPushIfOK(s+1,n),!0):this.fileContentsDo(u.file,function(e){var t=l,r=e.contents||[];if(u.filePos+n>r.length){var i=0===r.length?u.filePos+n:Math.max(u.filePos+n,r.length+1e4);e.contents=new Uint8Array(i),e.contents.set(r),r=e.contents}for(var a=0;ae.size&&(e.size=u.filePos),e.modified=!0,this.popNandPushIfOK(s+1,n)}.bind(this))))},fileOpen:function(e,t){"undefined"==typeof SqueakFiles&&(window.SqueakFiles={});var r=Squeak.splitFilePath(e);if(!r.basename)return null;var i=Squeak.dirList(r.dirname,!0);if(!i)return null;var a=i[r.basename],s=null;if(a){if(n=SqueakFiles[r.fullname])return++n.refCount,n}else{if(!t)return console.log("File not found: "+r.fullname),null;if(s=new Uint8Array,!(a=Squeak.filePut(r.fullname,s.buffer)))return console.log("Cannot create file: "+r.fullname),null}var n={name:r.fullname,size:a[4],contents:s,modified:!1,refCount:1};return SqueakFiles[n.name]=n},fileClose:function(e){Squeak.flushFile(e),0==--e.refCount&&delete SqueakFiles[e.name]},fileContentsDo:function(i,a){if(i.contents)a(i);else{if(!1===i.contents)return!1;this.vm.freeze(function(t){var r=function(e){console.log("File get failed: "+e),i.contents=!1,t(),a(i)}.bind(this),e=function(e){if(null==e)return r(i.name);i.contents=this.asUint8Array(e),t(),a(i)}.bind(this);Squeak.fileGet(i.name,e,r)}.bind(this))}return!0},fileConsoleBuffer:{log:"",error:""},fileConsoleWrite:function(e,t,r,i){var a=t.subarray(r,r+i),s=this.fileConsoleBuffer[e]+Squeak.bytesAsString(a),n=s.match("([^]*)\n(.*)");n&&(console[e](n[1]),s=n[2]),this.fileConsoleBuffer[e]=s},fileConsoleFlush:function(e){var t=this.fileConsoleBuffer[e];t&&(console[e](t),this.fileConsoleBuffer[e]="")}}),Object.extend(Squeak.Primitives.prototype,"JPEGReadWriter2Plugin",{jpeg2_primJPEGPluginIsPresent:function(e){return this.popNandPushIfOK(e+1,this.vm.trueObj)},jpeg2_primImageHeight:function(e){var t=this.stackNonInteger(0).wordsOrBytes();if(!t)return!1;var r=t[1];return this.popNandPushIfOK(e+1,r)},jpeg2_primImageWidth:function(e){var t=this.stackNonInteger(0).wordsOrBytes();if(!t)return!1;var r=t[0];return this.popNandPushIfOK(e+1,r)},jpeg2_primJPEGCompressStructSize:function(e){return this.popNandPushIfOK(e+1,0)},jpeg2_primJPEGDecompressStructSize:function(e){return this.popNandPushIfOK(e+1,8)},jpeg2_primJPEGErrorMgr2StructSize:function(e){return this.popNandPushIfOK(e+1,0)},jpeg2_primJPEGReadHeaderfromByteArrayerrorMgr:function(e){var t=this.stackNonInteger(2).wordsOrBytes(),r=this.stackNonInteger(1).bytes;if(!t||!r)return!1;var i=this.vm.freeze();return this.jpeg2_readImageFromBytes(r,function(e){this.jpeg2state={src:r,img:e},t[0]=e.width,t[1]=e.height,i()}.bind(this),function(){t[0]=0,t[1]=0,i()}.bind(this)),this.popNIfOK(e)},jpeg2_primJPEGReadImagefromByteArrayonFormdoDitheringerrorMgr:function(e){var t=this.stackNonInteger(3).bytes,r=this.stackNonInteger(2).pointers,i=this.stackBoolean(1);if(!this.success||!t||!r)return!1;var a=this.jpeg2state;if(!a||a.src!==t)return console.error("jpeg read did not match header info"),!1;var s=r[Squeak.Form_depth],n=this.jpeg2_getPixelsFromImage(a.img),o=r[Squeak.Form_bits].words;if(32===s)this.jpeg2_copyPixelsToForm32(n,o);else{if(16!==s)return!1;i?this.jpeg2_ditherPixelsToForm16(n,o):this.jpeg2_copyPixelsToForm16(n,o)}return this.popNIfOK(e)},jpeg2_primJPEGWriteImageonByteArrayformqualityprogressiveJPEGerrorMgr:function(e){return this.vm.warnOnce("JPEGReadWritePlugin2: writing not implemented yet"),!1},jpeg2_readImageFromBytes:function(e,t,r){var i=new Blob([e],{type:"image/jpeg"}),a=new Image;a.onload=function(){t(a)},a.onerror=function(){console.warn("could not render JPEG"),r()},a.src=(window.URL||window.webkitURL).createObjectURL(i)},jpeg2_getPixelsFromImage:function(e){var t=document.createElement("canvas"),r=t.getContext("2d");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height)},jpeg2_copyPixelsToForm32:function(e,t){for(var r=e.data,i=0;i>3<<10|a[4*o+1]>>3<<5|a[4*o+2]>>3;0===u&&(u=1),0==(65535&(u=u<<16|a[4*o+4]>>3<<10|a[4*o+5]>>3<<5|a[4*o+6]>>3))&&(u|=1),t[o>>1]=u}},jpeg2_ditherPixelsToForm16:function(e,t){for(var r=e.width>>1,i=e.height,a=e.data,s=[2,0,14,12,1,3,13,15],n=[10,8,6,4,9,11,5,7],o=0;o>8)>>4,f=k<(15&l)?c+1:c,c=(l=496*d>>8)>>4,d=k<(15&l)?c+1:c,c=(l=496*p>>8)>>4,p=k<(15&l)?c+1:c,c=(l=496*b>>8)>>4,b=_<(15&l)?c+1:c,c=(l=496*m>>8)>>4,m=_<(15&l)?c+1:c,c=(l=496*v>>8)>>4;var S=f<<10|d<<5|p;0===S&&(S=1),0==(65535&(S=S<<16|b<<10|m<<5|(v=_<(15&l)?c+1:c)))&&(S|=1),t[h>>3]=S}}}),Object.extend(Squeak.Primitives.prototype,"ScratchPluginAdditions",{scratch_primitiveOpenURL:function(e){var t=this.stackNonInteger(0).bytesAsString();if(""==t)return!1;if(/^\/SqueakJS\//.test(t)){t=t.slice(10);var r=Squeak.splitFilePath(t),i=Squeak.Settings["squeak-template:"+r.dirname];i&&(t=JSON.parse(i).url+"/"+r.basename)}return window.open(t,"_blank"),this.popNIfOK(e)},scratch_primitiveGetFolderPath:function(e){var t,r=this.stackInteger(0);if(!this.success)return!1;switch(r){case 1:t="/"}return!!t&&(this.vm.popNandPush(e+1,this.makeStString(this.filenameToSqueak(t))),!0)}}),Object.extend(Squeak.Primitives.prototype,"SoundPlugin",{snd_primitiveSoundStart:function(e){return this.snd_primitiveSoundStartWithSemaphore(e)},snd_primitiveSoundStartWithSemaphore:function(e){var t=this.stackInteger(e-1),r=this.stackInteger(e-2),i=this.stackBoolean(e-3),a=3>8,r=255&e.charCodeAt(l/2),i=l/2+1>8:NaN):(t=255&e.charCodeAt((l-1)/2),(l+1)/2>8,i=255&e.charCodeAt((l+1)/2)):r=i=NaN),l+=3,a=t>>2,s=(3&t)<<4|r>>4,n=(15&r)<<2|i>>6,o=63&i,isNaN(r)?n=o=64:isNaN(i)&&(o=64),u=u+LZString$1._keyStr.charAt(a)+LZString$1._keyStr.charAt(s)+LZString$1._keyStr.charAt(n)+LZString$1._keyStr.charAt(o);return u},decompressFromBase64:function(e){if(null==e)return"";var t,r,i,a,s,n,o,u="",l=0,c=0,h=LZString$1._f;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c>4,i=(15&s)<<4|(n=LZString$1._keyStr.indexOf(e.charAt(c++)))>>2,a=(3&n)<<6|(o=LZString$1._keyStr.indexOf(e.charAt(c++))),l%2==0?(t=r<<8,64!=n&&(u+=h(t|i)),64!=o&&(t=a<<8)):(u+=h(t|r),64!=n&&(t=i<<8),64!=o&&(u+=h(t|a))),l+=3;return LZString$1.decompress(u)},compressToUTF16:function(e){if(null==e)return"";var t,r,i,a="",s=0,n=LZString$1._f;for(e=LZString$1.compress(e),t=0;t>1)),i=(1&r)<<14;break;case 1:a+=n(i+(r>>2)+32),i=(3&r)<<13;break;case 2:a+=n(i+(r>>3)+32),i=(7&r)<<12;break;case 3:a+=n(i+(r>>4)+32),i=(15&r)<<11;break;case 4:a+=n(i+(r>>5)+32),i=(31&r)<<10;break;case 5:a+=n(i+(r>>6)+32),i=(63&r)<<9;break;case 6:a+=n(i+(r>>7)+32),i=(127&r)<<8;break;case 7:a+=n(i+(r>>8)+32),i=(255&r)<<7;break;case 8:a+=n(i+(r>>9)+32),i=(511&r)<<6;break;case 9:a+=n(i+(r>>10)+32),i=(1023&r)<<5;break;case 10:a+=n(i+(r>>11)+32),i=(2047&r)<<4;break;case 11:a+=n(i+(r>>12)+32),i=(4095&r)<<3;break;case 12:a+=n(i+(r>>13)+32),i=(8191&r)<<2;break;case 13:a+=n(i+(r>>14)+32),i=(16383&r)<<1;break;case 14:a+=n(i+(r>>15)+32,32+(32767&r)),s=0}return a+n(i+32)},decompressFromUTF16:function(e){if(null==e)return"";for(var t,r,i="",a=0,s=0,n=LZString$1._f;s>14),t=(16383&r)<<2;break;case 2:i+=n(t|r>>13),t=(8191&r)<<3;break;case 3:i+=n(t|r>>12),t=(4095&r)<<4;break;case 4:i+=n(t|r>>11),t=(2047&r)<<5;break;case 5:i+=n(t|r>>10),t=(1023&r)<<6;break;case 6:i+=n(t|r>>9),t=(511&r)<<7;break;case 7:i+=n(t|r>>8),t=(255&r)<<8;break;case 8:i+=n(t|r>>7),t=(127&r)<<9;break;case 9:i+=n(t|r>>6),t=(63&r)<<10;break;case 10:i+=n(t|r>>5),t=(31&r)<<11;break;case 11:i+=n(t|r>>4),t=(15&r)<<12;break;case 12:i+=n(t|r>>3),t=(7&r)<<13;break;case 13:i+=n(t|r>>2),t=(3&r)<<14;break;case 14:i+=n(t|r>>1),t=(1&r)<<15;break;case 15:i+=n(t|r),a=0}s++}return LZString$1.decompress(i)},compress:function(e){if(null==e)return"";var t,r,i,a={},s={},n="",o="",u="",l=2,c=3,h=2,f="",d=0,p=0,b=LZString$1._f;for(i=0;i>=1}else{for(r=1,t=0;t>=1}0==--l&&(l=Math.pow(2,h),h++),delete s[u]}else for(r=a[u],t=0;t>=1;0==--l&&(l=Math.pow(2,h),h++),a[o]=c++,u=String(n)}if(""!==u){if(Object.prototype.hasOwnProperty.call(s,u)){if(u.charCodeAt(0)<256){for(t=0;t>=1}else{for(r=1,t=0;t>=1}0==--l&&(l=Math.pow(2,h),h++),delete s[u]}else for(r=a[u],t=0;t>=1;0==--l&&(l=Math.pow(2,h),h++)}for(r=2,t=0;t>=1;for(;;){if(d<<=1,15==p){f+=b(d);break}p++}return f},decompress:function(e){if(null==e)return"";if(""==e)return null;var t,r,i,a,s,n,o,u=[],l=4,c=4,h=3,f="",d="",p=LZString$1._f,b={string:e,val:e.charCodeAt(0),position:32768,index:1};for(t=0;t<3;t+=1)u[t]=t;for(i=0,s=Math.pow(2,2),n=1;n!=s;)a=b.val&b.position,b.position>>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0b.string.length)return"";for(i=0,s=Math.pow(2,h),n=1;n!=s;)a=b.val&b.position,b.position>>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0>2,s=(3&t)<<4|r>>4,n=1>6:64,o=2>4,r=(15&a)<<4|(s=p.indexOf(e.charAt(u++)))>>2,i=(3&s)<<6|(n=p.indexOf(e.charAt(u++))),o[l++]=t,64!==s&&(o[l++]=r),64!==n&&(o[l++]=i);return o}},{"./support":27,"./utils":29}],2:[function(e,t,r){var i=e("./external"),a=e("./stream/DataWorker"),s=e("./stream/DataLengthProbe"),n=e("./stream/Crc32Probe");s=e("./stream/DataLengthProbe");function o(e,t,r,i,a){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=i,this.compressedContent=a}o.prototype={getContentWorker:function(){var e=new a(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new a(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new n).pipe(new s("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new s("compressedSize")).withStreamInfo("compression",t)},t.exports=o},{"./external":6,"./stream/Crc32Probe":22,"./stream/DataLengthProbe":23,"./stream/DataWorker":24}],3:[function(e,t,r){var i=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(e){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":25}],4:[function(e,t,r){var i=e("./utils");var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?("string"!==i.getTypeOf(e)?function(e,t,r,i){var a=o,s=i+r;e^=-1;for(var n=i;n>>8^a[255&(e^t[n])];return-1^e}:function(e,t,r,i){var a=o,s=i+r;e^=-1;for(var n=i;n>>8^a[255&(e^t.charCodeAt(n))];return-1^e})(0|t,e,e.length,0):0}},{"./utils":29}],5:[function(e,t,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){var i=e("es6-promise").Promise;t.exports={Promise:i}},{"es6-promise":37}],7:[function(e,t,r){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,a=e("pako"),s=e("./utils"),n=e("./stream/GenericWorker"),o=i?"uint8array":"array";function u(e,t){n.call(this,"FlateWorker/"+e),this._pako=new a[e]({raw:!0,level:t.level||-1}),this.meta={};var r=this;this._pako.onData=function(e){r.push({data:e,meta:r.meta})}}r.magic="\b\0",s.inherits(u,n),u.prototype.processChunk=function(e){this.meta=e.meta,this._pako.push(s.transformTo(o,e.data),!1)},u.prototype.flush=function(){n.prototype.flush.call(this),this._pako.push([],!0)},u.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this._pako=null},r.compressWorker=function(e){return new u("Deflate",e)},r.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":25,"./utils":29,pako:38}],8:[function(e,t,r){function $(e,t){var r,i="";for(r=0;r>>=8;return i}function i(e,t,r,i,a,s){var n,o,u=e.file,l=e.compression,c=s!==Y.utf8encode,h=V.transformTo("string",s(u.name)),f=V.transformTo("string",Y.utf8encode(u.name)),d=u.comment,p=V.transformTo("string",s(d)),b=V.transformTo("string",Y.utf8encode(d)),m=f.length!==u.name.length,v=b.length!==d.length,g="",k="",_="",S=u.dir,y=u.date,I={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(I.crc32=e.crc32,I.compressedSize=e.compressedSize,I.uncompressedSize=e.uncompressedSize);var O=0;t&&(O|=8),c||!m&&!v||(O|=2048);var w,F,C,x=0,A=0;S&&(x|=16),"UNIX"===a?(A=798,x|=(w=u.unixPermissions,F=S,(C=w)||(C=F?16893:33204),(65535&C)<<16)):(A=20,x|=63&(u.dosPermissions||0)),n=y.getUTCHours(),n<<=6,n|=y.getUTCMinutes(),n<<=5,n|=y.getUTCSeconds()/2,o=y.getUTCFullYear()-1980,o<<=4,o|=y.getUTCMonth()+1,o<<=5,o|=y.getUTCDate(),m&&(k=$(1,1)+$(M(h),4)+f,g+="up"+$(k.length,2)+k),v&&(_=$(1,1)+$(M(p),4)+b,g+="uc"+$(_.length,2)+_);var P="";return P+="\n\0",P+=$(O,2),P+=l.magic,P+=$(n,2),P+=$(o,2),P+=$(I.crc32,4),P+=$(I.compressedSize,4),P+=$(I.uncompressedSize,4),P+=$(h.length,2),P+=$(g.length,2),{fileRecord:j.LOCAL_FILE_HEADER+P+h+g,dirRecord:j.CENTRAL_FILE_HEADER+$(A,2)+P+$(p.length,2)+"\0\0\0\0"+$(x,4)+$(i,4)+h+g+p}}var V=e("../utils"),a=e("../stream/GenericWorker"),Y=e("../utf8"),M=e("../crc32"),j=e("../signature");function s(e,t,r,i){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}V.inherits(s,a),s.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,a.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-i-1))/r:100}}))},s.prototype.openedSource=function(e){if(this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name,this.streamFiles&&!e.file.dir){var t=i(e,this.streamFiles,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:t.fileRecord,meta:{percent:0}})}else this.accumulate=!0},s.prototype.closedSource=function(e){this.accumulate=!1;var t,r=i(e,this.streamFiles,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),this.streamFiles&&!e.file.dir)this.push({data:(t=e,j.DATA_DESCRIPTOR+$(t.crc32,4)+$(t.compressedSize,4)+$(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},s.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=a},{"../utils":29}],16:[function(e,t,r){var i=e("./Uint8ArrayReader");function a(e){i.call(this,e)}e("../utils").inherits(a,i),a.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=a},{"../utils":29,"./Uint8ArrayReader":18}],17:[function(e,t,r){var i=e("./DataReader");function a(e){i.call(this,e)}e("../utils").inherits(a,i),a.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},a.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},a.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},a.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=a},{"../utils":29,"./DataReader":15}],18:[function(e,t,r){var i=e("./ArrayReader");function a(e){i.call(this,e)}e("../utils").inherits(a,i),a.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=a},{"../utils":29,"./ArrayReader":14}],19:[function(e,t,r){var i=e("../utils"),a=e("../support"),s=e("./ArrayReader"),n=e("./StringReader"),o=e("./NodeBufferReader"),u=e("./Uint8ArrayReader");t.exports=function(e){var t=i.getTypeOf(e);return i.checkSupport(t),"string"!==t||a.uint8array?"nodebuffer"===t?new o(e):a.uint8array?new u(i.transformTo("uint8array",e)):new s(i.transformTo("array",e)):new n(e)}},{"../support":27,"../utils":29,"./ArrayReader":14,"./NodeBufferReader":16,"./StringReader":17,"./Uint8ArrayReader":18}],20:[function(e,t,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],21:[function(e,t,r){var i=e("./GenericWorker"),a=e("../utils");function s(e){i.call(this,"ConvertWorker to "+e),this.destType=e}a.inherits(s,i),s.prototype.processChunk=function(e){this.push({data:a.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":29,"./GenericWorker":25}],22:[function(e,t,r){var i=e("./GenericWorker"),a=e("../crc32");function s(){i.call(this,"Crc32Probe")}e("../utils").inherits(s,i),s.prototype.processChunk=function(e){this.streamInfo.crc32=a(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":29,"./GenericWorker":25}],23:[function(e,t,r){var i=e("../utils"),a=e("./GenericWorker");function s(e){a.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}i.inherits(s,a),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}a.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":29,"./GenericWorker":25}],24:[function(e,t,r){var i=e("../utils"),a=e("./GenericWorker");function s(e){a.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}i.inherits(s,a),s.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":29,"./GenericWorker":25}],25:[function(e,t,r){function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r "+e:e}},t.exports=i},{}],26:[function(n,o,e){(function(u){var l=n("../utils"),a=n("./ConvertWorker"),s=n("./GenericWorker"),c=n("../base64"),t=n("../nodejs/NodejsStreamOutputAdapter"),r=n("../external");function i(e,o){return new r.Promise(function(t,r){var i=[],a=e._internalType,s=e._outputType,n=e._mimeType;e.on("data",function(e,t){i.push(e),o&&o(t)}).on("error",function(e){i=[],r(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return l.newBlob(l.transformTo("arraybuffer",t),r);case"base64":return c.encode(t);default:return l.transformTo(e,t)}}(s,function(e,t){var r,i=0,a=null,s=0;for(r=0;r>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},s.utf8decode=function(e){return u.nodebuffer?o.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,i,a,s=e.length,n=new Array(2*s);for(t=r=0;t>10&1023,n[r++]=56320|1023&i)}return n.length!==r&&(n.subarray?n=n.subarray(0,r):n.length=r),o.applyFromCharCode(n)}(e=o.transformTo(u.uint8array?"uint8array":"array",e))},o.inherits(n,i),n.prototype.processChunk=function(e){var t=o.transformTo(u.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(u.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var i=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return!(r<0)&&0!==r&&r+l[e[r]]>t?r:t}(t),a=t;i!==t.length&&(u.uint8array?(a=t.subarray(0,i),this.leftOver=t.subarray(i,t.length)):(a=t.slice(0,i),this.leftOver=t.slice(i,t.length))),this.push({data:s.utf8decode(a),meta:e.meta})},n.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=n,o.inherits(c,i),c.prototype.processChunk=function(e){this.push({data:s.utf8encode(e.data),meta:e.meta})},s.Utf8EncodeWorker=c},{"./nodejsUtils":12,"./stream/GenericWorker":25,"./support":27,"./utils":29}],29:[function(e,t,u){var l=e("./support"),c=e("./base64"),r=e("./nodejsUtils"),i=e("asap"),h=e("./external");function a(e){return e}function f(e,t){for(var r=0;r>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,r,i,a=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return c(e,e.length)},r.binstring2buf=function(e){for(var t=new u.Buf8(e.length),r=0,i=t.length;r>10&1023,o[i++]=56320|1023&a)}return c(o,i)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return!(r<0)&&0!==r&&r+l[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){t.exports=function(e,t,r,i){for(var a=65535&e|0,s=e>>>16&65535|0,n=0;0!==r;){for(r-=n=2e3>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,i){var a=o,s=i+r;e^=-1;for(var n=i;n>>8^a[255&(e^t[n])];return-1^e}},{}],46:[function(e,t,r){var u,f=e("../utils/common"),l=e("./trees"),d=e("./adler32"),p=e("./crc32"),i=e("./messages"),c=0,h=4,b=0,m=-2,v=-1,g=4,a=2,k=8,_=9,s=286,n=30,o=19,S=2*s+1,y=15,I=3,O=258,w=O+I+1,F=42,C=113,x=1,A=2,P=3,$=4;function V(e,t){return e.msg=i[t],t}function Y(e){return(e<<1)-(4e.avail_out&&(r=e.avail_out),0!==r&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function N(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,j(e.strm)}function q(e,t){e.pending_buf[e.pending++]=t}function B(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function W(e,t){var r,i,a=e.max_chain_length,s=e.strstart,n=e.prev_length,o=e.nice_match,u=e.strstart>e.w_size-w?e.strstart-(e.w_size-w):0,l=e.window,c=e.w_mask,h=e.prev,f=e.strstart+O,d=l[s+n-1],p=l[s+n];e.prev_length>=e.good_match&&(a>>=2),o>e.lookahead&&(o=e.lookahead);do{if(l[(r=t)+n]===p&&l[r+n-1]===d&&l[r]===l[s]&&l[++r]===l[s+1]){s+=2,r++;do{}while(l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&su&&0!=--a);return n<=e.lookahead?n:e.lookahead}function E(e){var t,r,i,a,s,n,o,u,l,c,h=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=h+(h-w)){for(f.arraySet(e.window,e.window,h,h,0),e.match_start-=h,e.strstart-=h,e.block_start-=h,t=r=e.hash_size;i=e.head[--t],e.head[t]=h<=i?i-h:0,--r;);for(t=r=h;i=e.prev[--t],e.prev[t]=h<=i?i-h:0,--r;);a+=h}if(0===e.strm.avail_in)break;if(n=e.strm,o=e.window,u=e.strstart+e.lookahead,l=a,c=void 0,c=n.avail_in,l=I)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<=I&&(e.ins_h=(e.ins_h<=I)if(i=l._tr_tally(e,e.strstart-e.match_start,e.match_length-I),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=I){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=I&&(e.ins_h=(e.ins_h<=I&&e.match_length<=e.prev_length){for(a=e.strstart+e.lookahead-I,i=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-I),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=a&&(e.ins_h=(e.ins_h<>1,o.l_buf=3*o.lit_bufsize,o.level=t,o.strategy=s,o.method=r,U(e)}u=[new R(0,0,0,0,function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(E(e),0===e.lookahead&&t===c)return x;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,N(e,!1),0===e.strm.avail_out))return x;if(e.strstart-e.block_start>=e.w_size-w&&(N(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===h?(N(e,!0),0===e.strm.avail_out?P:$):(e.strstart>e.block_start&&(N(e,!1),e.strm.avail_out),x)}),new R(4,4,8,4,L),new R(4,5,16,8,L),new R(4,6,32,32,L),new R(4,4,16,16,T),new R(8,16,32,32,T),new R(8,16,128,128,T),new R(8,32,128,256,T),new R(32,128,258,1024,T),new R(32,258,258,4096,T)],r.deflateInit=function(e,t){return z(e,t,k,15,8,0)},r.deflateInit2=z,r.deflateReset=U,r.deflateResetKeep=D,r.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?m:(e.state.gzhead=t,b)},r.deflate=function(e,t){var r,i,a,s;if(!e||!e.state||5>8&255),q(i,i.gzhead.time>>16&255),q(i,i.gzhead.time>>24&255),q(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),q(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(q(i,255&i.gzhead.extra.length),q(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=p(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(q(i,0),q(i,0),q(i,0),q(i,0),q(i,0),q(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),q(i,3),i.status=C);else{var n=k+(i.w_bits-8<<4)<<8;n|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(n|=32),n+=31-n%31,i.status=C,B(i,n),0!==i.strstart&&(B(i,e.adler>>>16),B(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),j(e),a=i.pending,i.pending!==i.pending_buf_size));)q(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),j(e),a=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindexa&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),0===s&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),j(e),a=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindexa&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),0===s&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&j(e),i.pending+2<=i.pending_buf_size&&(q(i,255&e.adler),q(i,e.adler>>8&255),e.adler=0,i.status=C)):i.status=C),0!==i.pending){if(j(e),0===e.avail_out)return i.last_flush=-1,b}else if(0===e.avail_in&&Y(t)<=Y(r)&&t!==h)return V(e,-5);if(666===i.status&&0!==e.avail_in)return V(e,-5);if(0!==e.avail_in||0!==i.lookahead||t!==c&&666!==i.status){var o=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(E(e),0===e.lookahead)){if(t===c)return x;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(N(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===h?(N(e,!0),0===e.strm.avail_out?P:$):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?x:A}(i,t):3===i.strategy?function(e,t){for(var r,i,a,s,n=e.window;;){if(e.lookahead<=O){if(E(e),e.lookahead<=O&&t===c)return x;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=I&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=I?(r=l._tr_tally(e,1,e.match_length-I),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(N(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===h?(N(e,!0),0===e.strm.avail_out?P:$):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?x:A}(i,t):u[i.level].func(i,t);if(o!==P&&o!==$||(i.status=666),o===x||o===P)return 0===e.avail_out&&(i.last_flush=-1),b;if(o===A&&(1===t?l._tr_align(i):5!==t&&(l._tr_stored_block(i,0,0,!1),3===t&&(M(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),j(e),0===e.avail_out))return i.last_flush=-1,b}return t!==h?b:i.wrap<=0?1:(2===i.wrap?(q(i,255&e.adler),q(i,e.adler>>8&255),q(i,e.adler>>16&255),q(i,e.adler>>24&255),q(i,255&e.total_in),q(i,e.total_in>>8&255),q(i,e.total_in>>16&255),q(i,e.total_in>>24&255)):(B(i,e.adler>>>16),B(i,65535&e.adler)),j(e),0=r.w_size&&(0===s&&(M(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),n=e.avail_in,o=e.next_in,u=e.input,e.avail_in=c,e.next_in=0,e.input=t,E(r);r.lookahead>=I;){for(i=r.strstart,a=r.lookahead-(I-1);r.ins_h=(r.ins_h<>>=_=k>>>24,p-=_,0===(_=k>>>16&255))F[s++]=65535&k;else{if(!(16&_)){if(0==(64&_)){k=b[(65535&k)+(d&(1<<_)-1)];continue t}if(32&_){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}S=65535&k,(_&=15)&&(p<_&&(d+=w[i++]<>>=_,p-=_),p<15&&(d+=w[i++]<>>=_=k>>>24,p-=_,!(16&(_=k>>>16&255))){if(0==(64&_)){k=m[(65535&k)+(d&(1<<_)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(y=65535&k,p<(_&=15)&&(d+=w[i++]<>>=_,p-=_,(_=s-n)>3,d&=(1<<(p-=S<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new A.Buf16(320),this.work=new A.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function n(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=B,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new A.Buf32(i),t.distcode=t.distdyn=new A.Buf32(a),t.sane=1,t.back=-1,N):q}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,n(e)):q}function u(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(A.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(a=s.wsize-s.wnext)&&(a=i),A.arraySet(s.window,t,r-i,a,s.wnext),(i-=a)?(A.arraySet(s.window,t,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=a,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=$(r.check,C,2,0),c=l=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&l)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,y=8+(15&(l>>>=4)),0===r.wbits)r.wbits=y;else if(y>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(C[0]=255&l,C[1]=l>>>8&255,r.check=$(r.check,C,2,0)),c=l=0,r.mode=3;case 3:for(;c<32;){if(0===o)break e;o--,l+=i[s++]<>>8&255,C[2]=l>>>16&255,C[3]=l>>>24&255,r.check=$(r.check,C,4,0)),c=l=0,r.mode=4;case 4:for(;c<16;){if(0===o)break e;o--,l+=i[s++]<>8),512&r.flags&&(C[0]=255&l,C[1]=l>>>8&255,r.check=$(r.check,C,2,0)),c=l=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===o)break e;o--,l+=i[s++]<>>8&255,r.check=$(r.check,C,2,0)),c=l=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(d=r.length)&&(d=o),d&&(r.head&&(y=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),A.arraySet(r.head.extra,i,s,d,y)),512&r.flags&&(r.check=$(r.check,i,d,s)),o-=d,s+=d,r.length-=d),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break e;for(d=0;y=i[s+d++],r.head&&y&&r.length<65536&&(r.head.name+=String.fromCharCode(y)),y&&d>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===o)break e;o--,l+=i[s++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===o)break e;o--,l+=i[s++]<>>=1)){case 0:r.mode=14;break;case 1:if(E(r),r.mode=20,6!==t)break;l>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}l>>>=2,c-=2;break;case 14:for(l>>>=7&c,c-=7&c;c<32;){if(0===o)break e;o--,l+=i[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&l,c=l=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(d=r.length){if(o>>=5,c-=5,r.ndist=1+(31&l),l>>>=5,c-=5,r.ncode=4+(15&l),l>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[x[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,O={bits:r.lenbits},I=Y(0,r.lens,0,19,r.lencode,0,r.work,O),r.lenbits=O.bits,I){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,g=65535&F,!((m=F>>>24)<=c);){if(0===o)break e;o--,l+=i[s++]<>>=m,c-=m,r.lens[r.have++]=g;else{if(16===g){for(w=m+2;c>>=m,c-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}y=r.lens[r.have-1],d=3+(3&l),l>>>=2,c-=2}else if(17===g){for(w=m+3;c>>=m)),l>>>=3,c-=3}else{for(w=m+7;c>>=m)),l>>>=7,c-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;d--;)r.lens[r.have++]=y}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,O={bits:r.lenbits},I=Y(M,r.lens,0,r.nlen,r.lencode,0,r.work,O),r.lenbits=O.bits,I){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,O={bits:r.distbits},I=Y(j,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,O),r.distbits=O.bits,I){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=o&&258<=u){e.next_out=n,e.avail_out=u,e.next_in=s,e.avail_in=o,r.hold=l,r.bits=c,V(e,f),n=e.next_out,a=e.output,u=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,l=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;v=(F=r.lencode[l&(1<>>16&255,g=65535&F,!((m=F>>>24)<=c);){if(0===o)break e;o--,l+=i[s++]<>k)])>>>16&255,g=65535&F,!(k+(m=F>>>24)<=c);){if(0===o)break e;o--,l+=i[s++]<>>=k,c-=k,r.back+=k}if(l>>>=m,c-=m,r.back+=m,r.length=g,0===v){r.mode=26;break}if(32&v){r.back=-1,r.mode=12;break}if(64&v){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&v,r.mode=22;case 22:if(r.extra){for(w=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;v=(F=r.distcode[l&(1<>>16&255,g=65535&F,!((m=F>>>24)<=c);){if(0===o)break e;o--,l+=i[s++]<>k)])>>>16&255,g=65535&F,!(k+(m=F>>>24)<=c);){if(0===o)break e;o--,l+=i[s++]<>>=k,c-=k,r.back+=k}if(l>>>=m,c-=m,r.back+=m,64&v){e.msg="invalid distance code",r.mode=30;break}r.offset=g,r.extra=15&v,r.mode=24;case 24:if(r.extra){for(w=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===u)break e;if(d=f-u,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}p=d>r.wnext?(d-=r.wnext,r.wsize-d):r.wnext-d,d>r.length&&(d=r.length),b=r.window}else b=a,p=n-r.offset,d=r.length;for(ud?(b=V[Y+n[k]],x[A+n[k]]):(b=96,0),u=1<>O)+(l-=u)]=p<<24|b<<16|m|0,0!==l;);for(u=1<>=1;if(0!==u?(C&=u-1,C+=u):C=0,k++,0==--P[g]){if(g===S)break;g=t[r+n[k]]}if(y>>7)]}function q(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function B(e,t,r){e.bi_valid>a-r?(e.bi_buf|=t<>a-e.bi_valid,e.bi_valid+=r-a):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function L(e,t,r){var i,a,s=new Array(v+1),n=0;for(i=1;i<=v;i++)s[i]=n=n+r[i-1]<<1;for(a=0;a<=t;a++){var o=e[2*a+1];0!==o&&(e[2*a]=E(s[o]++,o))}}function T(e){var t;for(t=0;t>1;1<=r;r--)D(e,s,r);for(a=u;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],D(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,s[2*a]=s[2*r]+s[2*i],e.depth[a]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,s[2*r+1]=s[2*i+1]=a,e.heap[1]=a++,D(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,a,s,n,o,u=t.dyn_tree,l=t.max_code,c=t.stat_desc.static_tree,h=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,b=0;for(s=0;s<=v;s++)e.bl_count[s]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r>=7;i>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return o;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return l;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=a&&(a=s)):a=s=r+5,r+4<=a&&-1!==t?Z(e,t,r,i):4===e.strategy||s===a?(B(e,2+(i?1:0),3),U(e,F,C)):(B(e,4+(i?1:0),3),function(e,t,r,i){var a;for(B(e,t-257,5),B(e,r-1,5),B(e,i-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(A[r]+h+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){var t;B(e,2,3),W(e,g,F),16===(t=e).bi_valid?(q(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,r){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}]},{},[10])(10)}),function(o){if(!(void 0===o||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var e=o.document,u=function(){return o.URL||o.webkitURL||o},l=e.createElementNS("http://www.w3.org/1999/xhtml","a"),c="download"in l,h=/constructor/i.test(o.HTMLElement)||o.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent),d=o.setImmediate||o.setTimeout,p=function(e){d(function(){throw e},0)},b=function(e){setTimeout(function(){"string"==typeof e?u().revokeObjectURL(e):e.remove()},4e4)},m=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},i=function(e,r,t){t||(e=m(e));function i(){!function(e,t,r){for(var i=(t=[].concat(t)).length;i--;){var a=e["on"+t[i]];if("function"==typeof a)try{a.call(e,r||e)}catch(e){p(e)}}}(s,"writestart progress write writeend".split(" "))}var a,s=this,n="application/octet-stream"===e.type;if(s.readyState=s.INIT,c)return a=u().createObjectURL(e),void d(function(){var e,t;l.href=a,l.download=r,e=l,t=new MouseEvent("click"),e.dispatchEvent(t),i(),b(a),s.readyState=s.DONE},0);!function(){if((f||n&&h)&&o.FileReader){var t=new FileReader;return t.onloadend=function(){var e=f?t.result:t.result.replace(/^data:[^;]*;/,"data:attachment/file;");o.open(e,"_blank")||(o.location.href=e),e=void 0,s.readyState=s.DONE,i()},t.readAsDataURL(e),s.readyState=s.INIT}(a=a||u().createObjectURL(e),n)?o.location.href=a:o.open(a,"_blank")||(o.location.href=a);s.readyState=s.DONE,i(),b(a)}()},t=i.prototype;if("undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob)return;t.abort=function(){},t.readyState=t.INIT=0,t.WRITING=1,t.DONE=2,t.error=t.onwritestart=t.onprogress=t.onwrite=t.onabort=t.onerror=t.onwriteend=null,o.FileSaver_saveAs=function(e,t,r){return new i(e,t||e.name||"download",r)}}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||void 0),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=global);var COMMON_JS=!root.JS_SHA1_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD="function"==typeof define&&define.amd,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[],createOutputMethod=function(t){return function(e){return new Sha1(!0).update(e)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Sha1},t.update=function(e){return t.create().update(e)};for(var e=0;e>2]|=e[a]<>2]|=r<>2]|=(192|r>>6)<>2]|=(224|r>>12)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<>2]|=EXTRA[3&t],this.block=e[16],56<=t&&(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,r=this.h0,i=this.h1,a=this.h2,s=this.h3,n=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)r=(t=(i=(t=(a=(t=(s=(t=(n=(t=r<<5|r>>>27)+(i&a|~i&s)+n+1518500249+o[e]<<0)<<5|n>>>27)+(r&(i=i<<30|i>>>2)|~r&a)+s+1518500249+o[e+1]<<0)<<5|s>>>27)+(n&(r=r<<30|r>>>2)|~n&i)+a+1518500249+o[e+2]<<0)<<5|a>>>27)+(s&(n=n<<30|n>>>2)|~s&r)+i+1518500249+o[e+3]<<0)<<5|i>>>27)+(a&(s=s<<30|s>>>2)|~a&n)+r+1518500249+o[e+4]<<0,a=a<<30|a>>>2;for(;e<40;e+=5)r=(t=(i=(t=(a=(t=(s=(t=(n=(t=r<<5|r>>>27)+(i^a^s)+n+1859775393+o[e]<<0)<<5|n>>>27)+(r^(i=i<<30|i>>>2)^a)+s+1859775393+o[e+1]<<0)<<5|s>>>27)+(n^(r=r<<30|r>>>2)^i)+a+1859775393+o[e+2]<<0)<<5|a>>>27)+(s^(n=n<<30|n>>>2)^r)+i+1859775393+o[e+3]<<0)<<5|i>>>27)+(a^(s=s<<30|s>>>2)^n)+r+1859775393+o[e+4]<<0,a=a<<30|a>>>2;for(;e<60;e+=5)r=(t=(i=(t=(a=(t=(s=(t=(n=(t=r<<5|r>>>27)+(i&a|i&s|a&s)+n-1894007588+o[e]<<0)<<5|n>>>27)+(r&(i=i<<30|i>>>2)|r&a|i&a)+s-1894007588+o[e+1]<<0)<<5|s>>>27)+(n&(r=r<<30|r>>>2)|n&i|r&i)+a-1894007588+o[e+2]<<0)<<5|a>>>27)+(s&(n=n<<30|n>>>2)|s&r|n&r)+i-1894007588+o[e+3]<<0)<<5|i>>>27)+(a&(s=s<<30|s>>>2)|a&n|s&n)+r-1894007588+o[e+4]<<0,a=a<<30|a>>>2;for(;e<80;e+=5)r=(t=(i=(t=(a=(t=(s=(t=(n=(t=r<<5|r>>>27)+(i^a^s)+n-899497514+o[e]<<0)<<5|n>>>27)+(r^(i=i<<30|i>>>2)^a)+s-899497514+o[e+1]<<0)<<5|s>>>27)+(n^(r=r<<30|r>>>2)^i)+a-899497514+o[e+2]<<0)<<5|a>>>27)+(s^(n=n<<30|n>>>2)^r)+i-899497514+o[e+3]<<0)<<5|i>>>27)+(a^(s=s<<30|s>>>2)^n)+r-899497514+o[e+4]<<0,a=a<<30|a>>>2;this.h0=this.h0+r<<0,this.h1=this.h1+i<<0,this.h2=this.h2+a<<0,this.h3=this.h3+s<<0,this.h4=this.h4+n<<0},Sha1.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,i=this.h3,a=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[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]+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[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a]},Sha1.prototype.toString=Sha1.prototype.hex,Sha1.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,i=this.h3,a=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,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a]},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,AMD&&define(function(){return exports}))}(),Object.extend(Squeak,{vmPath:"/",platformSubtype:"Browser",osVersion:navigator.userAgent,windowSystem:"HTML"}),window.SqueakJS={};var canUseMouseOffset=navigator.userAgent.match("AppleWebKit/");function updateMousePos(e,t,r){var i=canUseMouseOffset?e.offsetX:e.layerX,a=canUseMouseOffset?e.offsetY:e.layerY;r.cursorCanvas&&(r.cursorCanvas.style.left=i+t.offsetLeft+r.cursorOffsetX+"px",r.cursorCanvas.style.top=a+t.offsetTop+r.cursorOffsetY+"px");var s=i*t.width/t.offsetWidth|0,n=a*t.height/t.offsetHeight|0;r.mouseX=Math.max(0,Math.min(r.width,s)),r.mouseY=Math.max(0,Math.min(r.height,n))}function recordMouseEvent(e,t,r,i,a){if(updateMousePos(t,r,i),i.vm){var s=i.buttons&Squeak.Mouse_All;switch(e){case"mousedown":switch(t.button||0){case 0:s=Squeak.Mouse_Red;break;case 1:s=Squeak.Mouse_Yellow;break;case 2:s=Squeak.Mouse_Blue}a.swapButtons&&(s==Squeak.Mouse_Yellow?s=Squeak.Mouse_Blue:s==Squeak.Mouse_Blue&&(s=Squeak.Mouse_Yellow));break;case"mousemove":break;case"mouseup":s=0}i.buttons=s|recordModifiers(t,i),i.eventQueue&&(i.eventQueue.push([Squeak.EventTypeMouse,t.timeStamp,i.mouseX,i.mouseY,i.buttons&Squeak.Mouse_All,i.buttons>>3]),i.signalInputEvent&&i.signalInputEvent()),i.idle=0,"mouseup"==e?i.runFor&&i.runFor(100):i.runNow&&i.runNow()}}function recordKeyboardEvent(e,t,r){if(r.vm){var i=r.buttons>>3<<8|e;r.eventQueue?(r.eventQueue.push([Squeak.EventTypeKeyboard,t,e,Squeak.EventKeyChar,r.buttons>>3,e]),r.signalInputEvent&&r.signalInputEvent(),r.keys[0]=i):i===r.vm.interruptKeycode?r.vm.interruptPending=!0:r.keys.push(i),r.idle=0,r.runNow&&r.runNow()}}function recordDragDropEvent(e,t,r,i){i.vm&&i.eventQueue&&(updateMousePos(t,r,i),i.eventQueue.push([Squeak.EventTypeDragDropFiles,t.timeStamp,e,i.mouseX,i.mouseY,i.buttons>>3,i.droppedFiles.length]),i.signalInputEvent&&i.signalInputEvent())}function fakeCmdOrCtrlKey(e,t,r){r.buttons&=~Squeak.Keyboard_All,r.buttons|=Squeak.Keyboard_Cmd|Squeak.Keyboard_Ctrl,r.keys=[],recordKeyboardEvent(e,t,r)}function makeSqueakEvent(e,t,r){t[0]=e[0],t[1]=e[1]-r&Squeak.MillisecondClockMask;for(var i=2;ib.width&&(r.font="bold 24px sans-serif"),r.textAlign="center",r.textBaseline="middle",r.fillText(e,b.width/2,b.height/2)},v.showProgress=function(e,t){t=t||{};var r=v.context,i=b.width/3|0,a=.5*b.width-i/2,s=.5*b.height+48;r.fillStyle=t.background||"#000",r.fillRect(a,s,i,24),r.lineWidth=2,r.strokeStyle=t.color||"#F90",r.strokeRect(a,s,i,24),r.fillStyle=t.color||"#F90",r.fillRect(a,s,i*e,24)},v.executeClipboardPaste=function(e,t){if(!v.vm)return!0;try{v.clipboardString=e,fakeCmdOrCtrlKey("v".charCodeAt(0),t,v)}catch(e){console.error("paste error "+e)}},v.executeClipboardCopy=function(e,t){if(!v.vm)return!0;v.clipboardStringChanged=!1,fakeCmdOrCtrlKey((e||"c").charCodeAt(0),t,v);for(var r=Date.now();!v.clipboardStringChanged&&Date.now()-r<500;)v.vm.interpret(20);if(v.clipboardStringChanged)try{return v.clipboardString}catch(e){console.error("copy error "+e)}},b.onmousedown=function(e){return o(),recordMouseEvent("mousedown",e,b,v,m),e.preventDefault(),!1},b.onmouseup=function(e){recordMouseEvent("mouseup",e,b,v,m),o(),e.preventDefault()},b.onmousemove=function(e){recordMouseEvent("mousemove",e,b,v,m),e.preventDefault()},b.oncontextmenu=function(){return!1};var g={state:"idle",button:0,x:0,y:0,dist:0,down:{}};function u(e){if(e.touches.length){g.x=g.y=0;for(var t=0;t',t.setAttribute("style","position:fixed;right:0;bottom:0;background-color:rgba(128,128,128,0.5);border-radius:5px"),b.parentElement.appendChild(t),t.onmousedown=function(e){b.contentEditable=!0,b.setAttribute("autocomplete","off"),b.setAttribute("autocorrect","off"),b.setAttribute("autocapitalize","off"),b.setAttribute("spellcheck","off"),b.focus(),e.preventDefault()},t.ontouchstart=t.onmousedown}function f(e){for(var t=0;t>>t}function HS(){return FS}function IS(e,t){var r,i,a;for((i=t-e)<0&&(i=0-i),r=63,a=1;a<=62;a++)63===r&&GS[a-1]>=i&&(r=a);return r}function JS(e){var t,r,i;for(r=0,t=e;;){if(!(0<(i=t-AS)))return r+=zS(CS,0-i),CS&=zS(255,8-(AS-=t)),r;r+=yS(CS,i),t-=AS,CS=DS[++BS-1],AS=8}}function KS(e,t){var r,i,a,s;for(i=t,a=e;;){if(!((s=(r=8-AS)-a)<0))return CS+=yS(i,s),AS+=a,self;CS+=zS(i,0-s),DS[++BS-1]=CS,i&=yS(1,(CS=AS=0)-s)-1,a-=r}}function LS(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m;if(e=ES.stackValue(1),t=ES.stackIntegerValue(0),p=ES.fetchIntegerofObject(0,e),f=ES.fetchIntegerofObject(1,e),u=ES.fetchIntegerofObject(2,e),c=ES.fetchIntegerofObject(3,e),l=ES.fetchIntegerofObject(4,e),h=ES.fetchIntegerofObject(5,e),CS=ES.fetchIntegerofObject(6,e),AS=ES.fetchIntegerofObject(7,e),BS=ES.fetchIntegerofObject(8,e),DS=ES.fetchBytesofObject(9,e),m=ES.fetchInt16ArrayofObject(10,e),b=ES.fetchIntegerofObject(12,e),o=ES.fetchIntegerofObject(13,e),GS=ES.fetchInt16ArrayofObject(14,e),d=ES.fetchInt16ArrayofObject(15,e),ES.failed())return null;for(a=1;a<=t;a++)if(1==(a&h))32767<(p=JS(16))&&(p-=65536),f=JS(6),m[++b-1]=p;else{for(i=JS(o),n=GS[f],s=0,r=l;0>>=1,r>>>=1;s+=n,0<(i&u)?p-=s:p+=s,32767>>=1,d>>>=1,r>>>=1;u+=f,l+=d,0<(i&b)?c-=u:c+=u,0<(a&b)?h-=l:h+=l,32767>>=1,r>>>=1;o+=l,0=xS}var wS,xS,AS,BS,CS,DS,ES,FS,GS,uU,vU,FU,GU,HU,IU,JU,KU,LU,MU,NU,OU,PU,QU,RU,SU,TU,UU,VU,WU,XU,YU,ZU,$U,_U,aV,bV,cV,dV,eV,fV,gV,hV,iV,jV,kV,lV,mV,nV,oV,pV,qV,rV,sV,tV,uV,vV,wV,xV,yV,zV,AV,BV,CV,DV,EV,FV,GV,HV,IV,JV,KV,LV,MV,NV,OV,PV,QV,RV,SV,TV,UV,VV,WV,XV,YV,ZV,$V,_V,aW,bW,cW,dW,eW,fW,gW,hW,iW,jW,kW,lW,mW,nW,oW,pW,qW,rW,sW,tW,uW,vW,wW,xW,yW,zW,AW,BW,CW,DW,EW,FW,GW,HW,IW,JW,KW,LW,MW,NW,OW,PW,QW,RW,SW,TW,UW,VW,WW,XW,YW,ZW,$W,_W,aX,bX,cX,dX,eX,fX,gX,hX,iX,jX,kX,lX,mX,nX,oX,pX,qX,rX,sX,tX,uX,vX,wX,xX,yX,zX,AX,BX,CX,DX,EX,FX,GX,HX,IX,JX,KX,LX,MX,NX,OX,PX,QX,RX,SX,TX,UX,VX,WX,XX,YX,ZX,$X,_X,aY,bY,cY,dY,eY,fY,gY,hY,iY,jY,kY,lY,mY,nY,oY,pY,qY,rY,sY,tY,uY,vY,wY,xY,yY,zY,AY,BY,CY,DY,EY,FY,GY,HY,IY,JY,KY,LY,MY,NY,OY,Psa,Qsa,Zsa,$sa,_sa,ata,bta,cta,dta,eta,fta,gta,hta,ita,jta,kta,lta,mta,nta,ota,pta,qta,rta,sta,tta,uta,vta,wta,xta,yta,zta,Ata,Bta,Cta,Dta,Eta,Fta,Gta,Hta,Ita,Jta,Kta,Lta,Mta,Nta,Ota,Pta,Qta,Rta,Sta,Tta,Uta,Vta,Wta,Xta,Yta,Zta,$ta,_ta,aua,bua,cua,dua,eua,fua,gua,hua,iua,jua,kua,lua,mua,nua,oua,pua,qua,rua,sua,tua,uua,vua,wua,xua,yua,zua,Aua,Bua,Cua,Dua,Eua,Fua,Gua,Hua,Iua,Jua,Kua,Lua,Mua,Nua,Oua,Pua,Qua,Rua,Sua,Tua,Uua,Vua,Wua,Xua,Yua,Zua,$ua,_ua,ava,bva,cva,dva,eva,fva,gva,nIa,oIa,sIa,tIa,uIa,vIa,wIa,xIa,yIa,zIa,AIa,BIa,CIa,DIa,DJa,EJa,GJa,HJa,KLa,LLa,OLa,PLa,mNa,nNa,tNa,uNa,vNa,wNa,xNa,yNa,zNa,ANa,BNa,CNa,DNa,ENa,FNa,GNa,HNa,INa,JNa,KNa,LNa,MNa,NNa,ONa,PNa,QNa,RNa,SNa,TNa,UNa,VNa,WNa,XNa,YNa,ZNa,$Na,_Na,aOa,bOa,cOa,dOa,eOa,fOa,gOa,hOa,iOa,jOa,kOa,lOa,mOa,nOa,oOa,pOa,qOa,rOa,sOa,tOa,uOa,UQa,VQa,$Qa,_Qa,aRa,bRa,cRa,dRa,eRa,V$a,W$a,_$a,a_a,b_a,c_a,d_a,e_a,f_a,zeb,Aeb,Eeb,Feb,Geb,Heb,Ieb,Jeb,Keb,Leb,Meb,Neb,Oeb,Peb,Qeb,Reb,Seb,Teb,Ueb,Veb,Web,Xeb,Yeb,Zeb,$eb,_eb,afb,bfb,cfb,dfb,efb,ffb,gfb,hfb,ifb,jfb,kfb,lfb,mfb,nfb,ofb,pfb,qfb,rfb,sfb,tfb,ufb,vfb,wfb,xfb,yfb,zfb,Afb,Bfb,Cfb,Dfb,Efb,Ffb,Gfb,Hfb,Ifb,Jfb,Kfb,Lfb,Mfb,Nfb,Ofb,Pfb,Qfb,Rfb,Sfb,Tfb,Ufb,Vfb,Wfb,Xfb,Yfb,Zfb,$fb,_fb,agb,bgb,cgb,dgb,egb,fgb,ggb,hgb,igb,jgb,kgb,lgb,mgb,ngb,ogb,pgb,qgb,rgb,sgb,tgb,ugb,vgb,ekb,fkb,mkb,nkb,okb,pkb,qkb,Usb,Vsb,Ysb,Zsb,$sb,_sb,atb,btb,Qub,Rub,Vub,Wub,$wb,_wb,dxb,exb,THb,UHb,XHb,YHb,ZHb,$Hb,_Hb,aIb,zKb,AKb,EKb,FKb,JLb,KLb,SLb,TLb,ULb,VLb,WLb,XLb,YLb,ZLb,$Lb,_Lb,aMb,bMb,cMb,dMb,eMb,fMb,gMb,hMb,iMb,jMb,kMb,lMb,mMb,nMb,oMb,pMb,qMb,rMb,sMb,tMb,uMb,vMb,wMb,xMb,yMb,zMb,AMb,BMb,CMb,DMb,EMb,FMb,GMb,HMb,IMb,JMb,KMb;function wU(e){return"number"==typeof e?IY.classSmallInteger():e.sqClass}function xU(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function zU(e,t){return 0|Math.floor(e/t)}function BU(e,t){return 31>>t}function DU(e,t){return new Int32Array(e.buffer,e.byteOffset+4*t)}function EU(e,t){return new Float32Array(e.buffer,e.byteOffset+4*t)}function PY(){return OY[dX]}function QY(e){return OY[dX]=e}function RY(){return OY[eX]}function TY(e,t){var r;return t<(r=e+WY()-1&~(WY()-1))?t:r}function VY(e,t){return t-1&~(WY()-1)}function WY(){return OY[gX]}function YY(){return OY[hX]}function ZY(e){return OY[hX]=e}function $Y(){return OY[iX]}function _Y(e){return OY[iX]=e}function bZ(e,t){var r;return 0===e?t<0?0-t:t:0===t?e<0?0-e:e:(r=e*e+t*t)<32?[0,1,1,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,6][r]:Math.sqrt(r)+.5|0}function cZ(e){oZ(1)&&(HY[e0()]=e,f0(e0()+1))}function gZ(){return OY[jX]}function hZ(e){return OY[jX]=e}function iZ(){return OY[kX]}function jZ(e){return OY[kX]=e}function kZ(e){return K1(e)}function mZ(){return J4(6),K4()}function nZ(e,t){var r,i,a,s;if(!rZ(a=eV+e))return 0;if(MY=(i=MY)+a,$1(i,cW),W1(i,0),Y1(i,a),r=F$(i),j0())for(s=0;s<=e-1;s++)r[s]=y4(t[s]);else for(s=0;s<=e-1;s++)r[s]=t[s];return P1(i,aV,e),i}function oZ(e){var t,r,i,a;if(kZ(e)){if(0!==iZ())for(i=iZ(),t=iZ()+e,r=1,a=iZ();r<=a;r++)xY[--t]=xY[--i];return xY=DU(xY,e),1}}function pZ(e,t,r){var i,a,s,n;if(!rZ(a=PW+t))return 0;if(MY=(i=MY)+a,$1(i,r?jW:iW),W1(i,0),Y1(i,a),n=i0(i),j0())for(s=0;s<=t-1;s++)n[s]=y4(e[s]);else for(s=0;s<=t-1;s++)n[s]=e[s];return P1(i,NW,t),i}function rZ(e){var t,r,i,a;if(oZ(e)){if(0!==e0())for(i=e0(),t=e0()+e,r=1,a=e0();r<=a;r++)HY[--t]=HY[--i];return HY=DU(HY,e),1}}function tZ(){return J4(3)}function wZ(e){return 0==(O1(e,aW)&yV)}function xZ(e,t,r){if(r>>5&31)<<3,l=(h>>>10&31)<<3,h=(a+=a>>>5)+((u+=u>>>5)<<8)+((l+=l>>>5)<<16)+(255<<24)):h=0===O1(e,aV)?0:F$(e)[h]),E4(h)}function WZ(e){return O1(e,$U)}function YZ(e){return L4(K4()-e+4)}function ZZ(e,t){return M4(K4()-e+4,t)}function $Z(e){return L4(K4()-e+5)}function _Z(e,t){return M4(K4()-e+5,t)}function a$(e){return L4(K4()-e+0)}function b$(e,t){return M4(K4()-e+0,t)}function c$(e){return L4(K4()-e+1)}function d$(e,t){return M4(K4()-e+1,t)}function e$(e){return L4(K4()-e+2)}function f$(e,t){return M4(K4()-e+2,t)}function g$(e){return L4(K4()-e+3)}function h$(e,t){return M4(K4()-e+3,t)}function i$(e,t,r){var i,a,s,n,o,u;for(s=xU(e),i=e.wordsAsInt32Array(),a=n=0;a<=s-1;a++){if(o=m3(a,i),!(0<=(u=n3(a,i))&&u<=t))return;n+=o}return n===r}function m$(e,t,r,i,a,s,n){var o,u,l,c;if((u=e,l=t,IY.isWords(u)&&((c=xU(u))===3*l||c===6*l))&&(function(e){var t,r,i;if(IY.isWords(e)){for(i=xU(e),t=e.wordsAsInt32Array(),r=0;r<=i-1;r++)if(!C0(t[r]))return;return 1}}(n)&&i$(r,o=xU(n),t)&&i$(i,o,t)&&i$(s,o,t)&&function(e,t){var r,i,a,s;for(i=xU(e),s=e.wordsAsInt32Array(),r=a=0;r<=i-1;r++)a+=m3(r,s);return a===t}(a,t)))return 1}function o$(e){return(Z1(e)&oW)===hW?function(e){var t;t=G0(e)?c5(e):0;if(R0(e)+t=x_()&&P0(e)-t>=x_())return 0;cZ(e)}(e):(Z1(e)&oW)===bW?(r=G0(t=e)?T4(t):0,!(AZ(t)+r=x_()&&yZ(t)-r>=x_())&&void cZ(t)):void cZ(e);var t,r}function q$(){return[1,.98078528040323,.923879532511287,.831469612302545,.7071067811865475,.555570233019602,.38268343236509,.1950903220161286,0,-.1950903220161283,-.3826834323650896,-.555570233019602,-.707106781186547,-.831469612302545,-.9238795325112865,-.98078528040323,-1,-.98078528040323,-.923879532511287,-.831469612302545,-.707106781186548,-.555570233019602,-.3826834323650903,-.1950903220161287,0,.1950903220161282,.38268343236509,.555570233019602,.707106781186547,.831469612302545,.9238795325112865,.98078528040323,1]}function r$(){return[0,.1950903220161282,.3826834323650897,.555570233019602,.707106781186547,.831469612302545,.923879532511287,.98078528040323,1,.98078528040323,.923879532511287,.831469612302545,.7071067811865475,.555570233019602,.38268343236509,.1950903220161286,0,-.1950903220161283,-.3826834323650896,-.555570233019602,-.707106781186547,-.831469612302545,-.9238795325112865,-.98078528040323,-1,-.98078528040323,-.923879532511287,-.831469612302545,-.707106781186548,-.555570233019602,-.3826834323650903,-.1950903220161287,0]}function s$(e,t){return e<0?0:t<=e?t-1:e}function t$(){var e,t;for((e=CU(x3(),$Y()))<0&&(e=0),(t=CU(t3(),$Y())+1)>v3()&&(t=v3());e>1,l=o+=(r=$Z(e))-d>>1,u+=(i+=f-c>>1)-n>>1,l+=(a+=d-h>>1)-o>>1,f$(e,i),h$(e,a),ZZ(e,u),_Z(e,l),b$(s,u),d$(s,l),f$(s,n),h$(s,o),ZZ(s,t),_Z(s,r),s)}function I$(e,t){var r,i,a;r=EZ(e)[lV]>>8,(i=X4(e)[lV]>>8)w$()&&(r=w$()),(i=CU(e,$Y()))=y$()||r=w$()||(a=t,s=r,n=i,(zY||u0())&&zY(a,s,n))}function V$(e){return $1(e,Z1(e)|yV)}function W$(e){return $1(e,Z1(e)&~yV)}function Y$(e,t){return P1(e,XV,t)}function Z$(e){return O1(e,ZV)}function $$(e,t){return P1(e,ZV,t)}function a_(e,t){return P1(e,YV,t)}function b_(){return EU(OY,JX)}function d_(e){return O1(e,yW)}function e_(e,t){return P1(e,yW,t)}function f_(e){return O1(e,zW)}function g_(e,t){return P1(e,zW,t)}function h_(e){return O1(e,AW)}function i_(e,t){return P1(e,AW,t)}function j_(e,t){var r,i,a;for(r=q4(),i=e,a=x4();a>16,O=b>>16,S||(I=s$(I,u),O=s$(O,o)),0<=I&&0<=O&&I>16,O=b>>16,S||(I=s$(I,u),O=s$(O,o)),0<=I&&0<=O&&I>16,O=b>>16,S||(I=s$(I,u),O=s$(O,o)),0<=I&&0<=O&&I>16,g=h>>16,p||(v=s$(v,n),g=s$(g,s)),0<=v&&0<=g&&v>16)<0||u<=o)&&l>16)>16,h=TY(v=a,s),d=VY(0,s),u=PY(),l=RY();for(;v>16===p;)f=CU(v,o),NY[f]=NY[f]+m,++v,c+=i;p=c>>16}u=4042322160|CU(PY(),$Y()),l=$Y();for(;v>16===p;)f=CU(v,o),NY[f]=NY[f]+m,v+=n,c+=BU(i,l);p=c>>16}u=PY(),l=RY();for(;v>16===p;)f=CU(v,o),NY[f]=NY[f]+m,++v,c+=i;p=c>>16}return v}(e,n,a,s,l,r);l>16,l>>16)>=h&&p>16,(u=0|r[1])>>16)],l=(h-1)*(h-1),d=s,(p=n)>J_(e)&&(p=J_(e));d>16,u>>16)>=l;)NY[d]=f,++d,o+=i,u+=a;for(c=z3(o>>16,u>>16);c>16,f>>16))-1)*(g-1),_=s,n<(S=J_(e))&&(S=n),d=TY(s,S),b=VY(0,S),_>16,f>>16)>=m;)p=CU(_,u),NY[p]=NY[p]+k,++_,h+=i,f+=a;for(v=z3(h>>16,f>>16);v>16,f>>16)>=m;)p=CU(_,u),NY[p]=NY[p]+k,_+=o,h+=BU(i,c),f+=BU(a,c);for(v=z3(h>>16,f>>16);v>16,f>>16)>=m;)p=CU(_,u),NY[p]=NY[p]+k,++_,h+=i,f+=a;for(v=z3(h>>16,f>>16);v>16,u>>16),p=t[f],d=g0(e),c=(d-1)*(d-1),h=(f+1)*(f+1),l=z3(o>>16,u>>16),b=s,m=n;for(;b>16,u>>16)<=h;)NY[b]=p,++b,o+=i,u+=a;for(l=z3(o>>16,u>>16);h>16,f>>16),_=g0(e),v=(_-1)*(_-1),g=(k+1)*(k+1),b=z3(h>>16,f>>16),d=TY(y=s,n),m=VY(0,n),y>16,f>>16)<=g;)p=CU(y,u),NY[p]=NY[p]+S,++y,h+=i,f+=a;for(b=z3(h>>16,f>>16);g>16,f>>16)<=g;)p=CU(y,u),NY[p]=NY[p]+S,y+=o,h+=BU(i,c),f+=BU(a,c);for(b=z3(h>>16,f>>16);g>16,f>>16)<=g;)p=CU(y,u),NY[p]=NY[p]+S,++y,h+=i,f+=a;for(b=z3(h>>16,f>>16);g>>0>>0}function U_(e,t,r){var i,a,s,n,o,u;if(0===e)return!1;if(a=tBU(v3(),$Y())?BU(v3(),$Y()):r,ax_()&&(s=x_()),at3()&&u3(s),s>r3()&&s3(s),s<=a)return!1;if(B0(e))o_(e,a,s);else{if(u=e,OY[UX]=u,o=a,OY[VX]=o,n=s,OY[WX]=n,(i=(Z1(e)&gW)>>>8)<=1)return!0;switch(i){case 0:case 1:break;case 2:u_();break;case 3:P_();break;case 4:case 5:k_()}}return!1}function W_(){var e,t,r;for(r=M$();c0()r)return!1;if(((t=Z1(e))&oW)===dW)return!0;if(!K1(1))return!1;switch(t){case 0:case 1:case 2:case 3:break;case 4:N3(HY[c0()],M$());break;case 5:!function(e,t){var r,i,a,s,n,o,u,l;a=c5(e),i=_1(a),n=d_(e),o=f_(e),N3(e,o),s=Z$(e),u=Z0(e),e_(e,n-i),$$(e,s+a),0=x_())return!1;if(_2(t),G0(e)&&o4(e),wZ(e)&&(n4(e),EY))return!1;hZ(gZ()+1),gZ()=B_()&&j_(t,r)}return r=F3()?-1:r}function $_(){return I3()===rW}function __(){var e;e=3,O4(N4()+e)}function a0(){return KY}function b0(e,t){var r;return e===t||(0!==(r=f_(e)-f_(t))?r<0:(r=d_(e)-d_(t))<0)}function c0(){return OY[OX]}function d0(e){return OY[OX]=e}function e0(){return OY[PX]}function f0(e){return OY[PX]=e}function g0(e){return O1(e,NW)}function i0(e){return DU(LY,e+OW)}function j0(){return 0!==OY[QX]}function l0(e){return OY[QX]=e}function m0(){return 0!==OY[RX]}function o0(e){return OY[RX]=e}function p0(e,t){var r,i,a,s,n;if(-1===(r=Z_(e,t)))return!1;if(0===r)return __(),!0;if(H3(r,G3(0)),B3(r,A3(0)),E3(r,D3(0)),__(),F3()<=3)return!0;for(n=0,r=3;rv3()&&x$(v3()),e=BU(A$(),$Y()),OY[MX]=e,t=BU(C$(),$Y()),OY[NX]=t,r=BU(w$(),$Y()),OY[KX]=r,i=BU(y$(),$Y()),OY[LX]=i,f0(0),jZ(0),HY=DU(LY,MY),xY=DU(LY,MY),function(){var e,t;for(t=0,e=MY;t=z_()||o$(t)),t+=O1(t,_V)}(),EY||(0!==e0()?(function e(t,r,i){var a;var s;var n;var o;var u;var l;var c;var h;var f;var d;var p;if((f=i+1-r)<=1)return 0;n=t[r];u=t[i];s=b0(n,u);s||(d=t[r],t[r]=t[i],t[i]=d,p=n,n=u,u=p);if(f<=2)return 0;l=r+i>>1;o=t[l];s=b0(n,o);s?(s=b0(o,u))||(d=t[i],t[i]=t[l],t[l]=d,o=u):(d=t[r],t[r]=t[l],t[l]=d,o=n);if(f<=3)return 0;c=r;h=i;a=!0;for(;a;){for(s=!0;s;)s=c<=--h&&(d=t[h],b0(o,d));for(s=!0;s;)s=++c<=h&&b0(d=t[c],o);(a=c<=h)&&(d=t[c],t[c]=t[h],t[h]=d)}e(t,r,h);e(t,c,i)}(HY,0,e0()-1),N$(f_(HY[0])),M$()xU(FY)?null:(r=IY.fetchPointerofObject(i,FY),xU(t=IY.fetchPointerofObject(0,r))!==O1(e,ZU)?null:t.wordsAsInt32Array())}function l1(e,t,r,i,a,s,n){var o,u,l,c,h,f,d,p;if(i!==a||0!==s&&0!==n){if(o=6*e,p=r?(l=(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[0+o],f=(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[1+o],c=(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[2+o],d=(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[3+o],h=(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[4+o],(t.int16Array||(t.int16Array=new Int16Array(t.buffer,t.byteOffset)))[5+o]):(l=0|t[0+o],f=0|t[1+o],c=0|t[2+o],d=0|t[3+o],h=0|t[4+o],0|t[5+o]),l===c&&f===d||c===h&&d===p)return(l!==h||f!==p)&&(a2()[0]=l,a2()[1]=f,b2()[0]=h,b2()[1]=p,C4(2),D1(s,a2(),b2(),n,i,a));a2()[0]=l,a2()[1]=f,b2()[0]=c,b2()[1]=d,c2()[0]=h,c2()[1]=p,C4(3),u=c1(a2(),b2(),c2(),0!==s&&0!==n),EY||C1(s,n,i,a,u)}}function n1(e){var t;return t=OY[TX],xU(e)>1),l=2*(l=r$()[2*e+1]*r+a|0)-(u+c>>1),b2()[0]=n,b2()[1]=l}function v1(e,t){var r;return wU(t)===IY.classPoint()&&("number"==typeof(r=IY.fetchPointerofObject(0,t))||r.isFloat)?(e[0]="number"==typeof r?r:0|IY.floatValueOf(r),"number"==typeof(r=IY.fetchPointerofObject(1,t))||r.isFloat?void(e[1]="number"==typeof r?r:0|IY.floatValueOf(r)):IY.primitiveFail()):IY.primitiveFail()}function y1(){var e,t,r,i;return 2!==IY.methodArgumentCount()?wY:0!==(t=Y2(IY.stackValue(2)))?t:(r=IY.stackObjectValue(0),e=IY.stackObjectValue(1),IY.failed()?vY:0!==(t=A1(IY.fetchPointerofObject(IU,DY)))?t:h1(IY.fetchPointerofObject(GU,DY))?q1(IY.fetchPointerofObject(HU,DY))?xU(e)=c$(c)?(e_(l,a$(c)),g_(l,c$(c)-d),GZ(l,e$(c)),IZ(l,g$(c)-d),zZ(l,YZ(c)),BZ(l,$Z(c)-d)):(e_(l,YZ(c)),g_(l,$Z(c)-d),GZ(l,e$(c)),IZ(l,g$(c)-d),zZ(l,a$(c)),BZ(l,c$(c)-d)),i_(l,O$()),Y$(l,h),a_(l,f),u&&(P1(s,sV,t),Z4(s,e),P1(s,rV,e)),n-=6}H4()}function D1(e,t,r,i,a,s){var n,o,u,l;if(o=0===e||0===i?(n=rZ(QW)?(MY=(l=MY)+QW,$1(l,hW),W1(l,0),Y1(l,QW),l):0,0):(n=rZ($W)?(MY=(u=MY)+$W,$1(u,nW),W1(u,0),Y1(u,$W),u):0,_1(e)),EY)return 0;s1(n,t,r,o,a,s),G0(n)&&(P1(n,ZW,i),h5(n,e),P1(n,YW,e))}function F1(e){return"number"==typeof e?OV:IY.isWords(e)?xU(e)F4()?TV:0)):PV}function I1(e){0===strcmp(e,yY)&&(zY=JY=0)}function K1(e){return!(SX+MY+e0()+iZ()+e>N4())||(_3(GW),!1)}function L1(){return 0!==OY[$X]}function N1(e){return OY[$X]=e}function O1(e,t){return LY[e+t]}function P1(e,t,r){return LY[e+t]=r}function Q1(){return OY[_X]}function S1(){return OY[aY]}function T1(e){return OY[aY]=e}function V1(e){return O1(e,$V)}function W1(e,t){return P1(e,$V,t)}function Y1(e,t){return P1(e,_V,t)}function Z1(e){return O1(e,aW)&kW}function $1(e,t){return P1(e,aW,t)}function _1(e){return e>>1}function a2(){return DU(OY,bY)}function b2(){return DU(OY,cY)}function c2(){return DU(OY,dY)}function d2(){return DU(OY,eY)}function e2(){c0()>=e0()&&0===iZ()&&J3(rW),M$()>=z_()&&J3(rW)}function f2(){var e;return 0!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Y2(IY.stackValue(0)))?IY.primitiveFailFor(e):(J3(rW),void d4())}function g2(){var e,t,r;return CY&&(GY=IY.ioMicroMSecs()),1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(r=Z2(IY.stackValue(1),wW))?IY.primitiveFailFor(r):(t=IY.stackObjectValue(0),IY.failed()?IY.primitiveFailFor(vY):(e=n1(t))?K1(1)?(0>1,n=b2()[1]-a2()[1]>>1,a=b2()[0]+a2()[0]>>1,s=b2()[1]+a2()[1]>>1,o=0;o<=15;o++){if(u1(o,l,n,a,s),C4(3),u=c1(a2(),b2(),c2(),0!==e&&0!==t),EY)return;if(C1(e,t,r,i,u),EY)return}}(t,e,0,a),EY?(H4(),IY.primitiveFailFor(GV)):IY.failed()?IY.primitiveFailFor(JV):(N1(1),d4(),void IY.pop(5)))):IY.primitiveFailFor(TV)):IY.primitiveFailFor(VV))}function o2(){var e,t,r,i,a,s,n,o;if(5!==IY.methodArgumentCount())return IY.primitiveFailFor(wY);if(i=IY.positive32BitValueOf(IY.stackValue(0)),a=IY.stackIntegerValue(1),t=IY.positive32BitValueOf(IY.stackValue(2)),s=IY.stackIntegerValue(3),n=IY.stackObjectValue(4),IY.failed())return IY.primitiveFailFor(vY);if(0!==(e=Z2(IY.stackValue(5),tW)))return IY.primitiveFailFor(e);if(r=xU(n),IY.isWords(n)){if(o=!1,r!==s&&2*s!==r)return IY.primitiveFailFor(vY)}else{if(!IY.isArray(n))return IY.primitiveFailFor(vY);if(r!==s)return IY.primitiveFailFor(vY);o=!0}return K1((0===a||0===i?QW:$W)*s)?C0(i)&&C0(t)?(i=y4(i),t=y4(t),EY?IY.primitiveFailFor(GV):0!==i&&0!==a||0!==t?(0!==a&&(a=D4(a)),o?function(e,t,r,i,a){var s,n,o,u,l;if(v1(a2(),IY.fetchPointerofObject(0,e)),!IY.failed())for(n=a2()[0],u=a2()[1],s=1;s<=t-1;s++){if(v1(a2(),IY.fetchPointerofObject(s,e)),IY.failed())return;if(o=a2()[0],l=a2()[1],a2()[0]=n,a2()[1]=u,b2()[0]=o,b2()[1]=l,C4(2),D1(i,a2(),b2(),a,r,0),EY)return;n=o,u=l}}(n,s,t,a,i):function(e,t,r,i,a,s){var n,o,u,l,c;for(l=s?(o=(e.int16Array||(e.int16Array=new Int16Array(e.buffer,e.byteOffset)))[0],(e.int16Array||(e.int16Array=new Int16Array(e.buffer,e.byteOffset)))[1]):(o=0|e[0],0|e[1]),n=1;n<=t-1;n++){if(c=s?(u=(e.int16Array||(e.int16Array=new Int16Array(e.buffer,e.byteOffset)))[2*n],(e.int16Array||(e.int16Array=new Int16Array(e.buffer,e.byteOffset)))[2*n+1]):(u=0|e[2*n],0|e[2*n+1]),a2()[0]=o,a2()[1]=l,b2()[0]=u,b2()[1]=c,C4(2),D1(i,a2(),b2(),a,r,0),EY)return;o=u,l=c}}(n.wordsAsInt32Array(),s,t,a,i,s===r),EY?IY.primitiveFailFor(GV):IY.failed()?IY.primitiveFailFor(JV):(N1(1),d4(),void IY.pop(5))):IY.pop(5)):IY.primitiveFailFor(VV):IY.primitiveFail()}function p2(){var e,t,r,i,a,s,n,o,u,l;return 5!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):(e=IY.positive32BitValueOf(IY.stackValue(0)),t=IY.stackIntegerValue(1),a=IY.positive32BitValueOf(IY.stackValue(2)),r=IY.stackObjectValue(3),s=IY.stackObjectValue(4),IY.failed()?IY.primitiveFailFor(vY):0!==(i=Z2(IY.stackValue(5),tW))?IY.primitiveFailFor(i):C0(e)&&C0(a)?(e=y4(e),a=y4(a),EY?IY.primitiveFailFor(GV):0!==a||0!==e&&0!==t?K1(4*QW)?(t=0t3()&&u3(c),c>r3()&&s3(c)}(e.wordsAsInt32Array(),L0(),N0()),J3(sW),d4(),IY.pop(2),void(CY&&(q0(BX,1),q0(rY,IY.ioMicroMSecs()-GY))))))))}function G2(){var e,t;return 0!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Y2(IY.stackValue(0)))?IY.primitiveFailFor(e):(t=L1(),d4(),IY.pop(1),void IY.pushBool(t))}function H2(){var e,t;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Y2(IY.stackValue(1)))?IY.primitiveFailFor(e):(t=IY.booleanValueOf(IY.stackValue(0)),IY.failed()?IY.primitiveFailFor(vY):(N1(!0===t?1:0),d4(),void IY.pop(1)))}function I2(){var e,t,r,i,a,s,n;return CY&&(GY=IY.ioMicroMSecs()),1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(i=IY.stackValue(1),a=uW,s=rW,t=0===(n=Y2(i))?I3()!==a&&I3()!==s?(b4(CW),WV):0:n)?IY.primitiveFailFor(t):(e=IY.stackObjectValue(0),IY.failed()?IY.primitiveFailFor(vY):(r=!1,I3()!==rW&&((r=Y_())?(c4(xY[gZ()],e),J3(vW)):J3(pW)),IY.failed()?null:(d4(),IY.pop(2),IY.pushBool(!r),void(CY&&(q0(CX,1),q0(sY,IY.ioMicroMSecs()-GY))))))}function J2(){var e,t,r;return CY&&(GY=IY.ioMicroMSecs()),1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),sW))||0!==(e=A1(IY.fetchPointerofObject(IU,DY)))?IY.primitiveFailFor(e):q1(IY.fetchPointerofObject(HU,DY))?(0!==u$()&&(0==(M$()&YY())&&t$(),v$(0)),t=IY.stackObjectValue(0),r=X_(),EY?IY.primitiveFailFor(GV):(r&&e4(t),IY.failed()?IY.primitiveFailFor(VV):(r?J3(xW):(H4(),s3(0),J3(qW)),d4(),IY.pop(2),IY.pushBool(!r),void(CY&&(q0(DX,1),q0(tY,IY.ioMicroMSecs()-GY)))))):IY.primitiveFailFor(LV)}function K2(){var e,t,r;return CY&&(GY=IY.ioMicroMSecs()),1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(t=Z2(IY.stackValue(1),pW))?IY.primitiveFailFor(t):(e=IY.stackObjectValue(0),(r=W_())&&(c4(HY[c0()],e),d0(c0()+1)),IY.failed()?IY.primitiveFailFor(UV):(r?J3(wW):(J3(sW),v$(1),hZ(0),H4()),d4(),IY.pop(2),IY.pushBool(!r),void(CY&&(q0(EX,1),q0(uY,IY.ioMicroMSecs()-GY)))))}function L2(){var e,t,r,i,a,s,n,o;return 6!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(t=Z2(IY.stackValue(6),tW))?IY.primitiveFailFor(t):(o=IY.positive32BitValueOf(IY.stackValue(0)),n=IY.positive32BitValueOf(IY.stackValue(1)),s=IY.stackIntegerValue(2),a=IY.stackIntegerValue(3),i=IY.stackIntegerValue(4),r=IY.stackIntegerValue(5),IY.failed()?IY.primitiveFailFor(vY):rZ(wV)?C0(n)&&C0(o)?(MY=(e=MY)+wV,$1(e,dW),Y1(e,wV),W1(e,r),e_(e,i),g_(e,a),i_(e,s),Y$(e,y4(n)),a_(e,y4(o)),EY?IY.primitiveFailFor(GV):void(IY.failed()||(d4(),IY.pop(6)))):IY.primitiveFailFor(VV):IY.primitiveFailFor(TV))}function M2(){var e,t,r;if(1!==IY.methodArgumentCount())return IY.primitiveFailFor(wY);if(0!==(e=Z2(IY.stackValue(1),tW)))return IY.primitiveFailFor(e);if(r=IY.stackIntegerValue(0),IY.failed())return IY.primitiveFailFor(vY);for(t=0;0===t;){if(!rZ(wV))return IY.primitiveFailFor(TV);MY=(t=MY)+xV,$1(t,fW),Y1(t,xV),W1(t,r)}IY.failed()||(d4(),IY.pop(2),IY.pushInteger(t))}function N2(){var e;return 0!==(e=y1())?IY.primitiveFailFor(e):(X2(),EY?f4():(function(){var e;for(;!$_();){if(CY&&(GY=IY.ioMicroMSecs()),e=W_(),CY&&(q0(EX,1),q0(uY,IY.ioMicroMSecs()-GY)),EY)return J3(pW);if(e)return J3(wW),_3(EW);if(hZ(0),H4(),v$(1),CY&&(GY=IY.ioMicroMSecs()),0!==u$()&&0==(M$()&YY())&&t$(),v$(0),e=X_(),CY&&(q0(DX,1),q0(tY,IY.ioMicroMSecs()-GY)),EY)return J3(sW);if(e)return J3(xW),_3(DW);if(H4(),s3(0),CY&&(GY=IY.ioMicroMSecs()),(M$()&YY())===YY()&&(U$(M$()),e2()),CY&&(q0(yX,1),q0(oY,IY.ioMicroMSecs()-GY)),EY)return J3(qW);if($_())return;if(hZ(0),N$(M$()+1),CY&&(GY=IY.ioMicroMSecs()),e=Y_(),CY&&(q0(CX,1),q0(sY,IY.ioMicroMSecs()-GY)),EY)return J3(uW);if(e)return J3(vW),_3(BW)}}(),void f4()))}function O2(){var e;if(0!==(e=y1()))return IY.primitiveFailFor(e);X2(),f4()}function P2(){var e,t;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(e):(t=IY.stackIntegerValue(0),IY.failed()?IY.primitiveFailFor(vY):(k3(t),d4(),void IY.pop(1)))}function Q2(){var e,t,r;if(t=IY.stackValue(0),!IY.isBytes(t))return IY.primitiveFail();if(256<=((r=t).bytes?r.bytes.length:r.words?4*r.words.length:0))return IY.primitiveFail();t.bytes,e=!1;var i=t.bytesAsString();if(i!==yY&&(yY=i,e=!0),e&&!u0())return IY.primitiveFail();IY.pop(1)}function R2(){var e,t;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(e):(t=IY.stackObjectValue(0),!IY.failed()&&IY.isPointers(t)&&2<=xU(t)?(v1(a2(),IY.fetchPointerofObject(0,t)),v1(b2(),IY.fetchPointerofObject(1,t)),IY.failed()?IY.primitiveFailFor(vY):(B$(a2()[0]),D$(a2()[1]),x$(b2()[0]),z$(b2()[1]),d4(),void IY.pop(1))):IY.primitiveFailFor(vY))}function S2(){var e,t,r,i;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(e):(t=IY.stackObjectValue(0),IY.failed()?IY.primitiveFailFor(vY):(r=t,i=E$(),l0(0),B1(r,i,8)&&(l0(1),i[1]=256*i[1],i[3]=256*i[3],i[5]=256*i[5],i[7]=256*i[7]),IY.failed()?IY.primitiveFailFor(JV):(d4(),void IY.pop(1))))}function T2(){var e,t;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(t=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(t):(e=IY.stackIntegerValue(0),IY.failed()?IY.primitiveFailFor(vY):(P$(e),d4(),void IY.pop(1)))}function U2(){var e,t,r,i,a;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(e):(t=IY.stackObjectValue(0),IY.failed()?IY.primitiveFailFor(vY):(r=t,o0(0),i=B1(r,a=b_(),6),!IY.failed()&&i&&(o0(1),a[2]=a[2]+Q$(),a[5]=a[5]+S$()),IY.failed()?IY.primitiveFailFor(vY):(d4(),void IY.pop(1))))}function V2(){var e,t,r,i;return 1!==IY.methodArgumentCount()?IY.primitiveFailFor(wY):0!==(e=Z2(IY.stackValue(1),tW))?IY.primitiveFailFor(e):wU(t=IY.stackValue(0))!==IY.classPoint()?IY.primitiveFailFor(vY):(v1(a2(),t),IY.failed()?IY.primitiveFailFor(vY):(r=a2()[0],OY[HX]=r,i=a2()[1],OY[IX]=i,d4(),void IY.pop(1)))}function X2(){var e,t;if((t=I3())===tW){if(v0(),EY)return;t=pW}if(t===pW){if(CY&&(GY=IY.ioMicroMSecs()),e=W_(),CY&&(q0(EX,1),q0(uY,IY.ioMicroMSecs()-GY)),EY)return J3(pW);if(e)return J3(wW),_3(EW);hZ(0),H4(),v$(1),t=sW}if(t===sW){if(CY&&(GY=IY.ioMicroMSecs()),0!==u$()&&0==(M$()&YY())&&t$(),v$(0),e=X_(),CY&&(q0(DX,1),q0(tY,IY.ioMicroMSecs()-GY)),EY)return J3(sW);if(e)return J3(xW),_3(DW);t=qW,H4(),s3(0)}if(t===qW){if(CY&&(GY=IY.ioMicroMSecs()),(M$()&YY())===YY()&&(U$(M$()),e2()),CY&&(q0(yX,1),q0(oY,IY.ioMicroMSecs()-GY)),EY)return J3(qW);if($_())return;t=uW,hZ(0),N$(M$()+1)}if(t===uW){if(CY&&(GY=IY.ioMicroMSecs()),e=Y_(),CY&&(q0(CX,1),q0(sY,IY.ioMicroMSecs()-GY)),EY)return J3(uW);if(e)return J3(vW),_3(BW);J3(pW)}}function Y2(e){var t;return IY.failed()?zV:"number"==typeof e?EV:IY.isPointers(e)?xU(e)r;)xY[i]=xY[i-1],--i;xY[i]=t}(gZ(),e,t))}function g3(){return AY=O1(BY,sV)}function h3(){return AY=O1(BY,vV)}function i3(){return AY=O1(BY,ZW)}function k3(e){var t,r,i,a;4<=e&&(t=4),2<=e&&e<4&&(t=2),e<2&&(t=1),r=t,OY[gX]=r,1===t&&(_Y(0),QY(4294967295),ZY(0)),2===t&&(_Y(1),QY(4244438268),ZY(1)),4===t&&(_Y(2),QY(4042322160),ZY(3)),i=2*$Y(),OY[eX]=i,a=$Y(),OY[fX]=a}function l3(e){return!1!=((IY=e).majorVersion()==uU)&&IY.minorVersion()>=vU}function m3(e,t){return(0|t[e])>>>16}function n3(e,t){return 65535&(0|t[e])}function o3(e,t,r){tZ()&&(H3(0,e),B3(0,t),E3(0,r),3!==F3()&&T_(0,F3()-3)&&(H3(0,v4()),B3(0,r4()),E3(0,t4()),w4(e),s4(t),u4(r)))}function r3(){return OY[hY]}function s3(e){return OY[hY]=e}function t3(){return OY[gY]}function u3(e){return OY[gY]=e}function v3(){return OY[iY]}function x3(){return OY[jY]}function y3(e){return OY[jY]=e}function z3(e,t){return e*e+t*t}function A3(e){return L4(e+1)}function B3(e,t){return M4(e+1,t)}function D3(e){return L4(e+2)}function E3(e,t){return M4(e+2,t)}function F3(){return K4()}function G3(e){return L4(e)}function H3(e,t){return M4(e,t)}function I3(){return OY[kY]}function J3(e){return OY[kY]=e}function L3(e,t){var r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S,y;if(!G0(e)&&t>=AZ(e))return $$(e,0);b=d_(e),m=f_(e),g=O1(e,nV),k=O1(e,oV),u=2*(g-b),l=b+yZ(e)-2*g,c=2*(k-m),h=m+(i=AZ(e))-2*k,(f=2*(r=i-m))<2&&(f=2),d=zU(16777216,f),n=u*(_=d),n+=(a=l*(p=((S=65535&_)*S>>>16)+S*(y=_>>>16&255)*2+(y*y<<16)>>>8)*2)>>1,o=c*d,o+=(s=h*p*2)>>1,$$(e,r),(v=EZ(e))[lV]=256*b,v[mV]=256*m,v[iV]=n,v[jV]=o,v[gV]=a,v[hV]=s,(m=f_(e))!==t&&(U3(e,t),$$(e,r-(t-m)))}function N3(e,t){var r,i,a,s,n,o,u,l,c,h,f;if(!G0(e)&&t>=R0(e))return $$(e,0);if(r=P0(e)-d_(e),i=R0(e)-f_(e),a=0<=r?(l=1,u=r,0):(l=-1,u=0-r,1-i),s=0==i?(c=r,a=0):u>16,s+=i+32768>>16,r+=e[gV],i+=e[hV];return e[lV]=a,e[mV]=s,e[iV]=r,e[jV]=i,a>>8}function U3(e,t){e_(e,T3(EZ(e),t))}function W3(e){var t,r;r=d_(e)+_0(e),0<(t=O1(e,TW)+O1(e,VW))&&(r+=Z0(e),t-=O1(e,UW)),Y0(e,t),e_(e,r)}function Y3(e,t){var r,i,a,s;r=_1(i=T4(e)),a=O1(e,pV)+1,s=O1(e,qV)+1,Q4(e,a),S4(e,s),r<=a&&W$(e),0<=s&&V$(e),s+r<0?T3(EZ(e),t):EZ(e)[lV]=256*CZ(e),T3(X4(e),t),I$(e,i)}function $3(e){var t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m;s=$4(e)+1,n=a5(e)+1,_4(e,s),b5(e,n),(r=_1(i=c5(e)))<=s&&W$(e),0<=n&&V$(e),t=d_(e),W3(e),a=d_(e),(s<=i||0<=n+r)&&(u=t,l=a,b=$4(o=e),m=a5(o),f=_1(c=c5(o)),d=g5(o),p=Z0(o),h=l-u,b>>1,BY=e,n){case 0:case 1:break;case 2:AY=g5(BY);break;case 3:h3()}switch(a=AY,n){case 0:case 1:break;case 2:i3();break;case 3:g3()}0!==(r=AY)&&K1(3)&&(t=1+(h_(e)<<1),s=d_(e)+a,-1===(i=Z_(r,t))?o3(r,t,s):D3(i)>>8&255,s=e>>>16&255,t=e>>>24&255,j0()&&(r=(t*(n=E$())[6]+n[7])/t,s=(s*n[0]+n[1])*r|0,a=(a*n[2]+n[3])*r|0,i=(i*n[4]+n[5])*r|0,t=t*r|0,s=Math.max(s,0),s=Math.min(s,255),a=Math.max(a,0),a=Math.min(a,255),i=Math.max(i,0),i=Math.min(i,255),t=Math.max(t,0),t=Math.min(t,255)),t<1?0:(t<255&&L1()&&_3(FW),i+(a<<8)+(s<<16)+(t<<24))):e}function z4(e){var t,r;m0()?(r=t=e,function(e,t,r){var i,a,s;i=b_(),a=(i[0]*e+i[1]*t+i[2])*WY()|0,s=(i[3]*e+i[4]*t+i[5])*WY()|0,r[0]=a,r[1]=s}(0|t[0],0|t[1],r)):(e[0]=(e[0]+Q$())*WY(),e[1]=(e[1]+S$())*WY())}function C4(e){0>8,t=c2()[0]-a2()[0],r=c2()[1]-a2()[1],(a=128+(0|Math.sqrt(t*t+r*r))>>8)>>8&255,t=e>>>24&255,a=(a=e>>>16&255)*(s=E$())[0]+s[1]|0,i=i*s[2]+s[3]|0,r=r*s[4]+s[5]|0,t=t*s[6]+s[7]|0,a=Math.max(a,0),a=Math.min(a,255),i=Math.max(i,0),i=Math.min(i,255),r=Math.max(r,0),r=Math.min(r,255),t=Math.max(t,0),(t=Math.min(t,255))<16?0:r+(i<<8)+(a<<16)+(t<<24)):e}function F4(){return OY[fY]}function H4(){O4(F4())}function J4(e){return!!K1(e)&&(O4(N4()-e),!0)}function K4(){return F4()-N4()}function L4(e){return OY[N4()+e]}function M4(e,t){return OY[N4()+e]=t}function N4(){return OY[pX]}function O4(e){return OY[pX]=e}function Q4(e,t){return P1(e,pV,t)}function S4(e,t){return P1(e,qV,t)}function T4(e){return O1(e,rV)}function X4(e){return DU(LY,e+uV)}function Z4(e,t){return P1(e,vV,t)}function $4(e){return O1(e,WW)}function _4(e,t){return P1(e,WW,t)}function a5(e){return O1(e,XW)}function b5(e,t){return P1(e,XW,t)}function c5(e){return O1(e,YW)}function g5(e){return O1(e,_W)}function h5(e,t){return P1(e,_W,t)}function i5(e){OY=e.wordsAsInt32Array()}function Rsa(e){return"number"==typeof e?wua.classSmallInteger():e.sqClass}function Ssa(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function Tsa(e){return e.bytes?e.bytes.length:e.words?4*e.words.length:0}function Usa(e,t){return 0|Math.floor(e/t)}function Wsa(e,t){return 31>>t}function Ysa(e,t){return t<0?t<-31?0:e>>>0-t:31>>5&31)+(r>>>10&31),r=wwa(e>>>16,t>>>16,5,3),Jta+(31&r)+(r>>>5&31)+(r>>>10&31)):(r=wwa(e,t,8,3),Jta+(255&r)+(r>>>8&255)+(r>>>16&255)),t}function iva(e,t){var r,i,a,s;if((Pta&(tta|rta))!=(tta|rta))return t;if(Zta<16){for(r=Bua[Zta]&Rta,s=t,a=1;a<=dua;a++)ixa(i=s&r,hxa(i)+1),s=Xsa(s,Zta);return t}return 16===Zta?(ixa(i=Uwa(65535&t,5,Ota),hxa(i)+1),ixa(i=Uwa(t>>>16,5,Ota),hxa(i)+1)):ixa(i=Uwa(t,8,Ota),hxa(i)+1),t}function jva(e,t){return e+t}function kva(e,t){var r,i,a,s;return 0==(s=e>>>24)?t:255==s?e:(i=(i=(16711935&e)*s+(16711935&t)*(r=255-s)+16711935)+(i-65537>>>8&16711935)>>>8&16711935)|(a=(a=(16711935&(e>>>8|16711680))*s+(t>>>8&16711935)*r+16711935)+(a-65537>>>8&16711935)>>>8&16711935)<<8}function lva(e,t){return mva(e,t,!1)}function mva(e,t,r){var i,a,s,n,o,u,l,c,h,f,d,p,b,m;if(Zta<16)return t;if(h=255-Kua,o=t,1===dua)r&&0===e||(o=(d=(d=(16711935&e)*Kua+(16711935&t)*h+16711935)+(d-65537>>>8&16711935)>>>8&16711935)|(p=(p=(e>>>8&16711935)*Kua+(t>>>8&16711935)*h+16711935)+(p-65537>>>8&16711935)>>>8&16711935)<<8);else for(i=Bua[Zta],m=cua,b=t,n=e,s=1;s<=dua;s++){if(l=n&i,!(0==(m&i)||r&&0==l)){for(f=b&i,a=0,c=1;c<=3;c++)a|=Wsa(31&Usa((31&Xsa(l,u=5*(c-1)))*Kua+(31&Xsa(f,u))*h+254,255),u);o=o&~Wsa(i,16*(s-1))|Wsa(a,16*(s-1))}m=Xsa(m,Zta),n=Xsa(n,Zta),b=Xsa(b,Zta)}return o}function nva(e,t){var r,i,a;return(a=(16711935&(a=((t>>>8&16711935)*(r=255-(e>>>24))>>>8&16711935)+(e>>>8&16711935)))<<8|255*(16777472&a))|(i=16711935&(i=((16711935&t)*r>>>8&16711935)+(16711935&e))|255*(16777472&i)>>>8)}function ova(e,t){return 0===e?t:mva(e,t,!0)}function sva(e,t){return e&t}function tva(e,t){return e&~t}function uva(e,t){return~e&t}function vva(e,t){return~e&~t}function wva(e,t){return~t}function xva(e,t){return~e|t}function yva(e,t){return~e|~t}function zva(e,t){return~e}function Ava(e,t){return~e^t}function Bva(e,t){return e|t}function Cva(e,t){return e|~t}function Dva(e,t){return e^t}function Fva(e,t){return 0}function Gva(){Mta<=gua?(Yua=Vua,nua=gua,Hta=gva):(Yua=Vua+(Mta-gua),Hta=gva-(Mta-gua),nua=Mta),Mta+Lta>>2],0==(16777215&e)){for(t+=4,i+=4;0!=--r&&0==(16777215&(e=Lua[t>>>2]));)t+=4,i+=4;++r}else n=Xta[i>>>2],n=Owa(e,n),Xta[i>>>2]=n,t+=4,i+=4;++s,++o}}(),Eta=(Dta=nua)+Hta,Cta=(Fta=oua)+Gta,!0):16===Zta?(function(){var e,t,r,i,a,s,n,o,u,l,c,h,f;u=Gta+1,l=Zua,h=oua,r=16*(1&nua),bua&&(r=16-r);zua=Wsa(65535,16-r);for(;0!=--u;){for(a=l*Tua+4*Yua,n=h*eua+4*(nua>>1),e=4*(3&h),f=(3&Yua)-1,s=Hta+1,r=65535===(o=zua)?16:0;0!=--s;)t=jua[e+(f=f+1&3)],i=Lua[a>>>2],0!=(16777215&i)&&(c=Xta[n>>>2],c=Xsa(c&=~o,r),i=Wsa(0===(i=Sva(i=Owa(i,c=(31744&c)<<9|(992&c)<<6|(31&c)<<3|4278190080),t))?1:i,r),Uva(n,i,o)),a+=4,bua?0===r&&(n+=4):0!==r&&(n+=4),r^=16,o=~o;++l,++h}}(),Eta=(Dta=nua)+Hta,Cta=(Fta=oua)+Gta,!0):8===Zta&&(function(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d;a=Ova(),o=Pta&~sta,c=Gta+1,h=Zua,zua=8*(3&nua),bua&&(zua=24-zua);Aua=Zsa^Wsa(255,zua),n=0==(1&nua)?0:522133279;0==(1&(d=oua))&&(n^=522133279);for(;0!=--c;){for(n^=522133279,r=h*Tua+4*Yua,s=d*eua+4*(nua>>2),i=Hta+1,e=zua,l=Aua;0!=--i;)t=(Lua[r>>>2]&~n)+n,31<(u=Usa(((u=16777215&t)>>>16)+(u>>>8&255)+(255&u),3))&&(224>>2],f=Xsa(f&=~l,e),f=a[f],t=Wsa(t=owa(t=Owa(t,f),o),e),Uva(s,t,l)),r+=4,l=bua?0===e?(s+=4,e=24,16777215):(e-=8,l>>>8|4278190080):32===e?(s+=4,e=0,4294967040):(e+=8,l<<8|255),n^=522133279;++h,++d}}(),Eta=(Dta=nua)+Hta,Cta=(Fta=oua)+Gta,!0);if(Zta<8)return!1;if(8===Zta&&0==(Pta&tta))return!1;32===Zta&&function(){var e,t,r,i,a,s,n,o,u;for(s=Gta+1,n=Zua,u=oua;0!=--s;){for(t=n*Tua+4*Yua,i=u*eua+4*nua,r=Hta+1;0!=--r;)if(255==(a=(e=Lua[t>>>2])>>>24)){for(Xta[i>>>2]=e,t+=4,i+=4;0!=--r&&(e=Lua[t>>>2])>>>24==255;)Xta[i>>>2]=e,t+=4,i+=4;++r}else if(0==a){for(t+=4,i+=4;0!=--r&&(e=Lua[t>>>2])>>>24==0;)t+=4,i+=4;++r}else o=nva(e,o=Xta[i>>>2]),Xta[i>>>2]=o,t+=4,i+=4;++n,++u}}();16===Zta&&function(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d;for(l=Gta+1,c=Zua,f=oua,r=16*(1&nua),bua&&(r=16-r),zua=Wsa(65535,16-r);0!=--l;){for(a=c*Tua+4*Yua,n=f*eua+4*(nua>>1),e=4*(3&f),d=(3&Yua)-1,s=Hta+1,r=65535===(u=zua)?16:0;0!=--s;)t=jua[e+(d=d+1&3)],255==(o=(i=Lua[a>>>2])>>>24)?Uva(n,i=Wsa(0===(i=Sva(i,t))?1:i,r),u):0!=o&&(h=Xta[n>>>2],Uva(n,i=Wsa(0===(i=Sva(i=nva(i,h=(31744&(h=Xsa(h&=~u,r)))<<9|(992&h)<<6|(31&h)<<3|4278190080),t))?1:i,r),u)),a+=4,bua?0===r&&(n+=4):0!==r&&(n+=4),r^=16,u=~u;++c,++f}}();8===Zta&&function(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d;for(a=Ova(),o=Pta&~sta,c=Gta+1,h=Zua,zua=8*(3&nua),bua&&(zua=24-zua),Aua=Zsa^Wsa(255,zua),n=0==(1&nua)?0:522133279,0==(1&(d=oua))&&(n^=522133279);0!=--c;){for(n^=522133279,r=h*Tua+4*Yua,s=d*eua+4*(nua>>2),i=Hta+1,e=zua,l=Aua;0!=--i;)31<(u=(t=(Lua[r>>>2]&~n)+n)>>>24)&&(u<224&&(f=Xta[s>>>2],t=nva(t,f=a[f=Xsa(f&=~l,e)])),Uva(s,t=Wsa(t=owa(t,o),e),l)),r+=4,l=bua?0===e?(s+=4,e=24,16777215):(e-=8,l>>>8|4278190080):24===e?(s+=4,e=0,4294967040):(e+=8,l<<8|255),n^=522133279;++h,++d}}();return Eta=(Dta=nua)+Hta,Cta=(Fta=oua)+Gta,!0}())return;if(30===Uta||31===Uta){if(1!==wua.methodArgumentCount())return wua.primitiveFail();if(Kua=wua.stackIntegerValue(0),!(!wua.failed()&&0<=Kua&&Kua<=255))return wua.primitiveFail()}Jta=0,Qva(),Fua?function(){var e,t,r,i,a,s;for(r=Gua[Uta+1],s=1;s<=Gta;s++){if(t=Eua?Zsa:$va(oua+s-1),cua=zua,i=Xta[aua>>>2],e=r(t,i),i=cua&e|i&~cua,Xta[aua>>>2]=i,aua+=4,cua=Zsa,3===Uta)for(i=t,a=2;a<=Dua-1;a++)Xta[aua>>>2]=i,aua+=4;else for(a=2;a<=Dua-1;a++)i=Xta[aua>>>2],e=r(t,i),Xta[aua>>>2]=e,aua+=4;1>>2],e=r(t,i),i=cua&e|i&~cua,Xta[aua>>>2]=i,aua+=4),aua+=Yta}}():(function(){var e;Oua===$ta&&Zua<=oua&&(Zua>>2],Qua+=n):l=0,cua=zua,f=Lua[Qua>>>2],Qua+=n,t=Ysa(l&d,a)|Ysa(f&r,Jua),l=f,o=Xta[aua>>>2],e=s(t&i,o),o=cua&e|o&~cua,Xta[aua>>>2]=o,aua+=n,cua=Zsa,3===Uta)if(0===Jua&&i===Zsa)if(-1===qua)for(u=2;u<=Dua-1;u++)f=Lua[Qua>>>2],Qua+=n,Xta[aua>>>2]=f,aua+=n;else for(u=2;u<=Dua-1;u++)Xta[aua>>>2]=l,aua+=n,l=Lua[Qua>>>2],Qua+=n;else for(u=2;u<=Dua-1;u++)f=Lua[Qua>>>2],Qua+=n,t=Ysa(l&d,a)|Ysa(f&r,Jua),l=f,Xta[aua>>>2]=t&i,aua+=n;else for(u=2;u<=Dua-1;u++)f=Lua[Qua>>>2],Qua+=n,t=Ysa(l&d,a)|Ysa(f&r,Jua),l=f,e=s(t&i,Xta[aua>>>2]),Xta[aua>>>2]=e,aua+=n;1>>2],Qua+=n,t=Ysa(l&d,a)|Ysa(f&r,Jua),o=Xta[aua>>>2],e=s(t&i,o),o=cua&e|o&~cua,Xta[aua>>>2]=o,aua+=n),Qua+=Mua,aua+=Yta}}())),22!==Uta&&32!==Uta||(Dta=Eta=Fta=Cta=0);Eta=0>>2]),Xta[aua>>>2]=cua&d):(d=l(s&f,(o=Xta[aua>>>2])&cua),o=cua&d|o&~cua,Xta[aua>>>2]=o),aua+=4,g=2===n?(cua=Aua,v):(cua=Zsa,dua),0!=--n;);Qua+=Mua,aua+=Yta}}function Ova(){return[0,4278190081,4294967295,4286611584,4294901760,4278255360,4278190335,4278255615,4294967040,4294902015,4280295456,4282400832,4284506208,4288651167,4290756543,4292861919,4278716424,4279242768,4279769112,4280821800,4281348144,4281874488,4282927176,4283453520,4283979864,4285032552,4285558896,4286085240,4287072135,4287598479,4288124823,4289177511,4289703855,4290230199,4291282887,4291809231,4292335575,4293388263,4293914607,4294440951,4278190081,4278203136,4278216192,4278229248,4278242304,4278255360,4278190131,4278203187,4278216243,4278229299,4278242355,4278255411,4278190182,4278203238,4278216294,4278229350,4278242406,4278255462,4278190233,4278203289,4278216345,4278229401,4278242457,4278255513,4278190284,4278203340,4278216396,4278229452,4278242508,4278255564,4278190335,4278203391,4278216447,4278229503,4278242559,4278255615,4281532416,4281545472,4281558528,4281571584,4281584640,4281597696,4281532467,4281545523,4281558579,4281571635,4281584691,4281597747,4281532518,4281545574,4281558630,4281571686,4281584742,4281597798,4281532569,4281545625,4281558681,4281571737,4281584793,4281597849,4281532620,4281545676,4281558732,4281571788,4281584844,4281597900,4281532671,4281545727,4281558783,4281571839,4281584895,4281597951,4284874752,4284887808,4284900864,4284913920,4284926976,4284940032,4284874803,4284887859,4284900915,4284913971,4284927027,4284940083,4284874854,4284887910,4284900966,4284914022,4284927078,4284940134,4284874905,4284887961,4284901017,4284914073,4284927129,4284940185,4284874956,4284888012,4284901068,4284914124,4284927180,4284940236,4284875007,4284888063,4284901119,4284914175,4284927231,4284940287,4288217088,4288230144,4288243200,4288256256,4288269312,4288282368,4288217139,4288230195,4288243251,4288256307,4288269363,4288282419,4288217190,4288230246,4288243302,4288256358,4288269414,4288282470,4288217241,4288230297,4288243353,4288256409,4288269465,4288282521,4288217292,4288230348,4288243404,4288256460,4288269516,4288282572,4288217343,4288230399,4288243455,4288256511,4288269567,4288282623,4291559424,4291572480,4291585536,4291598592,4291611648,4291624704,4291559475,4291572531,4291585587,4291598643,4291611699,4291624755,4291559526,4291572582,4291585638,4291598694,4291611750,4291624806,4291559577,4291572633,4291585689,4291598745,4291611801,4291624857,4291559628,4291572684,4291585740,4291598796,4291611852,4291624908,4291559679,4291572735,4291585791,4291598847,4291611903,4291624959,4294901760,4294914816,4294927872,4294940928,4294953984,4294967040,4294901811,4294914867,4294927923,4294940979,4294954035,4294967091,4294901862,4294914918,4294927974,4294941030,4294954086,4294967142,4294901913,4294914969,4294928025,4294941081,4294954137,4294967193,4294901964,4294915020,4294928076,4294941132,4294954188,4294967244,4294902015,4294915071,4294928127,4294941183,4294954239,4294967295]}function Pva(e,t,r){return e>>16&255)]<<10)+(iua[r+(e>>>8&255)]<<5)+iua[r+(255&e)]}function Uva(e,t,r){var i;i=Xta[e>>>2],i&=r,i|=t,Xta[e>>>2]=i}function Wva(e,t){var r,i;return"number"==typeof(i=wua.fetchPointerofObject(e,t))?i:-2147483648<=(r=wua.floatValueOf(i))&&r<=2147483647?0|r:(wua.primitiveFail(),0)}function Xva(e,t,r){var i,a;return"number"==typeof(a=wua.fetchPointerofObject(e,t))?a:a.isNil?r:-2147483648<=(i=wua.floatValueOf(a))&&i<=2147483647?0|i:(wua.primitiveFail(),0)}function Yva(e,t){return 32!==Zta?t:0===t?0:0!=(4278190080&t)?t:t|4278190080&e}function Zva(){return Cua}function $va(e){return rua[(t=e)-Usa(t,r=tua)*r|0];var t,r}function _va(e){return!!e.isNil||(0===Uta||(5===Uta||(10===Uta||15===Uta)))}function cwa(){return Gua[1]=Fva,Gua[2]=sva,Gua[3]=tva,Gua[4]=exa,Gua[5]=uva,Gua[6]=Rva,Gua[7]=Dva,Gua[8]=Bva,Gua[9]=vva,Gua[10]=Ava,Gua[11]=wva,Gua[12]=Cva,Gua[13]=zva,Gua[14]=xva,Gua[15]=yva,Gua[16]=Rva,Gua[17]=Rva,Gua[18]=Rva,Gua[19]=jva,Gua[20]=fxa,Gua[21]=Lwa,Gua[22]=$wa,Gua[23]=hva,Gua[24]=iva,Gua[25]=kva,Gua[26]=Cwa,Gua[27]=Bwa,Gua[28]=Wwa,Gua[29]=Xwa,Gua[30]=Ywa,Gua[31]=lva,Gua[32]=ova,Gua[33]=Rwa,Gua[34]=gxa,Gua[35]=nva,Gua[36]=nva,Gua[37]=nva,Gua[38]=Zwa,Gua[39]=Dwa,Gua[40]=Awa,Gua[41]=Yva,Gua[42]=Qwa,function(){var e,t,r,i,a,s,n,o,u;for(t=0;t<=255;t++)for(e=0;e<=15;e++)a=e,u=o=n=s=void 0,n=kua[7&(s=255&(i=t))],o=lua[s>>>3],u=a>>8&255)],o=lua[s>>>3],u|=a>>16&255)],o=lua[s>>>3],r=u|=a>loadBitBltDestForm: destBitsSize != destPitch * destHeight, expected "+eua+"*"+_ta+"="+eua*_ta+", got "+e)}Xta=Xta.wordsOrBytes()}return!0}function fwa(e){return gwa(e,!1)}function gwa(e,t){if(Ita=e,xua=t,Uta=wua.fetchIntegerofObject(jta,Ita),wua.failed()||Uta<0||Ata-2>loadBitBltSourceForm: sourceBitsSize != sourcePitch * sourceHeight, expected "+Tua+"*"+Pua+"="+Tua*Pua+", got "+e)}Lua=Lua.wordsOrBytes()}return!0}())return!1;if(!function(){var e,t,r,i;if(Pta=Rta=Ota=0,Qta=Sta=Tta=null,(t=wua.fetchPointerofObject(dta,Ita)).isNil)return!0;if(Pta=tta,i=!1,wua.isWords(t))r=Ssa(t),Qta=t.words,i=!0;else{if(!(wua.isPointers(t)&&3<=Ssa(t)))return!1;if(Tta=jwa(wua.fetchPointerofObject(0,t)),Sta=jwa(wua.fetchPointerofObject(1,t)),(e=wua.fetchPointerofObject(2,t)).isNil)r=0;else{if(!wua.isWords(e))return!1;r=Ssa(e),Qta=e.words}Pta|=sta}if(0!=(r&r-1))return!1;Rta=r-1,Ota=0,512===r&&(Ota=3);4096===r&&(Ota=4);32768===r&&(Ota=5);0===r?(Qta=null,Rta=0):Pta|=rta;i&&axa();!function(e,t){return!e||!t||0===e[Bta]&&0===e[zta]&&0===e[pta]&&0===e[$sa]&&16711680===t[Bta]&&65280===t[zta]&&255===t[pta]&&4278190080===t[$sa]}(Tta,Sta)?Pta|=qta:Tta=Sta=null;return!0}())return!1;0==(Pta&sta)&&axa(),Vua=Xva(lta,Ita,0),Wua=Xva(mta,Ita,0)}return!!function(){var e;if(Eua)return!(rua=null);if(wua.isPointers(sua)&&4<=Ssa(sua))e=wua.fetchPointerofObject(vta,sua),tua=wua.fetchIntegerofObject(xta,sua),wua.isWords(e)||(Eua=!0);else{if(wua.isPointers(sua)||!wua.isWords(sua))return!1;tua=Ssa(e=sua)}return rua=e.wordsOrBytes(),!0}()&&(Mta=Xva(bta,Ita,0),Nta=Xva(cta,Ita,0),Lta=Xva(ata,Ita,fua),Kta=Xva(_sa,Ita,_ta),!wua.failed()&&(Mta<0&&(Lta+=Mta,Mta=0),Nta<0&&(Kta+=Nta,Nta=0),fua>>2],h=0,o=Xua,l=mua,c=e,t===(tta|rta))for(;n=Xsa(u,o)&r,h|=Wsa(Qta[n&Rta]&i,l),l+=s,0!=(4294967264&(o+=a))&&(Rua?o+=32:o-=32,u=Lua[(Qua+=4)>>>2]),0!=--c;);else for(;h|=Wsa(owa(n=Xsa(u,o)&r,t)&i,l),l+=s,0!=(4294967264&(o+=a))&&(Rua?o+=32:o-=32,u=Lua[(Qua+=4)>>>2]),0!=--c;);return Xua=o,h}function zwa(e,t){var r,i,a;return e<0||t<0||(i=e>>>14)>=Uua||(a=t>>>14)>=Pua?0:(r=a*Tua+4*Xsa(i,cva),Xsa(Lua[r>>>2],Xua=dva[i&bva])&eva)}function Awa(e,t){var r,i,a,s,n;if(32===Zta)return e===t?0:t;for(n=Bua[i=Zta],a=0,s=1;s<=dua;s++)(e&n)===(r=t&n)&&(r=0),a|=r,n=Wsa(n,i);return a}function Bwa(e,t){return qwa(~e,t,Zta,dua)}function Cwa(e,t){return 0===e?t:e|qwa(~e,t,Zta,dua)}function Dwa(e,t){var r,i,a,s,n;if(1===dua)return t;if(r=0,a=Wsa(1,Zta)-1,s=Wsa(a,(dua-1)*Zta),r|=Wsa(t&a,i=32-Zta)|Xsa(t&s,i),dua<=2)return r;for(n=2;n<=dua>>1;n++)a=Wsa(a,Zta),s=Xsa(s,Zta),r|=Wsa(t&a,i-=2*Zta)|Xsa(t&s,i);return r}function Ewa(){return fwa(wua.stackValue(wua.methodArgumentCount()))?(Hva(),wua.failed()?null:(cxa(),wua.failed()?null:(wua.pop(wua.methodArgumentCount()),22===Uta||32===Uta?(wua.pop(1),wua.pushInteger(Jta)):void 0))):wua.primitiveFail()}function Fwa(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d;if(6!==wua.methodArgumentCount())return wua.primitiveFail();if(c=wua.stackIntegerValue(0),a=wua.stackObjectValue(1),u=wua.stackObjectValue(2),Rsa(a)!==wua.classArray()||Rsa(u)!==wua.classArray())return wua.primitiveFail();if(256!==Ssa(u))return wua.primitiveFail();if(wua.failed())return null;if(s=Ssa(a)-2,r=wua.stackIntegerValue(3),h=wua.stackIntegerValue(4),d=wua.stackObjectValue(5),!wua.isBytes(d))return wua.primitiveFail();if(!(0>1,l=1;l<=u;l++)if(gua+=a,(r-=s)<0&&(hua+=h,r+=u),l>1,l=1;l<=s;l++)if(hua+=h,(r-=u)<0&&(gua+=a,r+=s),l=nta+12))return wua.primitiveFail();(a=vua-1)<=0&&(a=1);_=Wva(nta,Ita),r=Wva(nta+3,Ita),(O=Pva(_,r,a))<0&&(_=r-a*O);b=Wva(nta+1,Ita),r=Wva(nta+4,Ita),(S=Pva(b,r,a))<0&&(b=r-a*S);v=Wva(nta+9,Ita),r=Wva(nta+6,Ita),(l=Pva(v,r,a))<0&&(v=r-a*l);c=Wva(nta+10,Ita),r=Wva(nta+7,Ita),(s=Pva(c,r,a))<0&&(c=r-a*s);if(wua.failed())return;if(2===wua.methodArgumentCount())if(w=wua.stackIntegerValue(1),(g=wua.stackValue(0)).isNil){if(Nua<16)return wua.primitiveFail()}else{if(Ssa(g)>>=1;for(eva=Bua[Nua],bva=Wsa(1,cva=5-fva)-1,e=0;e<=bva;e++)dva[e]=Rua?32-Wsa(e+1,fva):Wsa(e,fva)})(),1>>2]),Xta[aua>>>2]=cua&p):(n=Xta[aua>>>2],p=u(i&d,n&cua),n=cua&p|n&~cua,Xta[aua>>>2]=n),aua+=4,I=2===r?(cua=Aua,y):(cua=Zsa,dua),0!=--r;);_+=O,b+=S,v+=l,c+=s,aua+=Yta}}(),Eta=0>>=8),u=255&(p>>>=8),o=255&(p>>>=8),255!=(c=255&Vta)&&(o=o*c>>>8,u=u*c>>>8,a=a*c>>>8,d=d*c>>>8),s=255&(l=t),b=255&(i=Wta),$ua&&(s=$ua[s],b=$ua[b]),255<(f=(s*(255-d)>>>8)+(b*d>>>8))&&(f=255),pua&&(f=pua[f]),s=255&(l>>>=8),b=255&(i>>>=8),$ua&&(s=$ua[s],b=$ua[b]),255<(r=(s*(255-a)>>>8)+(b*a>>>8))&&(r=255),pua&&(r=pua[r]),s=255&(l>>>=8),b=255&(i>>>=8),$ua&&(s=$ua[s],b=$ua[b]),255<(h=(s*(255-u)>>>8)+(b*u>>>8))&&(h=255),pua&&(h=pua[h]),i>>>=8,255<(n=((255&(l>>>=8))*(255-o)>>>8)+o)&&(n=255),(((n<<8)+h<<8)+r<<8)+f)}function Qwa(e,t){return 0===e?t:function(e,t,r,i){var a,s,n,o,u,l;for(l=Bua[r],s=0,o=1;o<=i;o++)n=Xsa(e&l,(o-1)*r),a=Xsa(t&l,(o-1)*r),32!==r&&(a=16===r?(n=4278190080|Swa(n),4278190080|Swa(a)):(n=4278190080|Uwa(n,r,32),4278190080|Uwa(a,r,32))),u=Owa(n,a),32!==r&&(u=Uwa(u,32,r)),s|=Wsa(u,(o-1)*r),l=Wsa(l,r);return s}(e,t,Zta,dua)}function Rwa(e,t){var r,i,a,s,n,o,u,l,c,h;for(n=Bua[Zta],o=16===Zta?(i=5,31):(i=8,255),c=cua,u=t,s=e,l=1;l<=dua;l++)0<(c&n)&&(h=u&n,r=s&n,a=Zta<16?r==h?0:1:((a=wwa(r,h,i,3))&o)+(Xsa(a,i)&o)+(Xsa(Xsa(a,i),i)&o),Jta+=a),c=Xsa(c,Zta),s=Xsa(s,Zta),u=Xsa(u,Zta);return t}function Swa(e){return(31&e)<<3|(992&e)<<6|(31744&e)<<9}function Uwa(e,t,r){var i,a,s,n;return 0<(i=r-t)?(n=Wsa(1,t)-1,a=(s=Wsa(e,i))&(n=Wsa(n,i)),n=Wsa(n,r),a+((s=Wsa(s,i))&n)+(Wsa(s,i)&Wsa(n,r))):0===i?5===t?32767&e:8===t?16777215&e:e:0===e?e:(n=Wsa(1,r)-1,a=(s=Xsa(e,i=t-r))&n,n=Wsa(n,r),0===(a=a+((s=Xsa(s,i))&n)+(Xsa(s,i)&Wsa(n,r)))?1:a)}function Wwa(e,t){return Zta<16?swa(e,t,Zta,dua):16===Zta?swa(e,t,5,3)+(swa(e>>>16,t>>>16,5,3)<<16):swa(e,t,8,4)}function Xwa(e,t){return Zta<16?twa(e,t,Zta,dua):16===Zta?twa(e,t,5,3)+(twa(e>>>16,t>>>16,5,3)<<16):twa(e,t,8,4)}function Ywa(e,t){var r;return r=~e,Zta<16?twa(r,t,Zta,dua):16===Zta?twa(r,t,5,3)+(twa(r>>>16,t>>>16,5,3)<<16):twa(r,t,8,4)}function Zwa(e,t){return Zta<16?uwa(e,t,Zta,dua):16===Zta?uwa(e,t,5,3)+(uwa(e>>>16,t>>>16,5,3)<<16):uwa(e,t,8,4)}function $wa(e,t){return Zta<16?wwa(e,t,Zta,dua):16===Zta?wwa(e,t,5,3)+(wwa(e>>>16,t>>>16,5,3)<<16):wwa(e,t,8,4)}function _wa(e){return!1!=((wua=e).majorVersion()==Psa)&&wua.minorVersion()>=Qsa}function axa(){var e,t;if(e=t=0,!(Nua<=8)){if(16===Nua&&(e=5),32===Nua&&(e=8),0===Ota){if(Zta<=8)return;16===Zta&&(t=5),32===Zta&&(t=8)}else t=Ota;bxa(e,t)}}function bxa(e,t){var r,i,a=[0,0,0,0],s=[0,0,0,0];0!=(r=t-e)&&(r<=0?(i=Wsa(1,t)-1,s[Bta]=Wsa(i,2*e-r),s[zta]=Wsa(i,e-r),s[pta]=Wsa(i,0-r),s[$sa]=0):(i=Wsa(1,e)-1,s[Bta]=Wsa(i,2*e),s[zta]=Wsa(i,e),s[pta]=i),a[Bta]=3*r,a[zta]=2*r,a[pta]=r,a[$sa]=0,Tta=a,Sta=s,Pta=Pta|tta|qta)}function cxa(){wua.showDisplayBitsLeftTopRightBottom($ta,Dta,Fta,Eta,Cta)}function exa(e,t){return e}function fxa(e,t){return e-t}function gxa(e,t){var r,i,a,s,n,o;if((Pta&(tta|rta))!=(tta|rta))return t;for(r=Bua[Zta],a=t,n=cua,s=1;s<=dua;s++)0!=(n&r)&&(o=a&r,ixa(i=Zta<16?o:Uwa(o,16===Zta?5:8,Ota),hxa(i)+1)),n=Xsa(n,Zta),a=Xsa(a,Zta);return t}function hxa(e){return Qta[e&Rta]}function ixa(e,t){return Qta[e&Rta]=t}function kxa(){var e,t,r,i;if(uua){if(!_ua&&!lwa())return;r=_ua,i=!1,"number"==typeof(e=wua.fetchPointerofObject(vta,$ta))&&(r(e=e,Dta,Fta,Eta-Dta,Cta-Fta),Xta=eua=0,i=!0),Fua||"number"==typeof(t=wua.fetchPointerofObject(vta,Oua))&&(t=t,i&&t===e||r(t,0,0,0,0),Lua=Tua=0),uua=!1}}function oxa(e,t,r,i,a,s,n,o){var u,l,c,h,f,d,p,b,m,v,g,k,_,S,y,I,O,w,F;b=Bua[Zta],l=0,m=2===n?(c=t>>1,f=r>>1,p=i>>1,a>>1):(c=Usa(t,n),f=Usa(r,n),p=Usa(i,n),Usa(a,n)),d=e;do{y=Yua,g=Zua,I=O=S=k=0,w=0,h=n;do{for(F=y,_=g,u=n;v=zwa(F,_),25===Uta&&0===v||(++w,k+=255&(v=Nua<16?s[v]:16===Nua?Swa(v):v),S+=v>>>8&255,O+=v>>>16&255,I+=v>>>24),F+=c,_+=f,0!=--u;);y+=p,g+=m}while(0!=--h);l|=Wsa((v=0===w||25===Uta&&w>1?0:(4===w?(O>>>=2,S>>>=2,k>>>=2,I>>>=2):(O=Usa(O,w),S=Usa(S,w),k=Usa(k,w),I=Usa(I,w)),0===(v=(I<<24)+(O<<16)+(S<<8)+k)&&0>2)===DIa&&sIa===BIa&&sIa===uIa&&BIa===uIa),!1===vIa.failed())}function IIa(){var e,t,r,i,a;for(i=0,r=zIa;i>1,i=sIa>>2,f=1;f<=xIa;f++)for(c=rIa(1,f),h=c>>1,m=sIa,v=c,t=0|Math.floor(m/v),l=1;l<=h;l++)for(o=(b=(l-1)*t)=oIa}function FJa(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function IJa(){return HJa}function JJa(){var e,t,r,i,a,s;if(e=GJa.stackObjectValue(0),a=GJa.stackObjectValue(1),GJa.failed())return null;if(GJa.success(GJa.isWords(e)),GJa.success(GJa.isWords(a)),GJa.failed())return null;if(i=FJa(e),GJa.success(i===FJa(a)),GJa.failed())return null;for(s=a.wordsAsFloat32Array(),t=e.wordsAsFloat32Array(),r=0;r<=i-1;r++)s[r]=s[r]+t[r];GJa.pop(1)}function KJa(){var e,t,r,i,a;if(a=GJa.stackFloatValue(0),r=GJa.stackObjectValue(1),GJa.failed())return null;if(GJa.success(GJa.isWords(r)),GJa.failed())return null;for(t=FJa(r),i=r.wordsAsFloat32Array(),e=0;e<=t-1;e++)i[e]=i[e]+a;GJa.pop(1)}function LJa(){var e,t,r;return t=GJa.stackIntegerValue(0),r=GJa.stackObjectValue(1),GJa.failed()?null:(GJa.success(GJa.isWords(r)),GJa.success(0=EJa}function MLa(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function NLa(e,t){return new Int32Array(e.buffer,e.byteOffset+4*t)}function QLa(e,t){var r,i,a,s;return r=e[0],a=e[1],(i=t[0]-r)*i+(s=t[1]-a)*s}function SLa(){return PLa}function VLa(e){console.log(PLa+": "+e)}function WLa(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S,y,I,O,w,F,C,x,A,P,$,V,Y,M,j,N,q,B,W,E,L,T,R,Q,D,U,z,X,G;if(M=OLa.stackValue(11),j=OLa.stackValue(10),N=OLa.stackValue(9),q=OLa.stackValue(8),B=OLa.stackValue(7),W=OLa.stackValue(6),E=OLa.stackValue(5),L=OLa.stackValue(4),T=OLa.stackIntegerValue(3),R=OLa.stackValue(2),Q=OLa.stackValue(1),D=OLa.stackValue(0),OLa.failed())return null;if(OLa.failed())return VLa("failed 1"),null;if(OLa.success(OLa.isWords(M)&&OLa.isWords(j)&&OLa.isWords(N)&&OLa.isWords(q)&&OLa.isWords(B)&&OLa.isWords(W)&&OLa.isWords(E)&&OLa.isWords(L)&&OLa.isWords(R)&&OLa.isWords(Q)&&OLa.isWords(D)),OLa.failed())return VLa("failed 2"),null;if(OLa.success(OLa.isMemberOf(M,"PointArray")&&OLa.isMemberOf(j,"PointArray")),OLa.failed())return VLa("failed 3"),null;if(f=M.wordsAsInt32Array(),v=j.wordsAsInt32Array(),k=N.wordsAsInt32Array(),u=q.wordsAsInt32Array(),p=B.wordsAsInt32Array(),c=W.wordsAsInt32Array(),P=E.wordsAsInt32Array(),e=L.wordsAsInt32Array(),S=R.wordsAsInt32Array(),V=Q.wordsAsInt32Array(),_=D.wordsAsInt32Array(),g=MLa(j)>>>1,F=MLa(N)>>>1,l=MLa(q)>>>1,t=MLa(W),h=MLa(R),OLa.success(h===MLa(Q)&&h===MLa(D)&&l=F-1&&MLa(M)>>>1>=F&&l-1<=t&&l<=g&&MLa(E)>=F-1&&MLa(L)>=l-1),OLa.failed())return VLa("failed 5"),null;if(C=T>>>1,b=(r=1&T)?0:C*C>>>10,_[V[S[0]=0]=0]=2,O=0-b,!((d=l)-1<=g&&d-1<=t))return OLa.primitiveFail(),null;for(I=1;I<=d;I++)O=O+(c[i=I-1]+QLa(NLa(v,i<<1),f)>>>7)+b,V[I]=O,S[I]=O*I,_[I]=I+1;for(O=V[0]-b,w=1;w<=F;w++){for(y=(a=w-1)<<1,A=S[0],O=O+(p[a]+QLa(NLa(f,y),v)>>>7)+b,V[0]=O,S[0]=O*w,_[0]=w+1,d=l,I=1;I<=d;I++)s=(i=I-1)<<1,x=S[I],Y=S[i],m=p[a]+QLa(NLa(f,y),NLa(v,I<<1))>>>7,0===(O=V[I])?x+=m:(x=x+O+m*_[I],m+=O),o=c[i]+QLa(NLa(v,s),NLa(f,w<<1))>>>7,0===(O=V[i])?Y+=o:(Y=Y+O+o*_[i],o+=O),r?A=1<<29:A+=(QLa(NLa(u,s),NLa(k,y))+QLa(NLa(v,s),NLa(f,y)))*(16+(z=e[i],X=P[a],G=void 0,180<(G=Math.abs(X-z))&&(G=360-G),G*G>>>6))>>>11,$=A<=x&&A<=Y?(n=A,O=0,1):x<=Y?(n=x,O=m+b,_[I]+1):(n=Y,O=o+b,_[i]+1),A=S[I],S[I]=Math.min(n,1<<29),V[I]=Math.min(O,1<<29),_[I]=$;O=V[0]}return U=n,OLa.failed()||OLa.popthenPush(13,U),null}function XLa(){return OLa.failed()||OLa.popthenPush(1,2e3),null}function YLa(e){return!1!=((OLa=e).majorVersion()==KLa)&&OLa.minorVersion()>=LLa}function oNa(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function qNa(e,t){return 0|Math.floor(e/t)}function rNa(e,t){return 31>>r)}function EOa(){return rOa}function GOa(e,t){var r,i,a,s,n;if(i=e[0]>>>24,TNa>>24&255))return-1}return-1}function IOa(){var e,t,r,i,a,s,n,o;return r=t=cOa[vNa],i=cOa[wNa],n=cOa[QNa],o=cOa[$Na],0!==n&&0!==o&&(r=qNa(r,n),i=qNa(i,o)),e=(i>>>3)*cOa[tNa]+(r>>>3),s=((7&i)<<3)+(7&r),a=bOa[e][s],++t<8*cOa[SNa]?cOa[vNa]=t:(cOa[vNa]=0,cOa[wNa]++),a}function JOa(){var e,t,r,i,a,s,n,o;return r=t=eOa[vNa],i=eOa[wNa],n=eOa[QNa],o=eOa[$Na],0!==n&&0!==o&&(r=qNa(r,n),i=qNa(i,o)),e=(i>>>3)*eOa[tNa]+(r>>>3),s=((7&i)<<3)+(7&r),a=dOa[e][s],++t<8*eOa[SNa]?eOa[vNa]=t:(eOa[vNa]=0,eOa[wNa]++),a}function KOa(){var e,t,r,i,a,s,n,o;return r=t=uOa[vNa],i=uOa[wNa],n=uOa[QNa],o=uOa[$Na],0!==n&&0!==o&&(r=qNa(r,n),i=qNa(i,o)),e=(i>>>3)*uOa[tNa]+(r>>>3),s=((7&i)<<3)+(7&r),a=tOa[e][s],++t<8*uOa[SNa]?uOa[vNa]=t:(uOa[vNa]=0,uOa[wNa]++),a}function LOa(){var e;return 4!==iOa.methodArgumentCount()?iOa.primitiveFail():(hOa=iOa.stackIntegerValue(0),e=iOa.stackObjectValue(1),iOa.failed()?null:iOa.isWords(e)&&3===oNa(e)?(sOa=e.wordsAsInt32Array(),e=iOa.stackObjectValue(2),iOa.failed()?null:iOa.isWords(e)?(kOa=oNa(e),jOa=e.wordsAsInt32Array(),e=iOa.stackObjectValue(3),iOa.failed()?null:SOa(e)?(function(){var e,t;for(uOa[vNa]=0,e=uOa[wNa]=0;e<=kOa-1;e++)t=KOa(),t+=sOa[PNa],t=Math.min(t,VNa),sOa[PNa]=t&hOa,t&=VNa-hOa,t=Math.max(t,1),jOa[e]=4278190080+(t<<16)+(t<<8)+t}(),void iOa.pop(4)):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail())}function MOa(){var e,t,r;return 4!==iOa.methodArgumentCount()?iOa.primitiveFail():(hOa=iOa.stackIntegerValue(0),e=iOa.stackObjectValue(1),iOa.failed()?null:iOa.isWords(e)&&3===oNa(e)?(sOa=e.wordsAsInt32Array(),e=iOa.stackObjectValue(2),iOa.failed()?null:iOa.isWords(e)?(kOa=oNa(e),jOa=e.wordsAsInt32Array(),e=iOa.stackObjectValue(3),iOa.failed()?null:iOa.isPointers(e)&&3===oNa(e)&&SOa(iOa.fetchPointerofObject(0,e))?(t=iOa.fetchPointerofObject(1,e),wOa(cOa,t)&&xOa(bOa,t)?(r=iOa.fetchPointerofObject(2,e),wOa(eOa,r)&&xOa(dOa,r)?(function(){var e,t,r,i,a,s,n;for(uOa[vNa]=0,uOa[wNa]=0,cOa[vNa]=0,cOa[wNa]=0,eOa[vNa]=0,a=eOa[wNa]=0;a<=kOa-1;a++)n=KOa(),t=IOa(),t-=ZNa,r=JOa(),s=n+(HNa*(r-=ZNa)>>16)+sOa[YNa],s=Math.min(s,VNa),s=Math.max(s,0),sOa[YNa]=s&hOa,s&=VNa-hOa,s=Math.max(s,1),i=n-(ANa*t>>16)-(DNa*r>>16)+sOa[PNa],i=Math.min(i,VNa),i=Math.max(i,0),sOa[PNa]=i&hOa,i&=VNa-hOa,i=Math.max(i,1),e=n+(JNa*t>>16)+sOa[uNa],e=Math.min(e,VNa),e=Math.max(e,0),sOa[uNa]=e&hOa,e&=VNa-hOa,e=Math.max(e,1),jOa[a]=4278190080+(s<<16)+(i<<8)+e}(),void iOa.pop(4)):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail())}function NOa(){var e,t,r,i;return 5!==iOa.methodArgumentCount()?iOa.primitiveFail():(r=iOa.stackObjectValue(0),iOa.failed()?null:function(e){var t,r,i;if(!(oNa(e)<5)&&iOa.isPointers(e)&&"number"!=typeof(t=iOa.fetchPointerofObject(0,e))&&iOa.isBytes(t)&&(oOa=t.bytes,r=(i=t).bytes?i.bytes.length:i.words?4*i.words.length:0,pOa=iOa.fetchIntegerofObject(1,e),qOa=iOa.fetchIntegerofObject(2,e),mOa=iOa.fetchIntegerofObject(3,e),nOa=iOa.fetchIntegerofObject(4,e),!iOa.failed()&&!(r>>4,0!==(r&=15)){if(a+=s,r=POa(DOa(r),r),a<0||yNa<=a)return iOa.primitiveFail();e[lOa[a]]=r}else{if(15!=s)return;a+=s}++a}}(e,uOa),iOa.failed()?null:(i=iOa.stackValue(0),iOa.storeIntegerofObjectwithValue(1,i,pOa),iOa.storeIntegerofObjectwithValue(3,i,mOa),iOa.storeIntegerofObjectwithValue(4,i,nOa),iOa.storeIntegerofObjectwithValue(XNa,iOa.stackValue(3),uOa[XNa]),void iOa.pop(5))))):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail()):iOa.primitiveFail())}function OOa(){var e,t;return 2!==iOa.methodArgumentCount()?iOa.primitiveFail():(e=iOa.stackObjectValue(0),iOa.failed()?null:iOa.isWords(e)&&oNa(e)===yNa?(t=e.wordsAsInt32Array(),e=iOa.stackObjectValue(1),iOa.failed()?null:iOa.isWords(e)&&oNa(e)===yNa?(function(e,t){var r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S=new Array(64);for(a=0;a<=xNa-1;a++){for(r=-1,n=1;n<=xNa-1;n++)-1===r&&0!==e[n*xNa+a]&&(r=n);if(-1===r)for(i=e[a]*t[0]<<2,s=0;s<=xNa-1;s++)S[s*xNa+a]=i;else d=(m=((v=e[2*xNa+a]*t[2*xNa+a])+(g=e[6*xNa+a]*t[6*xNa+a]))*CNa)+g*(0-KNa),p=m+v*ENa,l=(o=(v=e[a]*t[a])+(g=e[4*xNa+a]*t[4*xNa+a])<<13)+p,f=o-p,c=(u=v-g<<13)+d,h=u-d,o=e[7*xNa+a]*t[7*xNa+a],u=e[5*xNa+a]*t[5*xNa+a],d=e[3*xNa+a]*t[3*xNa+a],m=o+(p=e[xNa+a]*t[xNa+a]),v=u+d,_=((g=o+d)+(k=u+p))*GNa,g*=0-LNa,k*=0-BNa,o=(o*=zNa)+(m*=0-FNa)+(g+=_),u=(u*=MNa)+(v*=0-NNa)+(k+=_),d=(d*=ONa)+v+g,p=(p*=INa)+m+k,S[a]=l+p>>11,S[7*xNa+a]=l-p>>11,S[+xNa+a]=c+d>>11,S[6*xNa+a]=c-d>>11,S[2*xNa+a]=h+u>>11,S[5*xNa+a]=h-u>>11,S[3*xNa+a]=f+o>>11,S[4*xNa+a]=f-o>>11}for(a=0;a<=yNa-xNa;a+=xNa)d=(m=((v=S[a+2])+(g=S[a+6]))*CNa)+g*(0-KNa),p=m+v*ENa,l=(o=S[a]+S[a+4]<<13)+p,f=o-p,c=(u=S[a]-S[a+4]<<13)+d,h=u-d,o=S[a+7],u=S[a+5],d=S[a+3],m=o+(p=S[a+1]),v=u+d,_=((g=o+d)+(k=u+p))*GNa,g*=0-LNa,k*=0-BNa,o=(o*=zNa)+(m*=0-FNa)+(g+=_),u=(u*=MNa)+(v*=0-NNa)+(k+=_),d=(d*=ONa)+v+g,b=(l+(p=(p*=INa)+m+k)>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a]=b,b=(l-p>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+7]=b,b=(c+d>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+1]=b,b=(c-d>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+6]=b,b=(h+u>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+2]=b,b=(h-u>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+5]=b,b=(f+o>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+3]=b,b=(f-o>>18)+ZNa,b=Math.min(b,VNa),b=Math.max(b,0),e[a+4]=b}(e.wordsAsInt32Array(),t),void iOa.pop(2)):iOa.primitiveFail()):iOa.primitiveFail())}function POa(e,t){return e=nNa}function SOa(e){return wOa(uOa,e)&&xOa(tOa,e)}function WQa(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function XQa(e,t){return 0|Math.floor(e/t)}function YQa(e,t){return e-XQa(e,t)*t|0}function fRa(e,t){var r,i;return 0===e?0<=t?90:270:(r=t/e,i=Math.atan(r),0<=e?0<=t?i/.0174532925199433:360+i/.0174532925199433:180+i/.0174532925199433)}function gRa(e){var t,r;return r=(t=90-e)/360|0,t<0&&--r,.0174532925199433*(t-360*r)}function hRa(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b;if(l=$Qa.stackValue(0),t=$Qa.stackValue(1),b=$Qa.stackValue(2),f=$Qa.stackValue(3),i=$Qa.stackIntegerValue(4),s=$Qa.stackIntegerValue(5),a=$Qa.stackValue(6),$Qa.failed())return null;if(!$Qa.isWords(a))return $Qa.primitiveFail(),null;if(!$Qa.isWords(f))return $Qa.primitiveFail(),null;if(!$Qa.isWords(b))return $Qa.primitiveFail(),null;if(!$Qa.isWords(t))return $Qa.primitiveFail(),null;if(!$Qa.isBytes(l))return $Qa.primitiveFail(),null;if(i*s!==WQa(a))return $Qa.primitiveFail(),null;if(o=WQa(f),WQa(b)!==o)return $Qa.primitiveFail(),null;if(WQa(t)!==o)return $Qa.primitiveFail(),null;if(WQa(l)!==o)return $Qa.primitiveFail(),null;for(h=f.wordsAsFloat32Array(),p=b.wordsAsFloat32Array(),e=t.words,u=l.bytes,r=a.words,n=0;n<=o-1;n++)c=0|h[n],d=0|p[n],0!==u[n]&&0<=c&&0<=d&&c>>16,e<0?0-a:a}function nRa(){var e;if(e=$Qa.stackIntegerValue(0),$Qa.failed())return null;_Qa=65536&e,$Qa.pop(1)}function oRa(){var e,t,r,i,a,s,n,o,u,l,c,h;if(l=$Qa.stackIntegerValue(0),u=$Qa.stackIntegerValue(1),o=$Qa.stackValue(2),i=$Qa.stackValue(3),$Qa.failed())return null;if((a=WQa(i))!==WQa(o))return $Qa.primitiveFail(),null;if(l<-32)return $Qa.primitiveFail(),null;if(8>>0-h:31=VQa}function QRa(){var e,t,r;return e=$Qa.stackFloatValue(0),t=$Qa.stackValue(1),r=$Qa.stackIntegerValue(2),$Qa.failed()?null:!$Qa.isWords(t)||WQa(t)>>16,e<0?0-a:a}function o_a(){var e;if(e=_$a.stackIntegerValue(0),_$a.failed())return null;a_a=65536&e,_$a.pop(1)}function p_a(){var e,t,r,i,a,s,n,o,u,l,c,h;if(l=_$a.stackIntegerValue(0),u=_$a.stackIntegerValue(1),o=_$a.stackValue(2),i=_$a.stackValue(3),_$a.failed())return null;if((a=X$a(i))!==X$a(o))return _$a.primitiveFail(),null;if(l<-32)return _$a.primitiveFail(),null;if(8>>0-h:31=l[a];else for(c=o.words,r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]>=r[a];else if(s)for(i=o.wordsAsFloat32Array(),l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]>=l[a];else for(i=o.wordsAsFloat32Array(),r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]>=r[a];_$a.pop(4),_$a.push(u)}function H_a(){var e,t,r,i,a,s,n,o,u,l,c;if(l=_$a.stackObjectValue(0),e=_$a.stackValue(1),u=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(u)),_$a.success(_$a.isBytes(l)),_$a.failed())return null;if(o=X$a(u),_$a.success(o===X$a(l)),_$a.failed())return null;if(n="number"==typeof e,_$a.isMemberOf(u,"WordArray"))if(n)for(c=u.words,s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]>=s;else for(c=u.words,r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]>=r;else if(n)for(i=u.wordsAsFloat32Array(),s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]>=s;else for(i=u.wordsAsFloat32Array(),r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]>=r;_$a.pop(4),_$a.push(l)}function I_a(){var e,t,r,i,a,s,n,o,u,l,c;if(u=_$a.stackObjectValue(0),e=_$a.stackObjectValue(1),o=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(e)),_$a.success(_$a.isWords(o)),_$a.success(_$a.isBytes(u)),_$a.failed())return null;if(n=X$a(e),_$a.success(n===X$a(o)),_$a.success(n===X$a(u)),_$a.failed())return null;if(s=_$a.isMemberOf(e,"WordArray"),_$a.isMemberOf(o,"WordArray"))if(s)for(c=o.words,l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]>l[a];else for(c=o.words,r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]>r[a];else if(s)for(i=o.wordsAsFloat32Array(),l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]>l[a];else for(i=o.wordsAsFloat32Array(),r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]>r[a];_$a.pop(4),_$a.push(u)}function J_a(){var e,t,r,i,a,s,n,o,u,l,c;if(l=_$a.stackObjectValue(0),e=_$a.stackValue(1),u=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(u)),_$a.success(_$a.isBytes(l)),_$a.failed())return null;if(o=X$a(u),_$a.success(o===X$a(l)),_$a.failed())return null;if(n="number"==typeof e,_$a.isMemberOf(u,"WordArray"))if(n)for(c=u.words,s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]>s;else for(c=u.words,r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]>r;else if(n)for(i=u.wordsAsFloat32Array(),s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]>s;else for(i=u.wordsAsFloat32Array(),r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]>r;_$a.pop(4),_$a.push(l)}function K_a(){var e,t,r,i,a,s,n,o,u,l,c;if(u=_$a.stackObjectValue(0),e=_$a.stackObjectValue(1),o=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(e)),_$a.success(_$a.isWords(o)),_$a.success(_$a.isBytes(u)),_$a.failed())return null;if(n=X$a(e),_$a.success(n===X$a(o)),_$a.success(n===X$a(u)),_$a.failed())return null;if(s=_$a.isMemberOf(e,"WordArray"),_$a.isMemberOf(o,"WordArray"))if(s)for(c=o.words,l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]<=l[a];else for(c=o.words,r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]<=r[a];else if(s)for(i=o.wordsAsFloat32Array(),l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]<=l[a];else for(i=o.wordsAsFloat32Array(),r=e.wordsAsFloat32Array(),t=u.bytes,a=0;a<=n-1;a++)t[a]=i[a]<=r[a];_$a.pop(4),_$a.push(u)}function L_a(){var e,t,r,i,a,s,n,o,u,l,c;if(l=_$a.stackObjectValue(0),e=_$a.stackValue(1),u=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(u)),_$a.success(_$a.isBytes(l)),_$a.failed())return null;if(o=X$a(u),_$a.success(o===X$a(l)),_$a.failed())return null;if(n="number"==typeof e,_$a.isMemberOf(u,"WordArray"))if(n)for(c=u.words,s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]<=s;else for(c=u.words,r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=c[a]<=r;else if(n)for(i=u.wordsAsFloat32Array(),s=e,t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]<=s;else for(i=u.wordsAsFloat32Array(),r=_$a.floatValueOf(e),t=l.bytes,a=0;a<=o-1;a++)t[a]=i[a]<=r;_$a.pop(4),_$a.push(l)}function M_a(){var e,t,r,i,a,s,n,o,u,l,c;if(u=_$a.stackObjectValue(0),e=_$a.stackObjectValue(1),o=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(e)),_$a.success(_$a.isWords(o)),_$a.success(_$a.isBytes(u)),_$a.failed())return null;if(n=X$a(e),_$a.success(n===X$a(o)),_$a.success(n===X$a(u)),_$a.failed())return null;if(s=_$a.isMemberOf(e,"WordArray"),_$a.isMemberOf(o,"WordArray"))if(s)for(c=o.words,l=e.words,t=u.bytes,a=0;a<=n-1;a++)t[a]=c[a]>>0,m[i]=r);if(!b&&!o)for(m=v.words,h=l.words,i=d-1;i<=p-1;i++)1===a[i]&&(m[i]=h[c+i-d]);_$a.pop(4)}function $_a(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g;if(f=_$a.stackObjectValue(0),e=_$a.stackObjectValue(1),h=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(e)),_$a.success(_$a.isWords(h)),_$a.success(_$a.isWords(f)),_$a.failed())return null;if(c=X$a(e),_$a.success(c===X$a(h)),_$a.success(c===X$a(f)),_$a.failed())return null;if(u=_$a.isMemberOf(e,"WordArray"),l=_$a.isMemberOf(h,"WordArray"),u&&l){if(!_$a.isMemberOf(f,"WordArray"))return _$a.primitiveFail(),null}else if(!_$a.isMemberOf(f,"KedamaFloatArray"))return _$a.primitiveFail(),null;if(l)if(u)for(v=h.words,m=e.words,g=f.words,o=0;o<=c-1;o++)b=Z$a(p=v[o],d=m[o]),g[o]=b;else for(v=h.words,a=e.wordsAsFloat32Array(),n=f.wordsAsFloat32Array(),o=0;o<=c-1;o++)i=(p=v[o])/(t=a[o]),i=Math.floor(i),n[o]=p-i*t;else if(u)for(s=h.wordsAsFloat32Array(),m=e.words,n=f.wordsAsFloat32Array(),o=0;o<=c-1;o++)i=(r=s[o])/(d=m[o]),i=Math.floor(i),n[o]=r-i*d;else for(s=h.wordsAsFloat32Array(),a=e.wordsAsFloat32Array(),n=f.wordsAsFloat32Array(),o=0;o<=c-1;o++)i=(r=s[o])/(t=a[o]),i=Math.floor(i),n[o]=r-i*t;_$a.pop(4),_$a.push(f)}function __a(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b;if(f=_$a.stackObjectValue(0),e=_$a.stackValue(1),h=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(h)),_$a.success(_$a.isWords(f)),_$a.failed())return null;if(c=X$a(h),_$a.success(c===X$a(f)),_$a.failed())return null;if(u="number"==typeof e,l=_$a.isMemberOf(h,"WordArray"),u&&l){if(!_$a.isMemberOf(f,"WordArray"))return _$a.primitiveFail(),null}else if(!_$a.isMemberOf(f,"KedamaFloatArray"))return _$a.primitiveFail(),null;if(l)if(u)for(p=h.words,o=e,b=f.words,n=0;n<=c-1;n++)b[n]=Z$a(p[n],o);else for(p=h.words,t=_$a.floatValueOf(e),s=f.wordsAsFloat32Array(),n=0;n<=c-1;n++)i=(d=p[n])/t,i=Math.floor(i),s[n]=d-i*t;else if(u)for(a=h.wordsAsFloat32Array(),o=e,s=f.wordsAsFloat32Array(),n=0;n<=c-1;n++)i=(r=a[n])/o,i=Math.floor(i),s[n]=r-i*o;else for(a=h.wordsAsFloat32Array(),t=_$a.floatValueOf(e),s=f.wordsAsFloat32Array(),n=0;n<=c-1;n++)i=(r=a[n])/t,i=Math.floor(i),s[n]=r-i*t;_$a.pop(4),_$a.push(f)}function a0a(){var e,t,r,i,a,s,n,o,u,l,c,h,f;if(l=_$a.stackObjectValue(0),e=_$a.stackObjectValue(1),u=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(e)),_$a.success(_$a.isWords(u)),_$a.success(_$a.isWords(l)),_$a.failed())return null;if(o=X$a(e),_$a.success(o===X$a(u)),_$a.success(o===X$a(l)),_$a.failed())return null;if(s=_$a.isMemberOf(e,"WordArray"),n=_$a.isMemberOf(u,"WordArray"),s&&n){if(!_$a.isMemberOf(l,"WordArray"))return _$a.primitiveFail(),null}else if(!_$a.isMemberOf(l,"KedamaFloatArray"))return _$a.primitiveFail(),null;if(n)if(s)for(h=u.words,c=e.words,f=l.words,a=0;a<=o-1;a++)f[a]=h[a]-c[a];else for(h=u.words,t=e.wordsAsFloat32Array(),i=l.wordsAsFloat32Array(),a=0;a<=o-1;a++)i[a]=h[a]-t[a];else if(s)for(r=u.wordsAsFloat32Array(),c=e.words,i=l.wordsAsFloat32Array(),a=0;a<=o-1;a++)i[a]=r[a]-c[a];else for(r=u.wordsAsFloat32Array(),t=e.wordsAsFloat32Array(),i=l.wordsAsFloat32Array(),a=0;a<=o-1;a++)i[a]=r[a]-t[a];_$a.pop(4),_$a.push(l)}function b0a(){var e,t,r,i,a,s,n,o,u,l,c,h,f;if(c=_$a.stackObjectValue(0),e=_$a.stackValue(1),l=_$a.stackObjectValue(2),_$a.failed())return null;if(_$a.success(_$a.isWords(l)),_$a.success(_$a.isWords(c)),_$a.failed())return null;if(u=X$a(l),_$a.success(u===X$a(c)),_$a.failed())return null;if(n="number"==typeof e,o=_$a.isMemberOf(l,"WordArray"),n&&o){if(!_$a.isMemberOf(c,"WordArray"))return _$a.primitiveFail(),null}else if(!_$a.isMemberOf(c,"KedamaFloatArray"))return _$a.primitiveFail(),null;if(o)if(n)for(h=l.words,s=e,f=c.words,a=0;a<=u-1;a++)f[a]=h[a]-s;else for(h=l.words,t=_$a.floatValueOf(e),i=c.wordsAsFloat32Array(),a=0;a<=u-1;a++)i[a]=h[a]-t;else if(n)for(r=l.wordsAsFloat32Array(),s=e,i=c.wordsAsFloat32Array(),a=0;a<=u-1;a++)i[a]=r[a]-s;else for(r=l.wordsAsFloat32Array(),t=_$a.floatValueOf(e),i=c.wordsAsFloat32Array(),a=0;a<=u-1;a++)i[a]=r[a]-t;_$a.pop(4),_$a.push(c)}function c0a(e){var t;return 0<(t=90-e/.0174532925199433)||(t+=360),t}function d0a(){var e,t,r,i,a,s,n;if(e=_$a.stackFloatValue(0),r=_$a.stackValue(1),n=_$a.stackIntegerValue(2),i=_$a.stackIntegerValue(3),s=_$a.stackIntegerValue(4),_$a.failed())return null;if(!_$a.isWords(r))return _$a.primitiveFail(),null;if(!(n<=X$a(r)&&1<=i&&i<=n))return _$a.primitiveFail(),null;if(t=r.wordsAsFloat32Array(),_$a.failed())return null;for(a=i;a<=n;a++)t[a-1]=n_a(s)*e;_$a.pop(5)}function e0a(){var e,t,r,i,a,s,n;if(e=_$a.stackFloatValue(0),a=_$a.stackValue(1),n=_$a.stackIntegerValue(2),t=_$a.stackIntegerValue(3),s=_$a.stackIntegerValue(4),_$a.failed())return null;if(!_$a.isWords(a))return _$a.primitiveFail(),null;if(!(n<=X$a(a)&&1<=t&&t<=n))return _$a.primitiveFail(),null;if(i=a.words,_$a.failed())return null;for(r=t;r<=n;r++)i[r-1]=n_a(s)*e|0;_$a.pop(5)}function f0a(){var e,t;return e=_$a.stackIntegerValue(0),_$a.failed()?null:(t=n_a(e),_$a.failed()?null:(_$a.pop(2),void _$a.pushInteger(t)))}function g0a(){var e,t,r,i,a;return t=_$a.stackFloatValue(0),e=_$a.stackFloatValue(1),a=_$a.stackFloatValue(2),i=_$a.stackFloatValue(3),_$a.failed()?null:(r=g_a(i-e,a-t),360<(r+=90)&&(r-=360),_$a.failed()?null:(_$a.pop(5),void _$a.pushFloat(r)))}function h0a(){var e,t,r,i,a,s,n;return t=_$a.stackFloatValue(0),e=_$a.stackFloatValue(1),a=_$a.stackFloatValue(2),i=_$a.stackFloatValue(3),_$a.failed()?null:(s=e-i,n=t-a,r=Math.sqrt(s*s+n*n),_$a.failed()?null:(_$a.pop(5),void _$a.pushFloat(r)))}function i0a(e,t,r,i,a,s,n){var o,u;(u=i)<0&&(1===s&&(u+=a),2===s&&(u=0),3===s&&(u=0-u,o=r[e],r[e]=o<3.141592653589793?3.141592653589793-o:9.42477796076938-o)),a<=u&&(1===n&&(u-=a),2===n&&(u=a-1e-6),3===n&&(u=a-1e-6-(u-a),o=r[e],r[e]=o<3.141592653589793?3.141592653589793-o:9.42477796076938-o)),t[e]=u}function j0a(e,t,r,i,a,s,n){var o;(o=i)<0&&(1===s&&(o+=a),2===s&&(o=0),3===s&&(o=0-o,r[e]=6.283185307179586-r[e])),a<=o&&(1===n&&(o-=a),2===n&&(o=a-1e-6),3===n&&(o=a-1e-6-(o-a),r[e]=6.283185307179586-r[e])),t[e]=o}function k0a(){var e,t,r,i,a,s,n,o,u,l;if(u=_$a.stackValue(0),r=_$a.stackValue(1),n=_$a.stackValue(2),_$a.failed())return null;if(!_$a.isBytes(n))return _$a.primitiveFail(),null;if(!_$a.isWords(r))return _$a.primitiveFail(),null;if(l=X$a(r),u.isFloat)a=!1;else{if(!_$a.isWords(u))return _$a.primitiveFail(),null;if(X$a(u)!==l)return _$a.primitiveFail(),null;a=!0}for(s=n.bytes,t=r.wordsAsFloat32Array(),a?o=u.wordsAsFloat32Array():e=h_a(e=_$a.floatValueOf(u)),i=0;i<=l-1;i++)1===s[i]&&(a&&(e=h_a(e=o[i])),t[i]=e);if(_$a.failed())return null;_$a.pop(3)}function l0a(e){return!1!=((_$a=e).majorVersion()==V$a)&&_$a.minorVersion()>=W$a}function m0a(){var e,t,r;return e=_$a.stackFloatValue(0),t=_$a.stackValue(1),r=_$a.stackIntegerValue(2),_$a.failed()?null:!_$a.isWords(t)||X$a(t)>=1);jgb=sgb*dgb[Sfb]|0,function(e,t,r){var i,a,s,n,o,u,l,c,h,f,d,p,b,m;f=(p=sgb*e|0)/sgb,h=r,a=(l=t)<=0?1:1-(u=(1-f)/l)/(Math.exp(u)-1);o=vfb*(h+1),i=Math.cos(o),d=Math.sin(o),m=function(e,t,r,i){var a,s,n,o,u,l,c;if(0<(o=Qgb(0,e,t,r,i)))for(u=0,a=o,s=Qgb(l=1,e,t,r,i);0=pgb),fgb.failed()?null:(function(e,t,r){var i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S;(function(e){var t,r,i,a,s,n,o,u,l,c,h;c=.6*Igb((dgb=e)[Neb]),h=.6*Igb(dgb[Peb]),t=.4*Igb(dgb[Eeb]),i=.15*Igb(dgb[Geb]),s=.06*Igb(dgb[Ieb]),o=.04*Igb(dgb[Keb]),r=.15*Igb(dgb[Feb]),a=.06*Igb(dgb[Heb]),n=.04*Igb(dgb[Jeb]),u=.022*Igb(dgb[Leb]),l=.03*Igb(dgb[Meb]),8<=cgb&&(16e3<=qgb?Rgb(Mfb,7500,600):cgb=6);7<=cgb&&(16e3<=qgb?Rgb(Lfb,6500,500):cgb=6);6<=cgb&&Rgb(Jfb,dgb[mfb],dgb[Zeb]);5<=cgb&&Rgb(Hfb,dgb[lfb],dgb[Xeb]);Rgb(Efb,dgb[kfb],dgb[Veb]),Rgb(Bfb,dgb[jfb],dgb[Teb]),Rgb(yfb,dgb[ifb],dgb[Reb]),Rgb(wfb,dgb[hfb],dgb[Qeb]),Rgb(Pfb,dgb[ofb],dgb[_eb]),Rgb(Ufb,dgb[rfb],dgb[bfb]),Bgb(Rfb,dgb[pfb],dgb[afb]),Bgb(Wfb,dgb[sfb],dgb[cfb]),Sgb(Qfb,dgb[ofb],dgb[_eb],c),Sgb(Vfb,dgb[rfb],dgb[bfb],h),Sgb(xfb,dgb[hfb],dgb[Qeb],t),Sgb(Afb,dgb[ifb],dgb[Reb],i),Sgb(Dfb,dgb[jfb],dgb[Teb],s),Sgb(Gfb,dgb[kfb],dgb[Veb],o),Sgb(zfb,dgb[ifb],dgb[Seb],r),Sgb(Cfb,dgb[jfb],dgb[Ueb],a),Sgb(Ffb,dgb[kfb],dgb[Web],n),Sgb(Ifb,dgb[lfb],dgb[Yeb],u),Sgb(Kfb,dgb[mfb],dgb[$eb],l)})(e),0=Aeb}function gkb(e){return"number"==typeof e?nkb.classSmallInteger():e.sqClass}function hkb(e){return e.bytes?e.bytes.length:e.words?4*e.words.length:0}function ikb(e,t){return 0|Math.floor(e/t)}function jkb(e,t){return e-ikb(e,t)*t|0}function kkb(e,t){return 31>>t}function rkb(e,t,r){var i,a,s,n,o,u,l,c,h;if(t<1||r<1)return nkb.primitiveFail();if(a=e,!((u=Math.min(r,zkb((h=a).bytes,hkb(h))))>3),i=1+(u-1>>3),n=jkb(t-1,8),s=7-jkb(u-1,8),o==i)return l=kkb(255,n)&lkb(255,s),0!=(Ukb(a,o)&l);if(0!==lkb(Ukb(a,o),n))return 1;for(c=1+o;c<=i-1;c++)if(0!==Ukb(a,c))return 1;return 0!=(255&kkb(Ukb(a,i),s))}}function skb(e,t){var r,i,a;return a=nkb.instantiateClassindexableSize(gkb(e),t),i=(r=hkb(e))>>=16,r+=16),t<256||(t>>>=8,r+=8),t<16||(t>>>=4,r+=4),t<4||(t>>>=2,r+=2),t<2||(t>>>=1,++r),r+t}function Kkb(e){var t,r,i,a,s,n;for(s=(n=e)<0?nkb.classLargeNegativeInteger():nkb.classLargePositiveInteger(),t=Akb(n),i=(r=nkb.instantiateClassindexableSize(s,t)).bytes,a=1;a<=t;a++)i[a-1]=Ekb(n,a);return r}function Lkb(e,t){var r,i,a,s;return i=hkb(e),0===(s=zkb(e.bytes,i))?0:(r=s+t+7>>3,a=nkb.instantiateClassindexableSize(gkb(e),r),function(e,t,r,i,a){var s,n,o,u,l,c,h;for(s=e>>3,l=jkb(e,8),h=s-1,u=0;u<=h;u++)i[u]=0;if(0===l)return Gkb(i,s,a-1,t,0);for(c=8-l,h=r-1,u=n=0;u<=h;u++)o=t[u],i[u+s]=255&(n|kkb(o,l)),n=lkb(o,c);0!==n&&(i[a-1]=n)}(t,e.bytes,i,a.bytes,r),a)}function Mkb(e,t,r){var i,a,s,n,o;return a=(o=zkb(e.bytes,r))+7>>3,(n=o-t)<=0?nkb.instantiateClassindexableSize(gkb(e),0):(s=7+n>>3,i=nkb.instantiateClassindexableSize(gkb(e),s),function(e,t,r,i,a){var s,n,o,u,l,c,h,f;if(n=e>>3,0===(l=jkb(e,8)))return Gkb(i,0,a-1,t,n);for(c=8-l,o=lkb(t[n],l),h=r-1,s=f=1+n;s<=h;s++)u=t[s],i[s-f]=255&(o|kkb(u,c)),o=lkb(u,l);0!==o&&(i[a-1]=o)}(t,e.bytes,a,i.bytes,s),i)}function Nkb(e,t){var r,i,a,s,n,o,u,l,c,h;return l=hkb(e),c=hkb(t),n=gkb(e),u=l<=c?(s=e,i=l,h=t,c):(s=t,i=c,h=e,l),r=nkb.instantiateClassindexableSize(n,u),0<(a=function(e,t,r,i,a){var s,n,o;for(n=t-1,s=o=0;s<=n;s++)o=(o>>>8)+e[s]+r[s],a[s]=255&o;for(n=i-1,s=t;s<=n;s++)o=(o>>>8)+r[s],a[s]=255&o;return o>>>8}(s.bytes,i,h.bytes,u,r.bytes))&&(o=nkb.instantiateClassindexableSize(n,u+1),xkb(r.bytes,o.bytes,u),(r=o).bytes[u]=a),r}function Okb(e,t,r){var i,a,s,n,o,u,l,c,h;if("number"==typeof e){if(e<0)return nkb.primitiveFail();s=Kkb(e)}else{if(gkb(e)===nkb.classLargeNegativeInteger())return nkb.primitiveFail();s=e}if("number"==typeof t){if(t<0)return nkb.primitiveFail();n=Kkb(t)}else{if(gkb(t)===nkb.classLargeNegativeInteger())return nkb.primitiveFail();n=t}return u=(l=hkb(s))<(c=hkb(n))?(i=l,a=s,o=c,n):(i=c,a=n,o=l,s),h=nkb.instantiateClassindexableSize(nkb.classLargePositiveInteger(),o),function(e,t,r,i,a,s){var n,o;if(o=r-1,e!==mkb)if(e!==pkb){if(e!==qkb)return nkb.primitiveFail();for(n=0;n<=o;n++)s[n]=t[n]^i[n];for(o=a-1,n=r;n<=o;n++)s[n]=i[n]}else{for(n=0;n<=o;n++)s[n]=t[n]|i[n];for(o=a-1,n=r;n<=o;n++)s[n]=i[n]}else{for(n=0;n<=o;n++)s[n]=t[n]&i[n];for(o=a-1,n=r;n<=o;n++)s[n]=0}}(r,a.bytes,i,u.bytes,o,h.bytes),nkb.failed()?0:_kb(h)}function Pkb(e,t){var r,i;return i=hkb(e),(r=hkb(t))!==i?i>>8,c=255&d,f=m<3?0:r[m-3];(y>>8),c=e[v-1]*(255&o),n=r[p-1]-u-(255&c),r[p-1]=255&n,u=h+(c>>>8)-(n>>=8),++p;if(0>>8)+r[p-1]+e[v-1],r[p-1]=255&u,++p;a[s-b]=o}}(n.bytes,Rkb(n),s.bytes,Rkb(s),o.bytes,Rkb(o)),s=Mkb(s,u,Rkb(n)-1),a=nkb.instantiateClassindexableSize(nkb.classArray(),2),nkb.stObjectatput(a,1,o),nkb.stObjectatput(a,2,s)),a}function Rkb(e){return("number"==typeof e?Akb:hkb)(e)}function Skb(e,t,r,i){var a,s,n,o;return n=hkb(e),o=hkb(t),n<=(s=hkb(r))&&o<=s&&0<=i&&i<=255?(a=nkb.instantiateClassindexableSize(nkb.classLargePositiveInteger(),s),function(e,t,r,i,a,s,n,o){var u,l,c,h,f,d,p,b;for(d=t-1,f=i-1,h=s-1,l=c=0;l<=d;l++){for(b=o[0]+e[l]*r[0],b+=(p=b*n&255)*a[0],u=1;u<=f;u++)b=(b>>>8)+o[u]+e[l]*r[u]+p*a[u],o[u-1]=255&b;for(u=i;u<=h;u++)b=(b>>>8)+o[u]+p*a[u],o[u-1]=255&b;b=(b>>>8)+c,o[h]=255&b,c=b>>>8}for(l=t;l<=h;l++){for(b=o[0],b+=(p=b*n&255)*a[0],u=1;u<=h;u++)b=(b>>>8)+o[u]+p*a[u],o[u-1]=255&b;b=(b>>>8)+c,o[h]=255&b,c=b>>>8}if(0!==c||1!==wkb(a,o,s))for(l=b=0;l<=h;l++)b=b+o[l]-a[l],o[l]=255&b,b>>=8}(e.bytes,n,t.bytes,o,r.bytes,s,i,a.bytes),_kb(a)):nkb.primitiveFail()}function Tkb(e,t,r){var i,a,s,n,o,u,l,c;return o=(c=hkb(e))<=(l=hkb(t))?(n=e,s=c,i=t,l):(n=t,s=l,i=e,c),a=r?nkb.classLargeNegativeInteger():nkb.classLargePositiveInteger(),u=nkb.instantiateClassindexableSize(a,o+s),function(e,t,r,i,a){var s,n,o,u,l,c,h,f;if(!(1===t&&0===e[0]||1===i&&0===r[0]))for(f=t-1,c=i-1,l=0;l<=f;l++)if(0!==(o=e[l])){for(h=l,n=u=0;n<=c;n++)u=(s=(s=r[n])*o+u+a[h])>>>8,a[h]=255&s,++h;a[h]=u}}(n.bytes,s,i.bytes,o,u.bytes),Zkb(u)}function Ukb(e,t){return t>hkb(e)?0:Alb(e,t)}function Vkb(e,t){var r,i,a,s,n,o,u,l,c,h;if(u=gkb(e)===nkb.classLargeNegativeInteger(),(l=hkb(e))===(c=hkb(t))){for(;1>=8;for(s=t;s<=i-1;s++)n+=r[s],a[s]=255&n,n>>=8}(s.bytes,r,i.bytes,o,a.bytes),(h?$kb:_kb)(a)}function Wkb(){return okb}function Ykb(e){var t,r;if("number"==typeof e)return 1;if(0!==(r=Rkb(e))&&0!==Alb(e,r)){if(4Ekb(1073741823,4);if(!(Alb(e,4)(r=i)?(a=1,nkb.failed()||nkb.popthenPush(2,a),null):(a=e(t=i)?(a=1,nkb.failed()||nkb.popthenPush(3,a),null):(a=e=fkb}function Alb(e,t){return e.bytes[t-1]}function Wsb(e){return"number"==typeof e?Ysb.classSmallInteger():e.sqClass}function Xsb(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function ctb(){return btb}function dtb(e){return Ysb.failed()?null:Ysb.isWords(e)&&6===Xsb(e)?e.wordsAsFloat32Array():(Ysb.primitiveFail(),null)}function etb(e){var t,r;if(!Ysb.failed()){if(Wsb(e)!==Ysb.classPoint())return Ysb.primitiveFail();if(!(t="number"==typeof(r=Ysb.fetchPointerofObject(0,e)))&&!r.isFloat)return Ysb.primitiveFail();if(Zsb=t?r:Ysb.floatValueOf(r),!(t="number"==typeof(r=Ysb.fetchPointerofObject(1,e)))&&!r.isFloat)return Ysb.primitiveFail();$sb=t?r:Ysb.floatValueOf(r)}}function gtb(e){var t,r,i,a,s;if(a=Zsb-e[2],s=$sb-e[5],0===(t=e[0]*e[4]-e[1]*e[3]))return Ysb.primitiveFail();t=1/t,r=a*e[4]-e[1]*s,i=e[0]*s-a*e[3],_sb=r*t,atb=i*t}function htb(e){_sb=Zsb*e[0]+$sb*e[1]+e[2],atb=Zsb*e[3]+$sb*e[4]+e[5]}function itb(e){return-1073741824<=e&&_sb<=1073741823}function jtb(e){var t,r,i,a,s,n,o,u,l,c,h,f,d;if(i=dtb(a=Ysb.stackObjectValue(0)),r=dtb(Ysb.stackObjectValue(1)),t=dtb(Ysb.stackObjectValue(2)),Ysb.failed())return null;n=r,o=i,u=(s=t)[0]*n[0]+s[1]*n[3],l=s[0]*n[1]+s[1]*n[4],c=s[0]*n[2]+s[1]*n[5]+s[2],h=s[3]*n[0]+s[4]*n[3],f=s[3]*n[1]+s[4]*n[4],d=s[3]*n[2]+s[4]*n[5]+s[5],o[0]=u,o[1]=l,o[2]=c,o[3]=h,o[4]=f,o[5]=d,Ysb.popthenPush(e+1,a)}function ktb(e){var t;if(etb(Ysb.stackObjectValue(0)),t=dtb(Ysb.stackObjectValue(1)),Ysb.failed())return null;gtb(t),Ysb.failed()||qtb(e)}function ltb(e){var t,r,i,a,s,n,o,u,l,c,h;return i=Ysb.stackObjectValue(0),h=Ysb.stackObjectValue(1),a=dtb(Ysb.stackObjectValue(2)),Ysb.failed()?null:Wsb(h)!==Wsb(i)||!Ysb.isPointers(h)||2!==Xsb(h)?Ysb.primitiveFail():(etb(Ysb.fetchPointerofObject(0,h)),Ysb.failed()?null:(l=Zsb,c=$sb,gtb(a),o=s=_sb,u=n=atb,etb(Ysb.fetchPointerofObject(1,h)),Ysb.failed()?null:(t=Zsb,r=$sb,gtb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),u=Math.min(u,atb),n=Math.max(n,atb),Zsb=t,$sb=c,gtb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),u=Math.min(u,atb),n=Math.max(n,atb),Zsb=l,$sb=r,gtb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),u=Math.min(u,atb),n=Math.max(n,atb),Ysb.failed()||(i=rtb(i,o,u,s,n)),void(Ysb.failed()||Ysb.popthenPush(e+1,i)))))}function mtb(e){var t;if(t=dtb(Ysb.stackObjectValue(0)),Ysb.failed())return null;Ysb.pop(1),Ysb.pushBool(1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&1===t[4]&&0===t[5])}function ntb(e){var t;if(t=dtb(Ysb.stackObjectValue(0)),Ysb.failed())return null;Ysb.pop(1),Ysb.pushBool(1===t[0]&&0===t[1]&&0===t[3]&&1===t[4])}function otb(e){var t;if(etb(Ysb.stackObjectValue(0)),t=dtb(Ysb.stackObjectValue(1)),Ysb.failed())return null;htb(t),qtb(e)}function ptb(e){var t,r,i,a,s,n,o,u,l,c,h;return i=Ysb.stackObjectValue(0),h=Ysb.stackObjectValue(1),a=dtb(Ysb.stackObjectValue(2)),Ysb.failed()?null:Wsb(h)!==Wsb(i)||!Ysb.isPointers(h)||2!==Xsb(h)?Ysb.primitiveFail():(etb(Ysb.fetchPointerofObject(0,h)),Ysb.failed()?null:(l=Zsb,c=$sb,htb(a),o=s=_sb,u=n=atb,etb(Ysb.fetchPointerofObject(1,h)),Ysb.failed()?null:(t=Zsb,r=$sb,htb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),u=Math.min(u,atb),n=Math.max(n,atb),Zsb=t,$sb=c,htb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),u=Math.min(u,atb),n=Math.max(n,atb),Zsb=l,$sb=r,htb(a),o=Math.min(o,_sb),s=Math.max(s,_sb),i=rtb(i,o,u=Math.min(u,atb),s,n=Math.max(n,atb)),void(Ysb.failed()||Ysb.popthenPush(e+1,i)))))}function qtb(e){return atb+=.5,itb(_sb+=.5)&&itb(atb)?void Ysb.popthenPush(e+1,Ysb.makePointwithxValueyValue(0|_sb,0|atb)):Ysb.primitiveFail()}function rtb(e,t,r,i,a){var s,n,o,u,l,c,h;return itb(u=t+.5)&&itb(n=i+.5)&&itb(l=r+.5)&&itb(o=a+.5)?(Ysb.pushRemappableOop(e),c=Ysb.makePointwithxValueyValue(0|u,0|l),Ysb.pushRemappableOop(c),s=Ysb.makePointwithxValueyValue(0|n,0|o),c=Ysb.popRemappableOop(),h=Ysb.popRemappableOop(),Ysb.storePointerofObjectwithValue(0,h,c),Ysb.storePointerofObjectwithValue(1,h,s),h):Ysb.primitiveFail()}function stb(e){return!1!=((Ysb=e).majorVersion()==Usb)&&Ysb.minorVersion()>=Vsb}function Tub(e,t){return e-(r=e,i=t,(0|Math.floor(r/i))*t)|0;var r,i}function Xub(e,t,r){var i,a,s;for(i=0;i<=3;i++)t[r+i-1]=255&(a=e,31<(s=8*(3-i))?0:a>>>s);return r+4}function Yub(e,t,r){return e<=223?(t[r-1]=e,r+1):e<=7935?(t[r-1]=224+(e>>8),t[r]=Tub(e,256),r+2):(t[r-1]=255,Xub(e,t,r+1))}function Zub(){return Wub}function $ub(e){var t,r,i,a,s,n,o,u;if(Vub.stackValue(3),t=Vub.stackBytes(2),r=Vub.stackBytes(1),i=Vub.stackBytes(0),Vub.failed())return null;for(o=t.length,u=r.length,n=1;n<=Math.min(o,u);n++)if((a=i[t[n-1]])!==(s=i[r[n-1]]))return a>>8&255)==(o=255&c)&&(c>>>16&255)==o&&(c>>>24&255)==o,s=n;s>>2))return Vub.primitiveFail(),null;if(1==(s=3&a))for(n=r[u-1],++u,n|=n<<8,n|=n<<16,l=1;l<=f;l++)t[c-1]=n,++c;if(2==s){for(n=0,l=1;l<=4;l++)n=n<<8|r[u-1],++u;for(l=1;l<=f;l++)t[c-1]=n,++c}if(3==s)for(h=1;h<=f;h++){for(n=0,l=1;l<=4;l++)n=n<<8|r[u-1],++u;t[c-1]=n,++c}}if(Vub.failed())return null;Vub.pop(e)}function cvb(e){var t,r,i,a,s;if(Vub.stackValue(3),t=Vub.stackBytes(2),r=Vub.stackBytes(1),i=Vub.stackIntegerValue(0),Vub.failed())return null;if(256!==r.length)return Vub.failed()||Vub.popthenPush(e+1,0),null;for(a=i,s=t.length;a<=s&&0===r[t[a-1]];)++a;return s>>14)+101*s&16383)&268435455;return Vub.failed()||Vub.popthenPush(e+1,a),null}function gvb(e){var t,r,i,a,s;if(Vub.stackValue(4),t=Vub.stackBytes(3),r=Vub.stackIntegerValue(2),i=Vub.stackIntegerValue(1),a=Vub.stackBytes(0),Vub.failed())return null;for(s=r;s<=i;s++)t[s-1]=a[t[s-1]];if(Vub.failed())return null;Vub.pop(e)}function hvb(e){return!1!=((Vub=e).majorVersion()==Qub)&&Vub.minorVersion()>=Rub}function axb(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function bxb(e,t){return 0|Math.floor(e/t)}function cxb(e,t){return e-bxb(e,t)*t|0}function fxb(e,t,r,i,a){var s,n,o,u,l,c,h;n=bxb(r,60),u=(1e3-i)*a,l=(1e3-bxb(i*(s=cxb(r,60)),60))*a,c=(1e3-bxb(i*(60-s),60))*a,h=bxb(1e3*a,3922),u=bxb(u,3922),l=bxb(l,3922),c=bxb(c,3922),0===n&&(o=(h<<16)+(c<<8)+u),1===n&&(o=(l<<16)+(h<<8)+u),2===n&&(o=(u<<16)+(h<<8)+c),3===n&&(o=(u<<16)+(l<<8)+h),4===n&&(o=(c<<16)+(u<<8)+h),5===n&&(o=(h<<16)+(u<<8)+l),0===o&&(o=1),e[t]=o}function gxb(e){return dxb.success(dxb.isWordsOrBytes(e)),dxb.failed()?0:e.wordsAsFloat64Array()}function hxb(e){return dxb.success(dxb.isWords(e)),dxb.failed()?0:e.words}function ixb(){return exb}function jxb(e,t,r,i,a){var s,n;return 0==(n=a-i)?0:(s=e===a?bxb(60*(t-r),n):t===a?120+bxb(60*(r-e),n):240+bxb(60*(e-t),n))<0?s+360:s}function kxb(e,t,r){var i,a;return 0===e?t:0===t?e:(0===(a=((i=1024-r)*(e>>>16&255)+r*(t>>>16&255)>>10<<16)+(i*(e>>>8&255)+r*(t>>>8&255)>>10<<8)+(i*(255&e)+r*(255&t)>>10))&&(a=1),a)}function lxb(e,t,r,i,a){var s,n,o,u,l,c,h;return(u=t>>>10)<-1||i<=u||(c=r>>>10)<-1||a<=c?0:(l=1023&t,-1===u&&(l=u=0),u===i-1&&(l=0),h=1023&r,-1===c&&(h=c=0),c===a-1&&(h=0),o=16777215&e[n=c*i+u],0>>16&255,i+=h>>>8&255,e+=255&h,++o);c=0===o?0:(bxb(f,o)<<16)+(bxb(i,o)<<8)+bxb(e,o),u[m*p+b]=c}return dxb.pop(3),0}function nxb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b;if(n=dxb.stackValue(2),c=dxb.stackValue(1),p=dxb.stackIntegerValue(0),s=hxb(n),b=axb(n),l=hxb(c),dxb.success(axb(c)===b),dxb.failed())return null;for(a=0;a<=b-1;a++)0!=(h=16777215&s[a])&&((o=u=f=h>>>16&255)<(r=h>>>8&255)&&(o=r),o<(e=255&h)&&(o=e),r=n>>1),dxb.failed())return null;for(a=s.wordsAsInt16Array(),e=t.wordsAsInt16Array(),i&&o++,r=1;r<=n;r++)e[u++]=a[o],o+=2;return dxb.pop(3),0}function rxb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k;if(o=dxb.stackValue(3),l=dxb.stackValue(2),v=dxb.stackIntegerValue(1),h=dxb.stackIntegerValue(0),n=hxb(o),u=hxb(l),m=axb(o),dxb.success(axb(l)===m),dxb.failed())return null;for(s=bxb(m,v),t=v>>1,r=(s=bxb(m,v))>>1,d=h/100,g=0;g<=v-1;g++)for(k=0;k<=s-1;k++)i=(g-t)/t,a=(k-r)/r,b=(f=Math.pow(Math.sqrt(i*i+a*a),d))<=1?(e=Math.atan2(a,i),p=1024*(t+f*Math.cos(e)*t)|0,1024*(r+f*Math.sin(e)*r)|0):(p=1024*g,1024*k),c=lxb(n,p,b,v,s),u[k*v+g]=c;return dxb.pop(4),0}function sxb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k;if(o=hxb(dxb.stackValue(11)),l=dxb.stackIntegerValue(10),u=dxb.stackIntegerValue(9),c=hxb(dxb.stackValue(8)),f=dxb.stackIntegerValue(7),h=dxb.stackIntegerValue(6),m=dxb.stackIntegerValue(5),v=dxb.stackIntegerValue(4),a=dxb.stackIntegerValue(3),s=dxb.stackIntegerValue(2),i=dxb.stackIntegerValue(1),t=dxb.stackIntegerValue(0),dxb.success(0<=m&&0<=v),dxb.success(m+2*i<=l),dxb.success(v+2*t<=u),dxb.success(0<=a&&0<=s),dxb.success(a+i<=f),dxb.success(s+t<=h),dxb.failed())return null;for(k=0;k<=t-1;k++)for(b=l*(v+2*k)+m,r=f*(s+k)+a,g=0;g<=i-1;g++)p=16711680&(d=o[b]),n=65280&d,e=255&d,p+=16711680&(d=o[b+1]),n+=65280&d,e+=255&d,p+=16711680&(d=o[b+l]),n+=65280&d,e+=255&d,p+=16711680&(d=o[b+l+1]),n+=65280&d,e+=255&d,c[r]=p>>>2&16711680|n>>>2&65280|e>>>2,b+=2,++r;return dxb.pop(12),0}function txb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_;if(o=hxb(dxb.stackValue(11)),l=dxb.stackIntegerValue(10),u=dxb.stackIntegerValue(9),c=hxb(dxb.stackValue(8)),f=dxb.stackIntegerValue(7),h=dxb.stackIntegerValue(6),v=dxb.stackIntegerValue(5),g=dxb.stackIntegerValue(4),a=dxb.stackIntegerValue(3),s=dxb.stackIntegerValue(2),i=dxb.stackIntegerValue(1),t=dxb.stackIntegerValue(0),dxb.success(0<=v&&0<=g),dxb.success(v+2*i<=l),dxb.success(g+2*t<=u),dxb.success(0<=a&&0<=s),dxb.success(a+i<=f),dxb.success(s+t<=h),dxb.failed())return null;for(_=0;_<=t-1;_++)for(m=l*(g+2*_)+v,r=f*(s+_)+a,k=0;k<=i-1;k++)b=(16711680&(d=o[m]))+(16711680&(p=o[m+l+1]))>>>1&16711680,n=(65280&d)+(65280&p)>>>1&65280,e=(255&d)+(255&p)>>>1,c[r]=n|e|b,m+=2,++r;return dxb.pop(12),0}function uxb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p;if(s=dxb.stackValue(2),l=dxb.stackValue(1),d=dxb.stackIntegerValue(0),a=hxb(s),p=axb(s),u=hxb(l),dxb.success(axb(l)===p),dxb.failed())return null;for(i=0;i<=p-1;i++)0!=(c=16777215&a[i])&&((n=o=h=c>>>16&255)<(r=c>>>8&255)&&(n=r),n<(e=255&c)&&(n=e),r>>16&255)<(r=c>>>8&255)&&(n=r),n<(e=255&c)&&(n=e),r>>10)*i+(a>>>10)],p=a>>>10>>10>>10>>16&255)+_*(p>>>16&255)+S*(b>>>16&255)+y*(m>>>16&255))>>>20&255)<<16,l|=((v=k*(d>>>8&255)+_*(p>>>8&255)+S*(b>>>8&255)+y*(m>>>8&255))>>>20&255)<<8,0===(l|=(v=k*(255&d)+_*(255&p)+S*(255&b)+y*(255&m))>>>20&255)&&(l=1)),n[f*c+h]=l,a+=I;s+=O}return dxb.pop(6),0}function yxb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S,y,I,O,w,F,C,x,A,P,$,V,Y;if(g=dxb.stackValue(5),y=dxb.stackValue(4),$=dxb.stackIntegerValue(3),v=hxb(g),S=hxb(y),r=axb(g),F=dxb.stackIntegerValue(2),e=dxb.stackValue(1),i=dxb.stackValue(0),t=gxb(e),a=gxb(i),dxb.success(axb(y)===r),dxb.failed())return null;for(b=bxb(r,$),s=cxb(Math.random(),F)-1,C=0;C<=s/2-1;C++)for(V=cxb(Math.random(),$),Y=cxb(Math.random(),b),O=cxb(Math.random(),8),d=-4;d<=4;d++)for(p=-4;p<=4;p++)(o=d*d+p*p)<25&&0>1)<(r=(l=bxb(_,y))>>1)?(v=r/(b=t),1):(v=1,(b=r)=_wb}function SocketPlugin(){return{getModuleName:function(){return"SocketPlugin (http-only)"},interpreterProxy:null,primHandler:null,handleCounter:0,needProxy:new Set,status:0,lookupCache:{localhost:{address:[127,0,0,1],validUntil:Number.MAX_SAFE_INTEGER}},lastLookup:null,lookupSemaIdx:0,TCP_Socket_Type:0,Resolver_Uninitialized:0,Resolver_Ready:1,Resolver_Busy:2,Resolver_Error:3,Socket_InvalidSocket:-1,Socket_Unconnected:0,Socket_WaitingForConnection:1,Socket_Connected:2,Socket_OtherEndClosed:3,Socket_ThisEndClosed:4,setInterpreter:function(e){return this.interpreterProxy=e,this.primHandler=this.interpreterProxy.vm.primHandler,!0},_signalSemaphore:function(e){e<=0||this.primHandler.signalSemaphoreWithIndex(e)},_signalLookupSemaphore:function(){this._signalSemaphore(this.lookupSemaIdx)},_getAddressFromLookupCache:function(e,t){if(e){if(e.match(/^\d+\.\d+\.\d+\.\d+$/)){var r=e.split(".").map(function(e){return+e});if(r.every(function(e){return e<=255}))return new Uint8Array(r)}var i=this.lookupCache[e];if(i&&(t||i.validUntil>=Date.now()))return new Uint8Array(i.address)}return null},_addAddressFromResponseToLookupCache:function(e){if(e&&0===e.Status&&e.Question&&e.Answer){var t=function(e,t){e[t]&&e[t].replace&&(e[t]=e[t].replace(/\.$/,""))},r=e.Question[0];t(r,"name"),e.Answer.forEach(function(e){t(e,"name"),t(e,"data")});var i=r.name,a=null,s=86400;e.Answer.some(function(e){if(e.name===i){if(e.TTL&&(s=Math.min(s,e.TTL)),1===e.type)return a=e.data.split(".").map(function(e){return+e}),!0;5===e.type&&(i=e.data)}return!1})&&(this.lookupCache[r.name]={address:a,validUntil:Date.now()+1e3*s})}},_compareAddresses:function(e,r){return e.every(function(e,t){return r[t]===e})},_reverseLookupNameForAddress:function(t){var r=this,i=null;return Object.keys(this.lookupCache).some(function(e){return!!r._compareAddresses(t,r.lookupCache[e].address)&&(i=e,!0)}),i||t.join(".")},_newSocketHandle:function(e,t,r,i){var c=this;return{hostAddress:null,host:null,port:null,connSemaIndex:t,readSemaIndex:r,writeSemaIndex:i,webSocket:null,sendBuffer:null,sendTimeout:null,response:null,responseReadUntil:0,responseReceived:!1,status:c.Socket_Unconnected,_signalConnSemaphore:function(){c._signalSemaphore(this.connSemaIndex)},_signalReadSemaphore:function(){c._signalSemaphore(this.readSemaIndex)},_signalWriteSemaphore:function(){c._signalSemaphore(this.writeSemaIndex)},_otherEndClosed:function(){this.status=c.Socket_OtherEndClosed,this.webSocket=null,this._signalConnSemaphore()},_hostAndPort:function(){return this.host+":"+this.port},_requestNeedsProxy:function(){return c.needProxy.has(this._hostAndPort())},_getURL:function(e,t){var r="";(t||this._requestNeedsProxy())&&(r="object"==typeof SqueakJS&&SqueakJS.options.proxy||"https://corsproxy.io/?");return 443!==this.port?r+="http://"+this._hostAndPort()+e:r+="https://"+this.host+e,r},_performRequest:function(){if(this.webSocket)this._performWebSocketSend();else{var e=new TextDecoder("utf-8").decode(this.sendBuffer),t=this.sendBuffer.findIndex(function(e,t,r){return"\r"===r[t]&&"\r"===r[t+2]&&"\n"===r[t+1]&&"\n"===r[t+3]});this.sendBuffer=0<=t?this.sendBuffer.subarray(t+4):null;var r=e.split("\r\n\r\n")[0].split("\n"),i=r[0].split(" "),a=i[0];if("GET"!==a&&"PUT"!==a&&"POST"!==a)return this._otherEndClosed(),-1;for(var s=i[1],n=!1,o=!1,u=null,l=1;l>>8,n[3]=255&e.length,4):127===i?(n[2]=e.length>>>56,n[3]=e.length>>>48&255,n[4]=e.length>>>40&255,n[5]=e.length>>>32&255,n[6]=e.length>>>24&255,n[7]=e.length>>>16&255,n[8]=e.length>>>8&255,n[9]=255&e.length,10):2;var o=new Uint8Array(4);n.set(o,s),s+=4;var u=e;n.set(u,s),e=n}this.response&&this.response.length?this.response.push(e):this.response=[e],this.responseReceived=!0,this._signalReadSemaphore()},_performWebSocketSend:function(){var e,t=15&this.sendBuffer[0];if(0==t)return console.error("No support for WebSocket frame continuation yet!"),!0;if(1==t)e=!1;else{if(2!=t)return 8==t?(this.webSocket.close(),void(this.webSocket=null)):9==t||10==t?void 0:void console.error("Unsupported WebSocket frame opcode "+t);e=!0}var r,i,a=this.sendBuffer[1],s=a>>>7,n=127&a;r=126===n?(n=this.sendBuffer[2]<<8|this.sendBuffer[3],4):127===n?(n=this.sendBuffer[2]<<56|this.sendBuffer[3]<<48|this.sendBuffer[4]<<40|this.sendBuffer[5]<<32|this.sendBuffer[6]<<24|this.sendBuffer[7]<<16|this.sendBuffer[8]<<8|this.sendBuffer[9],10):2,s&&(i=this.sendBuffer.subarray(r,r+4),r+=4);var o,u=this.sendBuffer.subarray(r,r+n);r+=n,s&&(u=u.map(function(e,t){return e^i[3&t]})),o=e?u:Squeak.bytesAsString(u),this.sendBuffer=this.sendBuffer.subarray(r),this.webSocket.send(o),0e){var r=t.subarray(e);r?this.response[0]=r:this.response.shift(),t=t.subarray(0,e)}else this.response.shift();return this.responseReceived&&0===this.response.length&&!this.webSocket&&(this.responseSentCompletly=!0),t},send:function(e,t,r){null!==this.sendTimeout&&self.clearTimeout(this.sendTimeout),this.lastSend=Date.now();var i=e.bytes.subarray(t,r);if(null===this.sendBuffer)this.sendBuffer=i.slice();else{var a=this.sendBuffer.byteLength+i.byteLength,s=new Uint8Array(a);s.set(this.sendBuffer,0),s.set(i,this.sendBuffer.byteLength),this.sendBuffer=s}return this.sendTimeout=self.setTimeout(this._performRequest.bind(this),50),i.byteLength}}},primitiveHasSocketAccess:function(e){return this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.trueObject()),!0},primitiveInitializeNetwork:function(e){return 1===e&&(this.lookupSemaIdx=this.interpreterProxy.stackIntegerValue(0),this.status=this.Resolver_Ready,this.interpreterProxy.pop(e),!0)},primitiveResolverNameLookupResult:function(e){if(0!==e)return!1;if(!this.lastLookup||!this.lastLookup.substr)return this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0;var t=this._getAddressFromLookupCache(this.lastLookup,!0);return this.interpreterProxy.popthenPush(e+1,t?this.primHandler.makeStByteArray(t):this.interpreterProxy.nilObject()),!0},primitiveResolverStartNameLookup:function(e){if(1!==e)return!1;var t=this.lastLookup=this.interpreterProxy.stackValue(0).bytesAsString();if(this._getAddressFromLookupCache(t,!1))this.status=this.Resolver_Ready,this._signalLookupSemaphore();else{var r="https://9.9.9.9:5053/dns-query?name="+encodeURIComponent(this.lastLookup)+"&type=A",i=!1;if(self.fetch){var a=this;self.fetch(r,{method:"GET",mode:"cors",credentials:"omit",cache:"no-store",referrer:"no-referrer",referrerPolicy:"no-referrer"}).then(function(e){return e.json()}).then(function(e){a._addAddressFromResponseToLookupCache(e)}).catch(function(e){console.error("Name lookup failed",e)}).then(function(){t===a.lastLookup&&(a.status=a.Resolver_Ready,a._signalLookupSemaphore())}),i=!0}else{a=this;var s=function(){t===a.lastLookup&&(a.status=a.Resolver_Ready,a._signalLookupSemaphore())},n=new XMLHttpRequest;n.open("GET",r,!0),n.timeout=2e3,n.responseType="json",n.onload=function(e){a._addAddressFromResponseToLookupCache(this.response),s()},n.onerror=function(){console.error("Name lookup failed",n.statusText),s()},n.send(),i=!0}i&&(this.status=this.Resolver_Busy,this._signalLookupSemaphore())}return this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0},primitiveResolverAddressLookupResult:function(e){if(0!==e)return!1;if(!this.lastLookup||!this.lastLookup.every)return this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0;var t=this._reverseLookupNameForAddress(this.lastLookup),r=this.primHandler.makeStString(t);return this.interpreterProxy.popthenPush(e+1,r),!0},primitiveResolverStartAddressLookup:function(e){return 1===e&&(this.lastLookup=this.interpreterProxy.stackBytes(0),this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),this.status=this.Resolver_Ready,this._signalLookupSemaphore(),!0)},primitiveResolverStatus:function(e){return 0===e&&(this.interpreterProxy.popthenPush(e+1,this.status),!0)},primitiveResolverAbortLookup:function(e){return 0===e&&(this.lastLookup=null,this.status=this.Resolver_Ready,this._signalLookupSemaphore(),this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0)},primitiveSocketRemoteAddress:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;return void 0!==t&&(this.interpreterProxy.popthenPush(e+1,t.hostAddress?this.primHandler.makeStByteArray(t.hostAddress):this.interpreterProxy.nilObject()),!0)},primitiveSocketRemotePort:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;return void 0!==t&&(this.interpreterProxy.popthenPush(e+1,t.port),!0)},primitiveSocketConnectionStatus:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;if(void 0===t)return!1;var r=t.status;return void 0===r&&(r=this.Socket_InvalidSocket),this.interpreterProxy.popthenPush(e+1,r),!0},primitiveSocketConnectToPort:function(e){if(3!==e)return!1;var t=this.interpreterProxy.stackObjectValue(2).handle;if(void 0===t)return!1;var r=this.interpreterProxy.stackBytes(1),i=this.interpreterProxy.stackIntegerValue(0);return t.connect(r,i),this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0},primitiveSocketCloseConnection:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;return void 0!==t&&(t.close(),this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0)},primitiveSocketCreate3Semaphores:function(e){if(7!==e)return!1;var t=this.interpreterProxy.stackIntegerValue(0),r=this.interpreterProxy.stackIntegerValue(1),i=this.interpreterProxy.stackIntegerValue(2),a=this.interpreterProxy.stackIntegerValue(3);if(this.interpreterProxy.stackIntegerValue(5)!==this.TCP_Socket_Type)return!1;var s="{SqueakJS Socket #"+ ++this.handleCounter+"}",n=this.primHandler.makeStString(s);return n.handle=this._newSocketHandle(a,i,r,t),this.interpreterProxy.popthenPush(e+1,n),!0},primitiveSocketDestroy:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;return void 0!==t&&(t.destroy(),this.interpreterProxy.popthenPush(e+1,t.status),!0)},primitiveSocketReceiveDataAvailable:function(e){if(1!==e)return!1;var t=this.interpreterProxy.stackObjectValue(0).handle;if(void 0===t)return!1;var r=this.interpreterProxy.falseObject();return t.dataAvailable()&&(r=this.interpreterProxy.trueObject()),this.interpreterProxy.popthenPush(e+1,r),!0},primitiveSocketReceiveDataBufCount:function(e){if(4!==e)return!1;var t=this.interpreterProxy.stackObjectValue(3).handle;if(void 0===t)return!1;var r=this.interpreterProxy.stackObjectValue(2),i=this.interpreterProxy.stackIntegerValue(1)-1,a=this.interpreterProxy.stackIntegerValue(0);if(i+a>r.bytes.length)return!1;var s=t.recv(a);return r.bytes.set(s,i),this.interpreterProxy.popthenPush(e+1,s.length),!0},primitiveSocketSendDataBufCount:function(e){if(4!==e)return!1;var t=this.interpreterProxy.stackObjectValue(3).handle;if(void 0===t)return!1;var r=this.interpreterProxy.stackObjectValue(2),i=this.interpreterProxy.stackIntegerValue(1)-1;if(i<0)return!1;var a=i+this.interpreterProxy.stackIntegerValue(0);if(a>r.length)return!1;var s=t.send(r,i,a);return this.interpreterProxy.popthenPush(e+1,s),!0},primitiveSocketSendDone:function(e){return 1===e&&(this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.trueObject()),!0)},primitiveSocketListenWithOrWithoutBacklog:function(e){return!(e<2)&&(this.interpreterProxy.popthenPush(e+1,this.interpreterProxy.nilObject()),!0)}}}function registerSocketPlugin(){"object"==typeof Squeak&&Squeak.registerExternalModule?Squeak.registerExternalModule("SocketPlugin",SocketPlugin()):self.setTimeout(registerSocketPlugin,100)}function SpeechPlugin(){return{getModuleName:function(){return"SpeechPlugin"},interpreterProxy:null,primHandler:null,voiceInput:null,semaphoreIndex:null,shouldListen:!1,recognition:null,synth:self.speechSynthesis,setInterpreter:function(e){return this.interpreterProxy=e,this.primHandler=this.interpreterProxy.vm.primHandler,!0},primitiveSpeak:function(e){var t,r;if(1===e)t=this.interpreterProxy.stackValue(0).bytesAsString();else{if(2!==e)return!1;t=this.interpreterProxy.stackValue(1).bytesAsString();var i=this.interpreterProxy.stackValue(0).bytesAsString();r=this.synth.getVoices().filter(function(e){return e.name===i})}var a=new SpeechSynthesisUtterance(t);return r&&0>15))&&(u=32767),u<-32767&&(u=-32767),t[o-1]=u,p[f-1]=u,32767<(u=t[++o-1]+(s>>15))&&(u=32767),u<-32767&&(u=-32767),t[o-1]=u,b[f-1]=u,f=WHb(f,d)+1}if(_Hb.failed())return null;_Hb.storeIntegerofObjectwithValue(11,e,f),_Hb.pop(3)}function dIb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S,y,I;if(e=_Hb.stackValue(5),t=_Hb.stackIntegerValue(4),r=_Hb.stackInt16Array(3),i=_Hb.stackIntegerValue(2),a=_Hb.stackIntegerValue(1),s=_Hb.stackIntegerValue(0),k=_Hb.fetchIntegerofObject(3,e),_=_Hb.fetchIntegerofObject(4,e),S=_Hb.fetchIntegerofObject(5,e),d=_Hb.fetchIntegerofObject(7,e),I=_Hb.fetchInt16ArrayofObject(8,e),y=_Hb.fetchIntegerofObject(9,e),b=_Hb.fetchIntegerofObject(10,e),m=_Hb.fetchIntegerofObject(11,e),p=_Hb.fetchIntegerofObject(14,e),v=_Hb.fetchIntegerofObject(15,e),g=_Hb.fetchIntegerofObject(16,e),_Hb.failed())return null;for(n=0!==p&&0!==g,u=i+t-1,f=i;f<=u;f++)h=k*I[b>>15]>>15,n?(l=p*I[v>>15],(v=WHb(v+g,y))<0&&(v+=y),(b=WHb(b+m+l,y))<0&&(b+=y)):b=WHb(b+m,y),0>15))&&(c=32767),c<-32767&&(c=-32767),r[o-1]=c),0>15))&&(c=32767),c<-32767&&(c=-32767),r[o-1]=c),0!==_&&(k+=_,(0<_&&S<=k||_<0&&k<=S)&&(k=S,_=0));if(d-=t,_Hb.failed())return null;_Hb.storeIntegerofObjectwithValue(3,e,k),_Hb.storeIntegerofObjectwithValue(4,e,_),_Hb.storeIntegerofObjectwithValue(7,e,d),_Hb.storeIntegerofObjectwithValue(10,e,b),_Hb.storeIntegerofObjectwithValue(15,e,v),_Hb.pop(5)}function eIb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S,y,I,O,w,F,C,x,A;if(e=_Hb.stackValue(5),t=_Hb.stackIntegerValue(4),r=_Hb.stackInt16Array(3),i=_Hb.stackIntegerValue(2),a=_Hb.stackIntegerValue(1),s=_Hb.stackIntegerValue(0),C=_Hb.fetchIntegerofObject(3,e),x=_Hb.fetchIntegerofObject(4,e),A=_Hb.fetchIntegerofObject(5,e),g=_Hb.fetchIntegerofObject(7,e),y=_Hb.fetchIntegerofObject(8,e),_=_Hb.fetchInt16ArrayofObject(10,e),I=_Hb.fetchInt16ArrayofObject(11,e),k=_Hb.fetchIntegerofObject(16,e),S=_Hb.fetchIntegerofObject(17,e),F=_Hb.fetchIntegerofObject(18,e),O=_Hb.fetchIntegerofObject(19,e),w=_Hb.fetchIntegerofObject(20,e),_Hb.failed())return null;for(l=_!==I,n=a*C>>15,o=s*C>>15,u=2*i-1,c=i+t-1,v=i;v<=c;v++){if(S<(m=(O+=w)>>9)&&y>9),(d=m+1)>k){if(k>9)}f=O&XHb,p=h=_[m-1]*(YHb-f)+_[d-1]*f>>9,l&&(p=I[m-1]*(YHb-f)+I[d-1]*f>>9),0>15))&&(b=32767),b<-32767&&(b=-32767),r[u-1]=b),++u,0>15))&&(b=32767),b<-32767&&(b=-32767),r[u-1]=b),++u,0!==x&&(C+=x,(0>15,o=s*C>>15)}if(g-=t,_Hb.failed())return null;_Hb.storeIntegerofObjectwithValue(3,e,C),_Hb.storeIntegerofObjectwithValue(4,e,x),_Hb.storeIntegerofObjectwithValue(7,e,g),_Hb.storeIntegerofObjectwithValue(19,e,O),_Hb.pop(5)}function fIb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S;if(e=_Hb.stackValue(5),t=_Hb.stackIntegerValue(4),r=_Hb.stackInt16Array(3),i=_Hb.stackIntegerValue(2),a=_Hb.stackIntegerValue(1),s=_Hb.stackIntegerValue(0),k=_Hb.fetchIntegerofObject(3,e),_=_Hb.fetchIntegerofObject(4,e),S=_Hb.fetchIntegerofObject(5,e),p=_Hb.fetchIntegerofObject(7,e),b=_Hb.fetchInt16ArrayofObject(8,e),m=_Hb.fetchIntegerofObject(9,e),v=_Hb.fetchIntegerofObject(10,e),g=_Hb.fetchIntegerofObject(11,e),_Hb.failed())return null;for(u=i+t-1,f=h=m,d=i;d<=u;d++)g<=(h=f+v)&&(h=ZHb+(h-g)),n=b[(f>>15)-1]+b[(h>>15)-1]>>1,c=(b[(f>>15)-1]=n)*k>>15,f=h,0>15))&&(l=32767),l<-32767&&(l=-32767),r[o-1]=l),0>15))&&(l=32767),l<-32767&&(l=-32767),r[o-1]=l),0!==_&&(k+=_,(0<_&&S<=k||_<0&&k<=S)&&(k=S,_=0));if(m=h,p-=t,_Hb.failed())return null;_Hb.storeIntegerofObjectwithValue(3,e,k),_Hb.storeIntegerofObjectwithValue(4,e,_),_Hb.storeIntegerofObjectwithValue(7,e,p),_Hb.storeIntegerofObjectwithValue(9,e,m),_Hb.pop(5)}function gIb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k,_,S;if(e=_Hb.stackValue(5),t=_Hb.stackIntegerValue(4),r=_Hb.stackInt16Array(3),i=_Hb.stackIntegerValue(2),a=_Hb.stackIntegerValue(1),s=_Hb.stackIntegerValue(0),k=_Hb.fetchIntegerofObject(3,e),_=_Hb.fetchIntegerofObject(4,e),S=_Hb.fetchIntegerofObject(5,e),d=_Hb.fetchIntegerofObject(7,e),b=_Hb.fetchInt16ArrayofObject(8,e),m=_Hb.fetchIntegerofObject(10,e),g=_Hb.fetchIntegerofObject(11,e),p=_Hb.fetchIntegerofObject(12,e),v=_Hb.fetchIntegerofObject(13,e),_Hb.failed())return null;for(o=i+t-1,u=i,f=p+(g>>>16);f<=m&&u<=o;)h=b[f-1]*k>>15,0>15))&&(c=32767),c<-32767&&(c=-32767),r[n-1]=c),0>15))&&(c=32767),c<-32767&&(c=-32767),r[n-1]=c),0!==_&&(k+=_,(0<_&&S<=k||_<0&&k<=S)&&(k=S,_=0)),$Hb<=(g+=v)&&(p+=l=g>>>16,g-=l<<16),f=p+(g>>>16),++u;if(d-=t,_Hb.failed())return null;_Hb.storeIntegerofObjectwithValue(3,e,k),_Hb.storeIntegerofObjectwithValue(4,e,_),_Hb.storeIntegerofObjectwithValue(7,e,d),_Hb.storeIntegerofObjectwithValue(11,e,g),_Hb.storeIntegerofObjectwithValue(12,e,p),_Hb.pop(5)}function hIb(e){return!1!=((_Hb=e).majorVersion()==THb)&&_Hb.minorVersion()>=UHb}function BKb(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function CKb(e,t){return 0|Math.floor(e/t)}function GKb(e){return EKb.success(EKb.isWords(e)),EKb.failed()?0:e.words}function HKb(){return FKb}function IKb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v;if(l=EKb.stackValue(4),i=EKb.stackValue(3),d=EKb.stackIntegerValue(2),n=EKb.stackIntegerValue(1),t=EKb.stackIntegerValue(0),u=GKb(l),r=GKb(i),EKb.success(BKb(l)===BKb(i)),EKb.success(BKb(l)===d*n),EKb.failed())return null;for(e=(2*t+1)*(2*t+1),m=0;m<=n-1;m++)for((h=m-t)<0&&(h=0),n<=(s=m+t)&&(s=n-1),p=0;p<=d-1;p++){for((c=p-t)<0&&(c=0),d<=(a=p+t)&&(a=d-1),f=0,v=h;v<=s;v++)for(o=v*d,b=c;b<=a;b++)f+=u[o+b];r[m*d+p]=CKb(f,e)}EKb.pop(5)}function JKb(){var e,t,r,i,a;if(r=EKb.stackValue(1),i=EKb.stackIntegerValue(0),t=GKb(r),a=BKb(r),EKb.failed())return null;for(e=0;e<=a-1;e++)t[e]=t[e]*i>>>10;EKb.pop(2)}function KKb(){var e,t,r,i,a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k;if(p=EKb.stackValue(6),r=EKb.stackValue(5),b=EKb.stackIntegerValue(4),i=EKb.stackIntegerValue(3),n=EKb.stackIntegerValue(2),u=EKb.stackIntegerValue(1),h=EKb.stackIntegerValue(0),f=GKb(p),e=GKb(r),EKb.success(BKb(r)===b*i),EKb.success(BKb(r)===BKb(p)*n*n),EKb.failed())return null;for((l=0)<(4&u)&&(l+=65536),0<(2&u)&&(l+=256),0<(1&u)&&++l,d=-1,v=0;v<=CKb(i,n)-1;v++)for(m=0;m<=CKb(b,n)-1;m++)for(g=f[++d],255<(a=(k=h)<0?k<-31?0:g>>>0-k:31=AKb}function LLb(e){return"number"==typeof e?bMb.classSmallInteger():e.sqClass}function MLb(e){return e.pointers?e.pointers.length:e.words?e.words.length:e.bytes?e.bytes.length:0}function NLb(e){return e.bytes?e.bytes.length:e.words?4*e.words.length:0}function PLb(e,t){return e-(r=e,i=t,(0|Math.floor(r/i))*t)|0;var r,i}function QLb(e,t){return 31>>7)],qMb[r]++,++DMb,++zMb===BMb||0==(4095&zMb)&&dNb()}function RMb(e,t,r,i,a){var s,n,o,u,l,c,h;if(h=t<<16|r,XLb<=t)return h;if(!(0<(o=e-(c=uMb[fNb(e+YLb-1)]))&&o>2t))return bMb.primitiveFail();for(hMb|=QLb(t,iMb),iMb+=e;8<=iMb&&FMb>>=8,iMb-=8}function XMb(){var e,t,r,i,a;return 3!==bMb.methodArgumentCount()?bMb.primitiveFail():(t=bMb.stackIntegerValue(0),e=bMb.stackIntegerValue(1),r=bMb.stackIntegerValue(2),i=bMb.stackObjectValue(3),bMb.failed()?null:function(e){var t;if(bMb.isPointers(e)&&15<=MLb(e)&&(t=bMb.fetchPointerofObject(0,e),bMb.isBytes(t))){if(0===eMb){if(!OMb(e))return;if(MLb(e)=BMb&&(rMb=t.words,t=bMb.fetchPointerofObject(eMb+7,e),bMb.isWords(t)&&MLb(t)===WLb&&(AMb=t.words,t=bMb.fetchPointerofObject(eMb+8,e),bMb.isWords(t)&&MLb(t)===VLb))))))return qMb=t.words,zMb=bMb.fetchIntegerofObject(eMb+9,e),DMb=bMb.fetchIntegerofObject(eMb+10,e),!bMb.failed()}}(i)?(a=function(e,t,r){var i,a,s,n,o,u,l,c,h;if(e>>16),h=65535&(l=RMb(s+1,n,o,t,r)),(c=l>>>16)<=n&&YLb<=n){for(i=QMb(n,s-o),u=1;u<=n-1;u++)TMb(++s);a=!1,++s}else i=PMb(kMb[s]),++s<=e&&!i&&(TMb(s),a=!0,o=h,n=c);if(i)return jMb=s,!0}return jMb=s,!1}(r,e,t),bMb.failed()||(bMb.storeIntegerofObjectwithValue(eMb+2,i,wMb),bMb.storeIntegerofObjectwithValue(eMb+3,i,jMb),bMb.storeIntegerofObjectwithValue(eMb+9,i,zMb),bMb.storeIntegerofObjectwithValue(eMb+10,i,DMb)),void(bMb.failed()||(bMb.pop(4),bMb.pushBool(a)))):bMb.primitiveFail())}function YMb(){var e,t,r,i,a,s;if(2!==bMb.methodArgumentCount())return bMb.primitiveFail();if(e=bMb.stackIntegerValue(0),i=bMb.stackObjectValue(1),bMb.failed())return null;if(!bMb.isWords(i))return bMb.primitiveFail();for(s=MLb(i),a=i.wordsAsInt32Array(),r=0;r<=s-1;r++)t=a[r],a[r]=e<=t?t-e:0;bMb.pop(2)}function ZMb(){var e,t;if(2!==bMb.methodArgumentCount())return bMb.primitiveFail();if(e=bMb.stackValue(0),!bMb.isWords(e))return bMb.primitiveFail();if(nMb=e.words,oMb=MLb(e),e=bMb.stackValue(1),!bMb.isWords(e))return bMb.primitiveFail();if(xMb=e.words,yMb=MLb(e),t=bMb.stackValue(2),!bMb.isPointers(t))return bMb.primitiveFail();if(0===dMb){if(!function(e){var t;for(t=LLb(e);!t.isNil&&13<=t.classInstSize();)t=t.superclass();return!t.isNil&&(dMb=t.classInstSize(),1)}(t))return bMb.primitiveFail();if(MLb(t)>>16)-1)&&(a+=iNb(r)),c=gNb(nMb,oMb),e=65535&c,0<(r=c>>>16)&&(e+=iNb(r)),s<=GMb+a)return hMb=o,iMb=n,JMb=u;for(l=(t=GMb)-e,i=1;i<=a;i++)kMb[t+i]=kMb[l+i];GMb+=a}}(),void(bMb.failed()||(bMb.storeIntegerofObjectwithValue(2,t,GMb+1),bMb.storeIntegerofObjectwithValue(dMb+0,t,KMb),bMb.storeIntegerofObjectwithValue(dMb+1,t,hMb),bMb.storeIntegerofObjectwithValue(dMb+2,t,iMb),bMb.storeIntegerofObjectwithValue(dMb+4,t,JMb+1),bMb.pop(2)))):bMb.primitiveFail()):bMb.primitiveFail()))}function $Mb(){var e,t,r,i,a,s,n,o;if(4!==bMb.methodArgumentCount())return bMb.primitiveFail();if(r=bMb.stackObjectValue(0),o=bMb.stackIntegerValue(1),n=bMb.stackIntegerValue(2),e=bMb.positive32BitValueOf(bMb.stackValue(3)),bMb.failed())return 0;if(!(bMb.isBytes(r)&&n<=o&&0>>16&65535,i=--n;i<=o;i++)a=PLb(a+t[i],65521),s=PLb(s+a,65521);e=(s<<16)+a,bMb.popthenPush(5,bMb.positive32BitIntegerFor(e))}function _Mb(){var e,t,r,i,a,s;if(4!==bMb.methodArgumentCount())return bMb.primitiveFail();if(t=bMb.stackObjectValue(0),s=bMb.stackIntegerValue(1),a=bMb.stackIntegerValue(2),r=bMb.positive32BitValueOf(bMb.stackValue(3)),bMb.failed())return 0;if(!(bMb.isBytes(t)&&a<=s&&0>>8;bMb.popthenPush(5,bMb.positive32BitIntegerFor(r))}function aNb(){var e,t,r,i,a,s;return 4!==bMb.methodArgumentCount()?bMb.primitiveFail():(t=bMb.stackObjectValue(0),i=bMb.stackObjectValue(1),e=bMb.stackObjectValue(2),r=bMb.stackObjectValue(3),a=bMb.stackObjectValue(4),bMb.failed()?null:function(e){var t;if(0===eMb){if(!OMb(e))return;if(MLb(e)=eMb+3&&(t=bMb.fetchPointerofObject(0,e),bMb.isBytes(t)?(kMb=t.bytes,lMb=NLb(t),FMb=bMb.fetchIntegerofObject(1,e),GMb=bMb.fetchIntegerofObject(2,e),hMb=bMb.fetchIntegerofObject(eMb+0,e),iMb=bMb.fetchIntegerofObject(eMb+1,e),!bMb.failed()):bMb.primitiveFail())}(a)&&bMb.isPointers(t)&&2<=MLb(t)&&bMb.isPointers(i)&&2<=MLb(i)&&bMb.isPointers(r)&&3<=MLb(r)&&bMb.isPointers(e)&&3<=MLb(e)?(s=function(e,t,r,i){var a,s,n,o,u,l,c,h,f,d,p,b,m,v,g,k;if(g=bMb.fetchPointerofObject(0,e),b=bMb.fetchIntegerofObject(1,e),p=bMb.fetchIntegerofObject(2,e),!(b<=p&&bMb.isBytes(g)&&p<=NLb(g)))return bMb.primitiveFail();if(f=g.bytes,g=bMb.fetchPointerofObject(0,t),!(bMb.isWords(g)&&p<=MLb(g)&&bMb.fetchIntegerofObject(1,t)===b&&bMb.fetchIntegerofObject(2,t)===p))return bMb.primitiveFail();if(n=g.words,g=bMb.fetchPointerofObject(0,r),!bMb.isWords(g))return bMb.primitiveFail();if(d=MLb(g),m=g.words,g=bMb.fetchPointerofObject(1,r),!bMb.isWords(g)||d!==MLb(g))return bMb.primitiveFail();if(v=g.words,g=bMb.fetchPointerofObject(0,i),!bMb.isWords(g))return bMb.primitiveFail();if(u=MLb(g),o=g.words,g=bMb.fetchPointerofObject(1,i),!bMb.isWords(g)||u!==MLb(g))return bMb.primitiveFail();l=g.words,WMb(0,0),k=0;for(;b>>7)])=KLb}function dNb(){var e;return zMb===BMb||0==(4095&zMb)&&(!(10*DMb<=zMb)&&(!((e=zMb-DMb)<=DMb)&&4*e<=DMb))}function fNb(e){return t=kMb[e],(wMb<<5^t)&SLb;var t}function gNb(e,t){var r,i,a,s;if(r=e[0]>>>24,_Lb>>24&255))return bMb.primitiveFail(),0}return 0}function iNb(e){for(var t,r,i,a;iMb>>a,iMb-=e,t}Object.extend||(Object.extend=function(e){for(var t=1;t>0)+t:[e,t]}}),Object.subclass("Squeak.Object","initialization",{initInstanceOf:function(e,t,r,i){this.sqClass=e,this.hash=r;var a=e.pointers[Squeak.Class_format],s=(a>>1&63)+(a>>10&192)-1;this._format=a>>7&15,this._format<8?6!=this._format?0>10&255;l=this.decodeWords(1+c,o,a);this.pointers=this.decodePointers(1+c,l,e),this.bytes=this.decodeBytes(u-(1+c),o,1+c,3&this._format)}else 8<=this._format?0>1:r[s]||42424242}return i},decodeWords:function(e,t,r){for(var i=new DataView(t.buffer,t.byteOffset),a=new Uint32Array(e),s=0;s>4]),r.push(t[15&this.bytes[a]]),i=256*i+this.bytes[a];var s=e?"-":"",n=9007199254740991");case"LargePositiveInteger":return this.bytesAsNumberString(!1);case"LargeNegativeInteger":return this.bytesAsNumberString(!0);case"Character":var r=this.pointers?this.pointers[0]:this.hash;return"$"+String.fromCharCode(r)+" ("+r.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 4>>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:63<++e?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,r){this.bytes&&(this._format|=3&-this.bytes.length);var i=t,a=this.snapshotSize(),s=(15&this._format)<<8|(4095&this.hash)<<17;switch(a.header){case 2:e.setUint32(t,a.body<<2|Squeak.HeaderTypeSizeAndClass),t+=4,e.setUint32(t,this.sqClass.oop|Squeak.HeaderTypeSizeAndClass),t+=4,e.setUint32(t,s|Squeak.HeaderTypeSizeAndClass),t+=4;break;case 1:e.setUint32(t,this.sqClass.oop|Squeak.HeaderTypeClass),t+=4,e.setUint32(t,s|a.body<<2|Squeak.HeaderTypeClass),t+=4;break;case 0:var n=r.compactClasses.indexOf(this.sqClass)+1;e.setUint32(t,s|n<<12|a.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>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 8<=e&&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=5;t<=6;t++){var r=this.pointers[t];if(r&&r.pointers)for(e=6;e<=7;e++){var i;if((i=r.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{var r=(e=e||this.className()).replace(/[^A-Za-z0-9]/g,"_");r="UndefinedObject"===r?"nil":"True"===r?"true_":"False"===r?"false_":(/^[AEIOU]/.test(r)?"an":"a")+r,(t=new Function("return function "+r+"() {};")()).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 511>19):e},methodClassForSuper:function(){return this.pointers[this.methodNumLits()].pointers[Squeak.Assn_value]},methodNeedsLargeFrame:function(){return 0<(131072&this.pointers[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)}}),Squeak.Object.subclass("Squeak.ObjectSpur","initialization",{initInstanceOf:function(e,t,r,i){this.sqClass=e,this.hash=r;var a=e.pointers[Squeak.Class_format],s=65535&a,n=a>>16&31;(this._format=n)<12?n<10?0>(n?3:1),f=32767&h,d=(c=n?this.decodeWords64(1+f,u,a):this.decodeWords(1+f,u,a),n?2*(1+f):1+f);this.pointers=this.decodePointers(1+f,c,e,s,n),this.bytes=this.decodeBytes(l-d,u,d,3&this._format),n&&(this.pointers[0]=2147483648&u[1]|h);break;default:throw Error("Unknown object format: "+this._format)}this.mark=!1},decodeWords64:function(e,t,r){for(var i=new Array(e),a=0;a>1:a.makeLargeFromSmall((o-(o>>>0))/4294967296>>>0,o>>>0):o>>1;else if(2==(3&o)){if(o<0||8589934591>>(a?3:2))}else a&&4==(7&o)?s[n]=this.decodeSmallFloat((o-(o>>>0))/4294967296>>>0,o>>>0,a):(s[n]=r[o]||42424242,s[n])}return s},decodeSmallFloat:function(e,t,r){var i=0,a=0,s=(8&t)<<28;return 0==(e|4294967280&t)?i=s:(i=939524096+(e>>>4)|s,a=t>>>4|(15&e)<<28),r.makeFloat(new Uint32Array([a,i]))},overhead64:function(e){var t=0,r=0,i=0;if(this._format<=5)t=-2&e.length;else if(24<=this._format){var a=1==(1&(t=1+(e[0]>>3&32767))),s=28<=this._format;a&&(t+=s?1:-1),i=e.length/2,r=e.length-t}else i=(r=e.length)/2;return{bytes:4*t,sizeHeader:255<=r&&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 r=e[t[this.oop][Squeak.Class_name]];if(r&&16<=r._format&&r._format<24){var i=t[r.oop],a=r.decodeBytes(i.length,i,0,7&r._format);return Squeak.bytesAsString(a)}return"Class"},renameFromImage:function(e,t,r){var i=r[this.sqClass];if(!i)return this;var a=i.instProto||i.classInstProto(i.classNameFromImage(e,t));if(!a)return this;var s=new a;return s.oop=this.oop,s.sqClass=this.sqClass,s._format=this._format,s.hash=this.hash,s}},"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=255<=e?2:0;return e+=1&e,(e+=2)<4&&(e=4),{header:t,body:e}},writeTo:function(e,t,r,i){var a=this.isFloat?2:this.words?this.words.length:this.pointers?this.pointers.length:0;this.bytes&&(a+=this.bytes.length+3>>>2,this._format|=3&-this.bytes.length);var s=t,n=this._format<<24|4194303&this.sqClass.hash,o=a<<24|4194303&this.hash;if(255<=a&&(e.setUint32(t,a,r),t+=4,o=255<<24|4194303&this.hash,e.setUint32(t,o,r),t+=4),e.setUint32(t,n,r),t+=4,e.setUint32(t,o,r),t+=4,this.isFloat)e.setFloat64(t,this.float,r),t+=8;else if(this.words)for(var u=0;u>16&31},classInstSize:function(){return 65535&this.pointers[Squeak.Class_format]},classInstIsBytes:function(){var e=this.classInstFormat();return 16<=e&&e<=23},classInstIsPointers:function(){return this.classInstFormat()<=6},classByteSizeOfInstance:function(e){var t=this.classInstFormat(),r=this.classInstSize();return r+=t<9?e:16<=t?(e+3)/4|0:12<=t?(e+1)/2|0:10<=t?e:2*e,r+=1&r,(r+=255<=r?4:2)<4&&(r=4),4*r}},"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()}}),Object.subclass("Squeak.Image","about",{about:function(){}},"initializing",{initialize:function(e){this.headRoom=1e8,this.totalMemory=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(a,t,r){console.log("squeak: reading "+this.name+" ("+a.byteLength+" bytes)"),this.startupTime=Date.now();for(var i=new DataView(a),s=!1,n=0,e=function(){var e=i.getUint32(n,s);return n+=4,e},o=e,u=4,l=function(e,t){if(t){for(var r=[];r.length>>24;255===Y&&(Y=$,$=e(),V=e());D=F+n-8-O;var M=4194303&$;U=4194303&V,z=l(Y,(R=$>>>24&31)<10&&0>>2,L=o(),T=o();break;case Squeak.HeaderTypeClass:L=T-Squeak.HeaderTypeClass,E=(T=o())>>>2&63;break;case Squeak.HeaderTypeShort:E=T>>>2&63,L=T>>>12&31;break;case Squeak.HeaderTypeFree:throw Error("Unexpected free block")}var R,Q,D=n-4-O,U=T>>>17&4095,z=l(--E,(R=T>>>8&15)<5);(Q=new Squeak.Object).initFromImage(D,L,R,U),L<32&&(Q.hash|=268435456),_&&(_.nextObject=Q),this.oldSpaceCount++,_=Q,y[v+D]=Q,I[D]=z}this.firstOldObject=y[v+4],this.lastOldObject=Q,this.lastOldObject.nextObject=null,this.oldSpaceBytes=m}this.totalMemory=this.oldSpaceBytes+this.headRoom,this.totalMemory=1e6*Math.ceil(this.totalMemory/1e6);var X=y[g],G=this.isSpur?this.spurClassTable(y,I,C,X):I[y[I[X.oop][Squeak.splOb_CompactClasses]].oop],H=null;for(Q=this.firstOldObject,_=null;Q;)_=H,H=Q.renameFromImage(y,I,G),_?_.nextObject=H:this.firstOldObject=H,y[v+Q.oop]=H,Q=Q.nextObject;this.lastOldObject=H,this.lastOldObject.nextObject=null;var Z=y[g],K=I[y[I[Z.oop][Squeak.splOb_CompactClasses]].oop],J=y[I[Z.oop][Squeak.splOb_ClassFloat]];this.isSpur&&(this.initImmediateClasses(y,I,Z),K=this.spurClassTable(y,I,C,Z),d=this.getCharacter.bind(this),this.initSpurOverrides());var ee=this.firstOldObject,te=0,re=function(){if(ee){for(var e=te+(this.oldSpaceCount/20|0);ee&&te=s.length)return 0;t=2147483652+4*n,s[n++]=e}else{if(a+e.totalBytes()>i.byteLength)return 0;t=a+4*(e.snapshotSize().header+1),a=e.writeTo(i,a,this),l.push(e)}u[e.oop]=t}return t}function h(){for(var e=this.firstOldObject;e;)e.mark=!1,e=e.nextObject;return this.weakObjects=null,!1}for(c=c.bind(this),h=h.bind(this),c(r);0>>2,p=a(),b=a();break;case Squeak.HeaderTypeClass:p=b-Squeak.HeaderTypeClass,d=(b=a())>>>2&63;break;case Squeak.HeaderTypeShort:d=b>>>2&63,p=b>>>12&31;break;case Squeak.HeaderTypeFree:throw Error("Unexpected free block")}var m=n,v=b>>>8&15,g=b>>>17&4095,k=r(--d,v),_=new Squeak.Object;_.initFromImage(m+c,p,v,g),u.nextObject=_,this.oldSpaceCount++,u=_,h[m]=_,f[m+c]=k}_.nextObject=l;for(var S=0;S>>3;var r=(e>>=3)<0;r&&(e=-e,0!==(t=-t)&&e--);var i=0===e?4:e<=255?5:e<=65535?6:e<=16777215?7:8,a=r?this.largeNegIntClass:this.largePosIntClass,s=new a.instProto;this.registerObjectSpur(s),this.hasNewInstances[a.oop]=!0,s.initInstanceOfLargeInt(a,i);for(var n=s.bytes,o=0;o<4;o++)n[o]=255&t,t>>=8;for(o=4;o>=8;return s},ensureClassesInTable:function(){for(var e=this.firstOldObject,t=1024;e;){var r=e.sqClass;if(0===r.hash&&this.enterIntoClassTable(r),r.hash>t&&(t=r.hash),this.classTable[r.hash]!==r)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,r,i){return e.setUint32(t,167772178,r),t+=4,e.setUint32(t,536870912,r),t+=4,t+=128},writeClassTable:function(e,t,r,i,a){e.setUint32(t,4104,r),t+=4,e.setUint32(t,4278190080,r),t+=4,e.setUint32(t,33554448,r),t+=4,e.setUint32(t,4278190080,r),t+=4;for(var s=0;s>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(n(this.formatVersion()),n(64),n(t+this.oldSpaceBytes+16),n(this.firstOldObject.addr()),n(o(this.specialObjectsArray)),this.savedHeaderWords.forEach(n),n(t+this.oldSpaceBytes+16);s<64;)n(0);var u=this.firstOldObject,l=0;for(s=u.writeTo(r,s,i,o),u=u.nextObject,l++,s=u.writeTo(r,s,i,o),u=u.nextObject,l++,s=u.writeTo(r,s,i,o),u=u.nextObject,l++,s=this.writeFreeLists(r,s,i,o),s=this.writeClassTable(r,s,i,o,e);u;)s=u.writeTo(r,s,i,o),u=u.nextObject,l++;if(n(1241513987),n(8388608),n(0),n(0),s!==r.byteLength)throw Error("wrong image size");if(l!==this.oldSpaceCount)throw Error("wrong object count");var c=Date.now()-a;return console.log("Wrote "+l+" objects in "+c+" ms, image size "+s+" bytes"),r.buffer},storeImageSegmentSpur:function(e,t,r){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}}),Object.subclass("Squeak.Interpreter","initialization",{initialize:function(e,t){console.log("squeak: initializing interpreter "+Squeak.vmVersion),this.Squeak=Squeak,this.image=e,(this.image.vm=this).primHandler=new Squeak.Primitives(this,t),this.loadImageState(),this.hackImage(),this.initVMState(),this.loadInitialContext(),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>wordSize",literal:{index:1,old:8,hack:4},enabled:!0},{method:"ReleaseBuilder class>>prepareEnvironment",bytecode:{pc:28,old:216,hack:135},enabled:("object"==typeof location?location.hash:"").includes("wizard=false")}].forEach(function(t){try{var e=t.enabled&&this.findMethod(t.method);if(e){var r=t.primitive,i=t.bytecode,a=t.literal,s=!0;r?e.pointers[0]|=r:i&&e.bytes[i.pc]===i.old?e.bytes[i.pc]=i.hack:i&&e.bytes[i.pc]===i.hack?s=!1:a&&e.pointers[a.index].pointers[1]===a.old?e.pointers[a.index].pointers[1]=a.hack:a&&e.pointers[a.index].pointers[1]===a.hack?s=!1:(s=!1,console.warn("Not hacking "+t.method)),s&&console.warn("Hacking "+t.method)}}catch(e){console.error("Failed to hack "+t.method+" with error "+e)}},this)}},"interpreting",{interpretOne:function(e){if(this.method.methodSignFlag())return this.interpretOneSistaWithExtensions(e,0,0);if(!this.method.compiled){var t,r,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 r=this.nextByte(),void this.send(this.method.methodGetSelector(31&r),r>>5,!1);case 132:return void this.doubleExtendedDoAnything(this.nextByte());case 133:return r=this.nextByte(),void this.send(this.method.methodGetSelector(31&r),r>>5,!0);case 134:return r=this.nextByte(),void this.send(this.method.methodGetSelector(63&r),r>>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 r=this.nextByte(),void this.push(this.homeContext.pointers[i.Context_tempFrameStart+this.nextByte()].pointers[r]);case 141:return r=this.nextByte(),void(this.homeContext.pointers[i.Context_tempFrameStart+this.nextByte()].pointers[r]=this.top());case 142:return r=this.nextByte(),void(this.homeContext.pointers[i.Context_tempFrameStart+this.nextByte()].pointers[r]=this.pop());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 r=this.nextByte(),this.pc+=256*((7&t)-4)+r,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 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,r){var i,a,s=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[s.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[s.Context_tempFrameStart+(7&i)]);case 72:case 73:case 74:case 75:return void this.push(this.homeContext.pointers[s.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==r?void this.push(this.exportThisContext()):void this.nono();case 83:return void this.push(this.top());case 84:case 85:case 86:case 87: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[s.BlockContext_caller]);case 94:return 0==t?void this.doReturn(this.pop(),this.activeContext.pointers[s.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 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[s.Context_tempFrameStart+(7&i)]=this.pop());case 216:return void this.pop();case 217:return void this.nono();case 218:case 219:case 220:case 221:case 222:case 223:return void this.nono();case 224:return a=this.nextByte(),void this.interpretOneSistaWithExtensions(e,(t<<8)+a,r);case 225:return a=this.nextByte(),void this.interpretOneSistaWithExtensions(e,t,(r<<8)+(a<128?a:a-256));case 226:return a=this.nextByte(),void this.push(this.receiver.pointers[a+(t<<8)]);case 227:return a=this.nextByte(),void this.push(this.method.methodGetLiteral(a+(t<<8)).pointers[s.Assn_value]);case 228:return a=this.nextByte(),void this.push(this.method.methodGetLiteral(a+(t<<8)));case 229:return a=this.nextByte(),void this.push(this.homeContext.pointers[s.Context_tempFrameStart+a]);case 230:return void this.nono();case 231:return void this.pushNewArray(this.nextByte());case 232:return a=this.nextByte(),void this.push(a+(r<<8));case 233:return a=this.nextByte(),void this.push(this.image.getCharacter(a+(r<<8)));case 234:return a=this.nextByte(),void this.send(this.method.methodGetSelector((a>>3)+(t<<5)),(7&a)+(r<<3),!1);case 235:a=this.nextByte();var n=this.method.methodGetSelector((a>>3)+(t<<5));return 64<=r?void this.sendSuperDirected(n,(7&a)+((63&r)<<3)):void this.send(n,(7&a)+(r<<3),!0);case 236:return void this.nono();case 237:var o=this.nextByte()+(r<<8);return this.pc+=o,void(o<0&&this.interruptCheckCounter--<=0&&this.checkForInterrupts());case 238:return void this.jumpIfTrue(this.nextByte()+(r<<8));case 239:return void this.jumpIfFalse(this.nextByte()+(r<<8));case 240:return this.receiver.dirty=!0,void(this.receiver.pointers[this.nextByte()+(t<<8)]=this.pop());case 241:return(u=this.method.methodGetLiteral(this.nextByte()+(t<<8))).dirty=!0,void(u.pointers[s.Assn_value]=this.pop());case 242:return void(this.homeContext.pointers[s.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 u;return(u=this.method.methodGetLiteral(this.nextByte()+(t<<8))).dirty=!0,void(u.pointers[s.Assn_value]=this.top());case 245:return void(this.homeContext.pointers[s.Context_tempFrameStart+this.nextByte()]=this.top());case 246:case 247:return void this.nono();case 248:return void this.callPrimBytecode(245);case 249:return void this.pushFullClosure(t);case 250:return void this.pushClosureCopyExtended(t,r);case 251:return a=this.nextByte(),void this.push(this.homeContext.pointers[s.Context_tempFrameStart+this.nextByte()].pointers[a]);case 252:return a=this.nextByte(),void(this.homeContext.pointers[s.Context_tempFrameStart+this.nextByte()].pointers[a]=this.top());case 253:return a=this.nextByte(),void(this.homeContext.pointers[s.Context_tempFrameStart+this.nextByte()].pointers[a]=this.pop());case 254:case 255:return void this.nono()}throw Error("not a bytecode: "+i)},interpret:function(e,t){if(this.frozen)return"frozen";for(this.isIdle=!1,this.breakOutOfInterpreter=!1,this.breakOutTick=this.primHandler.millisecondClockValue()+(e||500);!1===this.breakOutOfInterpreter;)this.method.compiled?this.method.compiled(this):this.interpretOne();if("function"==typeof this.breakOutOfInterpreter)return this.breakOutOfInterpreter(t);var r="break"==this.breakOutOfInterpreter?"break":this.isIdle?this.nextWakeupTick?Math.max(1,this.nextWakeupTick-this.primHandler.millisecondClockValue()):"sleep":0;return t&&t(r),r},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 r=function(){if(this.frozen=!1,!t)throw Error("no continue function");t(0)}.bind(this);return e&&self.setTimeout(function(){e(r)},0),r},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.nextWakeupTick&&(this.nextWakeupTick=0,(t=this.specialObjects[Squeak.splOb_TheTimerSemaphore]).isNil||this.primHandler.synchronousSignal(t));if(0=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 r=this.method.methodGetLiteral(t);r.dirty=!0,r.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 r=this.method.methodGetLiteral(t);r.dirty=!0,r.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 r=this.method.methodGetLiteral(t);r.dirty=!0,r.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=127>4,i=256*this.nextByte()+this.nextByte(),a=this.encodeSqueakPC(this.pc,this.method),s=this.newClosure(t,a,r);if(s.pointers[Squeak.Closure_outerContext]=this.activeContext,(this.reclaimableContextCount=0)>3&7)+8*this.div(e,16),n=i+(t<<8),o=this.encodeSqueakPC(this.pc,this.method),u=this.newClosure(a,o,s);if(u.pointers[Squeak.Closure_outerContext]=this.activeContext,(this.reclaimableContextCount=0)>6&1)?this.vm.nilObj:this.activeContext;var n=this.method.methodGetLiteral(a),o=this.newFullClosure(t,s,n);if(1==(i>>7&1))throw Error("on-stack receiver not yet supported");if(o.pointers[Squeak.ClosureFull_receiver]=this.receiver,(this.reclaimableContextCount=0)Squeak.Message_lookupClass&&(i.pointers[Squeak.Message_lookupClass]=r),i},primitivePerform:function(e){var t=this.stackValue(e-1),r=this.stackValue(e),i=e-1,a=this.sp-i,s=this.activeContext.pointers;this.arrayCopy(s,1+a,s,a,i),this.sp--;var n=this.findSelectorInClass(t,i,this.getClass(r));return this.executeNewMethod(r,n.method,n.argCount,n.primIndex,n.mClass,t),!0},primitivePerformWithArgs:function(e,t){var r=t?3:2,i=this.stackValue(r),a=this.stackValue(r-1),s=this.stackValue(r-2);if(s.sqClass!==this.specialObjects[Squeak.splOb_ClassArray])return!1;var n=t?this.top():this.getClass(i);if(t)for(var o=this.getClass(i);o!==n;)if((o=o.pointers[Squeak.Class_superclass]).isNil)return!1;var u=s.pointersSize(),l=this.sp-(r-1),c=this.activeContext.pointers;this.arrayCopy(s.pointers,0,c,l,u),this.sp+=u-e;var h=this.findSelectorInClass(a,u,n);return this.executeNewMethod(i,h.method,h.argCount,h.primIndex,h.mClass,a),!0},primitiveInvokeObjectAsMethod:function(e,t){for(var r=this.instantiateClass(this.specialObjects[Squeak.splOb_ClassArray],e),i=0;i=Squeak.MinSmallInt&&e<=Squeak.MaxSmallInt)return this.popNandPush(2,e),!0;if(-4294967295<=e&&e<=4294967295){var t=e<0,r=t?-e:e,i=t?Squeak.splOb_ClassLargeNegativeInteger:Squeak.splOb_ClassLargePositiveInteger,a=this.instantiateClass(this.specialObjects[i],4),s=a.bytes;return s[0]=255&r,s[1]=r>>8&255,s[2]=r>>16&255,s[3]=r>>24&255,this.popNandPush(2,a),!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 r=e/t|0;return r*t===e?r: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(31>t===e?r:Squeak.NonSmallInt}},"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,r,i){for(var a=t;a>"+t.bytesAsString():(i=i||this.activeContext.contextMethod(),this.allMethodsDo(function(e,t,r){if(t===i)return a=e.className()+">>"+r.bytesAsString()}),a||(e?"("+e.pointers[Squeak.Context_receiver]+")>>?":"?>>?"));var a},allInstancesOf:function(e,t){"string"==typeof e&&(e=this.globalNamed(e));for(var r=[],i=this.image.someInstanceOf(e);i;)t?t(i):r.push(i),i=this.image.nextInstanceAfter(i);return r},globalNamed:function(r){return this.allGlobalsDo(function(e,t){if(e.bytesAsString()===r)return t})},allGlobalsDo:function(e){for(var t=this.getGlobals(),r=0;rt+200&&(e.isNil||r.push("..."),r=r.slice(0,t).concat(["..."]).concat(r.slice(-200)));for(var a=[],s=r.length;0>")[0],s=e.split(">>")[1];return this.allMethodsDo(function(e,t,r){if(s.length==r.bytesSize()&&s==r.bytesAsString()&&a==e.className())return i=t}),i},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,r){if(!this.isContext(e))return"NOT A CONTEXT: "+t(e);function t(e){var t="number"==typeof e||"object"==typeof e?e.sqInstName():"<"+e+">";return(t=JSON.stringify(t).slice(1,-1)).length>r-3&&(t=t.slice(0,r-3)+"..."),t}r=r||72;for(var i="number"==typeof e.pointers[Squeak.BlockContext_argumentCount],a=e.pointers[Squeak.Context_closure],s=!i&&!a.isNil,n=i?e.pointers[Squeak.BlockContext_home]:e,o=s?a.pointers[Squeak.Closure_numArgs]:n.pointers[Squeak.Context_method].methodTempCount(),u=this.decodeSqueakSP(0),l=n.contextSizeWithStack(this)-1,c=u+1,h=c+o-1,f="",d=u;d<=l;d++){var p="";d==u?p="=rcvr":d<=h&&(p="=tmp"+(d-c)),f+="\nctx["+d+"]"+p+": "+t(n.pointers[d])}if(i){f+="\n";var b=e.pointers[Squeak.BlockContext_argumentCount],m=this.decodeSqueakSP(1),v=m+b,g=e===this.activeContext?this.sp:e.pointers[Squeak.Context_stackPointer];for(d=m;d<=g;d++){p="";d<=v&&(p="=arg"+(d-m)),f+="\nblk["+d+"]"+p+": "+t(e.pointers[d])}}return f},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],r="Active: "+this.printProcess(t,!0),i=e.pointers[Squeak.ProcSched_processLists].pointers,a=i.length-1;0<=a;a--)for(var s=i[a].pointers[Squeak.LinkedList_firstLink];!s.isNil;)r+="\nRunnable: "+this.printProcess(s),s=s.pointers[Squeak.Link_nextLink];for(var n=this.specialObjects[Squeak.splOb_ClassSemaphore],o=this.image.someInstanceOf(n);o;){for(s=o.pointers[Squeak.LinkedList_firstLink];!s.isNil;)r+="\nWaiting: "+this.printProcess(s),s=s.pointers[Squeak.Link_nextLink];o=this.image.nextInstanceAfter(o)}return r},printProcess:function(e,t){var r=e.pointers[Squeak.Proc_suspendedContext],i=e.pointers[Squeak.Proc_priority],a=this.printStack(t?null:r),s=this.printContext(r);return e.toString()+" at priority "+i+"\n"+a+s+"\n"},printByteCodes:function(e,t,r,i){return e=e||this.method,new Squeak.InstructionPrinter(e,this).printInstructions(t,r,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)r=this.specialSelectors[2*(e-96)];else if(128<=e&&e<=175)r=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(120<=e&&e<=125)return!0;if(e<131||200==e)return!1;if(176<=e)return!0;if(e<=134){var t;if(132===e){if(1>5)return!1;t=this.method.bytes[this.pc+2]}else t=this.method.bytes[this.pc+1]&(134===e?63:31);var r=this.method.methodGetLiteral(t);if("blockCopy:"!==r.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(208<=t)e=this.method.methodGetLiteral(15&t);else if(176<=t)e=this.specialSelectors[2*(t-176)];else if(t<=134){var r;if(132===t){if(1>5)return null;r=this.method.bytes[this.pc+2]}else r=this.method.bytes[this.pc+1]&(134===t?63:31);e=this.method.methodGetLiteral(r)}}if(e){var i=e.bytesAsString();if("blockCopy:"!==i)return i}}}),Object.subclass("Squeak.InterpreterProxy","initialization",{VM_PROXY_MAJOR:1,VM_PROXY_MINOR:11,initialize:function(t){this.vm=t,this.remappableOops=[],Object.defineProperty(this,"successFlag",{get:function(){return t.primHandler.success},set:function(e){t.primHandler.success=e}})},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&&-1073741824<=e&&e<=1073741823},isArray:function(e){return e.sqClass===this.vm.specialObjects[Squeak.splOb_ClassArray]},isMemberOf:function(e,t){var r=e.sqClass.pointers[Squeak.Class_name].bytes;if(t.length!==r.length)return!1;for(var i=0;i=e.pointers.length)return this.successFlag=!1;e.pointers[t]=r}},"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]},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,r,i,a){if(t>5,!0);if(6===e)return r.send(this.method.methodGetLiteral(63&i),i>>6,!1)}if(7===e)return r.doPop();if(8===e)return r.doDup();if(9===e)return r.pushActiveContext();i=this.method.bytes[this.pc++];if(10===e)return i<128?r.pushNewArray(i):r.popIntoNewArray(i-128);n=this.method.bytes[this.pc++];if(11===e)return r.callPrimitive(i+256*n);if(12===e)return r.pushRemoteTemp(i,n);if(13===e)return r.storeIntoRemoteTemp(i,n);if(14===e)return r.popIntoRemoteTemp(i,n);var o=this.method.bytes[this.pc++];return r.pushClosureCopy(i>>4,15&i,256*n+o)}}),Squeak.InstructionStream.subclass("Squeak.InstructionStreamSista","decoding",{interpretNextInstructionFor:function(e){return this.interpretNextInstructionExtFor(e,0,0)},interpretNextInstructionExtFor:function(e,t,r){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 a=this.method.bytes[this.pc++];switch(i){case 224:return this.interpretNextInstructionExtFor(e,(t<<8)+a,r);case 225:return this.interpretNextInstructionExtFor(e,t,(r<<8)+(a<128?a:a-256));case 226:return e.pushReceiverVariable(a+(t<<8));case 227:return e.pushLiteralVariable(this.method.methodGetLiteral(a+(t<<8)));case 228:return e.pushConstant(this.method.methodGetLiteral(a+(t<<8)));case 229:return e.pushTemporaryVariable(a);case 231:return a<128?e.pushNewArray(a):e.popIntoNewArray(a-128);case 232:return e.pushConstant(a+(r<<8));case 233:return e.pushConstant("$"+a+(r<<8));case 234:return e.send(this.method.methodGetSelector((a>>3)+(t<<5)),(7&a)+(r<<3),!1);case 235:var s=this.method.methodGetSelector((a>>3)+(t<<5));return 64<=r?e.sendSuperDirected(s):e.send(s,(7&a)+(r<<3),!0);case 237:return e.jump(a+(r<<8));case 238:return e.jumpIf(!0,a+(r<<8));case 239:return e.jumpIf(!1,a+(r<<8));case 240:return e.popIntoReceiverVariable(a+(t<<8));case 241:return e.popIntoLiteralVariable(this.method.methodGetLiteral(a+(t<<8)));case 242:return e.popIntoTemporaryVariable(a);case 243:return e.storeIntoReceiverVariable(a+(t<<8));case 244:return e.storeIntoLiteralVariable(this.method.methodGetLiteral(a+(t<<8)));case 245:return e.storeIntoTemporaryVariable(a)}var n=this.method.bytes[this.pc++];switch(i){case 248:return e.callPrimitive(a+(n<<8));case 249:var o=a+(t<<8),u=63&n,l=this.method.methodGetLiteral(o);return e.pushFullClosure(o,u,l.methodNumArgs());case 250:var c=(7&a)+8*this.mod(t,16),h=(u=(a>>3&7)+8*this.div(t,16),n+(r<<8));return e.pushClosureCopy(u,c,h);case 251:return e.pushRemoteTemp(a,n);case 252:return e.storeIntoRemoteTemp(a,n);case 253:return e.popIntoRemoteTemp(a,n)}throw Error("Unknown bytecode: "+i)}}),Object.subclass("Squeak.InstructionPrinter","initialization",{initialize:function(e,t){this.method=e,this.vm=t}},"printing",{printInstructions:function(e,t,r){this.indent=e,this.highlight=t,this.highlightPC=r,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;tthis.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())},blockReturnTop:function(){this.print("blockReturn")},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,r){this.print((r?"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,r){var i=this.scanner.pc,a=i+r;this.print("closure("+i+"-"+(a-1)+"): "+e+" copied, "+t+" args");for(var s=i;sthis.endPC&&(this.endPC=a)},pushFullClosure:function(e,t,r){this.print("pushFullClosure: (self literalAt: "+e+") numCopied: "+t+" numArgs: "+r)},callPrimitive:function(e){this.print("primitive: "+e)}}),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,r){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 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.vm.warnOnce("missing primitive: 20 (primitiveRemLargeIntegers)"),!1;case 21:return this.vm.warnOnce("missing primitive: 21 (primitiveAddLargeIntegers)"),!1;case 22:return this.vm.warnOnce("missing primitive: 22 (primitiveSubtractLargeIntegers)"),!1;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.vm.warnOnce("missing primitive: 29 (primitiveMultiplyLargeIntegers)"),!1;case 30:return this.vm.warnOnce("missing primitive: 30 (primitiveDivideLargeIntegers)"),!1;case 31:return this.vm.warnOnce("missing primitive: 31 (primitiveModLargeIntegers)"),!1;case 32:return this.vm.warnOnce("missing primitive: 32 (primitiveDivLargeIntegers)"),!1;case 33:return this.vm.warnOnce("missing primitive: 33 (primitiveQuoLargeIntegers)"),!1;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 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,r);case 118:return this.primitiveDoPrimitiveWithArgs(t);case 119:return this.vm.flushMethodCacheForSelector(this.vm.top());case 120:return this.primitiveCalloutToFFI(t,r);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):!1;case 179:if(this.oldPrims)return this.namedPrimitive("SoundGenerationPlugin","primSampledSoundmixSampleCountintostartingAtpan",t);break;case 180:return this.oldPrims?this.namedPrimitive("SoundGenerationPlugin","primitiveMixFMSound",t):!1;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):!1;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","primitiveSocketListenOnPort",t):(this.vm.warnOnce("missing primitive: 218 (tryNamedPrimitiveInForWithArgs"),!1);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);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);case 238:if(this.oldPrims)return this.namedPrimitive("SerialPlugin","primitiveSerialPortOpen",t);case 239:if(this.oldPrims)return this.namedPrimitive("SerialPlugin","primitiveSerialPortClose",t);break;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,r);case 578:return this.vm.warnOnce("missing primitive: 578 (primitiveSuspendAndBackupPC)"),!1}return console.error("primitive "+e+" not implemented yet"),!1},namedPrimitive:function(e,t,r){var i=""===e?this:this.loadedModules[e];void 0===i&&(i=this.loadModule(e),this.loadedModules[e]=i);var a=!1,s=this.vm.sp;if(i){this.interpreterProxy.argCount=r;var n=i[t];"function"==typeof n?a=i[t](r):"string"==typeof n?a=this[n](r):this.vm.warnOnce("missing primitive: "+e+"."+t)}else this.vm.warnOnce("missing module: "+e+" ("+t+")");return(!0===a||!1!==a&&this.success)&&this.vm.sp!==s-r&&!this.vm.frozen&&this.vm.warnOnce("stack unbalanced after primitive "+e+"."+t,"error"),!0===a||!1===a?a:this.success},doNamedPrimitive:function(e,t){if(t.pointersSize()<2)return!1;var r=t.pointers[1];if(4!==r.pointersSize())return!1;this.primMethod=t;var i=r.pointers[0].bytesAsString(),a=r.pointers[1].bytesAsString();return this.namedPrimitive(i,a,e)},fakePrimitive:function(e,t,r){return this.vm.warnOnce("faking primitive: "+e),void 0===t?this.vm.popN(r):this.vm.popNandPush(r+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 r=t.initialiseModule;return"function"==typeof r?t.initialiseModule():"string"==typeof r&&this[r](),this.interpreterProxy.failed()?(console.log("Module initialization failed: "+e),null):(console.log("Loaded module: "+e),t)},loadModuleDynamically:function(e){},patchModule:function(e,t){var r=this.patchModules[t];for(var i in r)e[i]=r[i]},unloadModule:function(e){var t=this.loadedModules[e];if(!e||!t||t===this)return null;delete this.loadedModules[e];var r=t.unloadModule;return"function"==typeof r?t.unloadModule(this):"string"==typeof r&&this[r](this),console.log("Unloaded module: "+e),t},loadFunctionFrom:function(e,t){var r=""===t?this:this.loadedModules[t];if(void 0===r&&(r=this.loadModule(t),this.loadedModules[t]=r),!r)return null;var i=r[e];return"function"==typeof i?i.bind(r):"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 r=Object.keys(this.builtinModules);return this.popNandPushIfOK(e+1,this.makeStObject(r[t]))},primitiveListLoadedModule:function(e){var t=this.stackInteger(0)-1;if(!this.success)return!1;var r=[];for(var i in this.loadedModules){var a=this.loadedModules[i];if(a){var s=a.getModuleName?a.getModuleName():i;r.push(s)}}return this.popNandPushIfOK(e+1,this.makeStObject(r[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(0<=e&&e<=Squeak.MaxSmallInt)return e;for(var t=this.vm.specialObjects[Squeak.splOb_ClassLargePositiveInteger],r=this.vm.instantiateClass(t,4),i=r.bytes,a=0;a<4;a++)i[a]=e>>>8*a&255;return r},pos53BitIntFor:function(e){if(e<=4294967295)return this.pos32BitIntFor(e);if(9007199254740991=Squeak.MinSmallInt&&e<=Squeak.MaxSmallInt)return e;for(var t=e<0,r=t?-e:e,i=t?Squeak.splOb_ClassLargeNegativeInteger:Squeak.splOb_ClassLargePositiveInteger,a=this.vm.instantiateClass(this.vm.specialObjects[i],4),s=a.bytes,n=0;n<4;n++)s[n]=r>>>8*n&255;return a},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 r=t.bytesSize();if(r<=7){for(var i=t.bytes,a=0,s=0,n=1;s>>20&2047;return 0===r&&(t.setFloat64(0,e*Math.pow(2,64)),r=(t.getUint32(0)>>>20&2047)-64),r-1022},ldexp:function(e,t){for(var r=Math.min(3,Math.ceil(Math.abs(t)/1023)),i=e,a=0;athis.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))}},"utils",{floatOrInt:function(e){return e.isFloat?e.float:"number"==typeof e?e:0},positive32BitValueOf:function(e){if("number"==typeof e)return 0<=e?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,r=0,i=0,a=1;i<4;i++,a*=256)r+=t[i]*a;return r},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 r=e.sqClass,i=this.vm.specialObjects[t];!r.isNil;){if(r===i)return!0;r=r.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 r=this.vm.specialObjects[Squeak.splOb_ClassCharacter];return(t=this.vm.instantiateClass(r,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],r=this.vm.instantiateClass(t,2);return r.float=e,r},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(4294967295i.size)return this.success=!1,a;if(r)return a.pointers[s-1];if(a.isPointers())return a.pointers[s-1+i.ivarOffset];if(a.isWords())return i.convertChars?this.charFromInt(1073741823&a.words[s-1]):this.pos32BitIntFor(a.words[s-1]);if(a.isBytes())return i.convertChars?this.charFromInt(255&a.bytes[s-1]):255&a.bytes[s-1];var o=4*a.pointersSize();return s-1-o<0?(this.success=!1,a):255&a.bytes[s-1-o]},objectAtPut:function(e,t,r){var i,a=this.stackNonInteger(2),s=this.stackPos32BitInt(1);if(!this.success)return a;if(e){if((i=this.atPutCache[a.hash&this.atCacheMask]).array!==a)return this.success=!1,a}else{if(a.isFloat){var n=this.stackPos32BitInt(0);if(!this.success||1!=s&&2!=s)this.success=!1;else{var o=a.floatData();o.setUint32(1==s?0:4,n,!1),a.float=o.getFloat64(0)}return this.vm.stackValue(0)}i=this.makeAtCacheInfo(this.atPutCache,this.vm.specialSelectors[34],a,t,r)}if(s<1||s>i.size)return this.success=!1,a;var u,l=this.vm.stackValue(0);if(r)return a.dirty=!0,a.pointers[s-1]=l;if(a.isPointers())return a.dirty=!0,a.pointers[s-1+i.ivarOffset]=l;if(a.isWords()){if(t){if(l.sqClass!==this.vm.specialObjects[Squeak.splOb_ClassCharacter])return this.success=!1,l;if("number"!=typeof(u=this.charToInt(l)))return this.success=!1,l}else u=this.stackPos32BitInt(0);return this.success&&(a.words[s-1]=u),l}if(t){if(l.sqClass!==this.vm.specialObjects[Squeak.splOb_ClassCharacter])return this.success=!1,l;if("number"!=typeof(u=this.charToInt(l)))return this.success=!1,l}else{if("number"!=typeof l)return this.success=!1,l;u=l}if(u<0||255this.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),r=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassArray],t.length);return r.pointers=t,r},identityHash:function(e){return e.hash},identityHashSpur:function(e){var t=e.hash;return 0=t.pointers.length)return!1;for(var i=t.pointers[Squeak.Context_stackPointer];i=a)return!1;this.vm.popN(2);for(var s=0;s=a.length)return!1;if(e<2)t=a[i];else{if((t=this.stackInteger(0))<-32768||32767=a.length)return!1;if(e<2)t=this.signed32BitIntegerFor(a[i]);else{if(t=this.stackSigned32BitInt(0),!this.success)return!1;a[i]=t}return this.popNandPushIfOK(e+1,t),!0},primitiveConstantFill:function(e){var t=this.stackNonInteger(1),r=this.stackPos32BitInt(0);if(!this.success||!t.isWordsOrBytes())return!1;var i=t.words||t.bytes;if(i){if(i===t.bytes&&255t)a=r[t];else{if(!(t<0&&i&&i.length>-t-1))return!1;a=i[-t-1]}}return this.vm.popNandPush(e+1,this.makeStObject(a)),!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 r=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassArray],t),i=0;i","<=",">=","=","~=","*","/","\\\\","@","bitShift:","//","bitAnd:","bitOr:","at:","at:put:","size","next","nextPut:","atEnd","==","class","blockCopy:","value","value:","do:","new","new:","x","y"],this.doitCounter=0}},"accessing",{compile:function(e,t,r){if(!e.methodSignFlag())if(void 0===e.compiled)e.compiled=!1;else{this.singleStep=!1,this.debug=this.comments;var i=t&&t.className(),a=r&&r.bytesAsString();e.compiled=this.generate(e,i,a)}},enableSingleStepping:function(i,a,s){if(!i.compiled||!i.compiled.canSingleStep){this.singleStep=!0,this.debug=!0,a||this.vm.allMethodsDo(function(e,t,r){if(t===i)return a=e,s=r,!0});var e=a&&a.className(),t=s&&s.bytesAsString(),r=a&&a.allInstVarNames();i.compiled=this.generate(i,e,t,r),i.compiled.canSingleStep=!0}return!0},functionNameFor:function(e,t){if(void 0===e||"?"===e)return"DOIT_"+ ++this.doitCounter;if(!/[^a-zA-Z0-9:_]/.test(t))return(e+"_"+t).replace(/[: ]/g,"_");var r=t.replace(/./g,function(e){return{"|":"OR","~":"NOT","<":"LT","=":"EQ",">":"GT","&":"AND","@":"AT","*":"TIMES","+":"PLUS","\\":"MOD","-":"MINUS",",":"COMMA","/":"DIV","?":"IF"}[e]||"OPERATOR"});return e.replace(/[ ]/,"_")+"__"+r+"__"}},"generating",{generate:function(e,t,r,i){for(this.method=e,this.pc=0,this.endPC=0,this.prevPC=0,this.source=[],this.sourceLabels={},this.needsLabel={},this.sourcePos={},this.needsVar={},this.needsBreak=!1,t&&r&&this.source.push("// ",t,">>",r,"\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.done=!1;!this.done;){var a=e.bytes[this.pc++],s=0;switch(248&a){case 0:case 8:this.generatePush("inst[",15&a,"]");break;case 16:case 24:this.generatePush("temp[",6+(15&a),"]");break;case 32:case 40:case 48:case 56:this.generatePush("lit[",1+(31&a),"]");break;case 64:case 72:case 80:case 88:this.generatePush("lit[",1+(31&a),"].pointers[1]");break;case 96:this.generatePopInto("inst[",7&a,"]");break;case 104:this.generatePopInto("temp[",6+(7&a),"]");break;case 112:switch(a){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(a){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")}break;case 128:case 136:this.generateExtended(a);break;case 144:this.generateJump(1+(7&a));break;case 152:this.generateJumpIf(!1,1+(7&a));break;case 160:s=e.bytes[this.pc++],this.generateJump(256*((7&a)-4)+s);break;case 168:s=e.bytes[this.pc++],this.generateJumpIf(a<172,256*(3&a)+s);break;case 176:case 184:this.generateNumericOp(a);break;case 192:case 200:this.generateQuickPrim(a);break;case 208:case 216:this.generateSend("lit[",1+(15&a),"]",0,!1);break;case 224:case 232:this.generateSend("lit[",1+(15&a),"]",1,!1);break;case 240:case 248:this.generateSend("lit[",1+(15&a),"]",2,!1)}}var n=this.functionNameFor(t,r);return 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(),new Function("'use strict';\nreturn function "+n+"(vm) {\n"+this.source.join("")+"}")()},generateExtended:function(e){var t,r;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]")}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]")}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++],r=this.method.bytes[this.pc++],t>>5){case 0:return void this.generateSend("lit[",1+r,"]",31&t,!1);case 1:return void this.generateSend("lit[",1+r,"]",31&t,!0);case 2:return void this.generatePush("inst[",r,"]");case 3:return void this.generatePush("lit[",1+r,"]");case 4:return void this.generatePush("lit[",1+r,"].pointers[1]");case 5:return void this.generateStoreInto("inst[",r,"]");case 6:return void this.generatePopInto("inst[",r,"]");case 7:return void this.generateStoreInto("lit[",1+r,"].pointers[1]")}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=127<(t=this.method.bytes[this.pc++]),a=127&t;return void this.generateClosureTemps(a,i);case 139:return t=this.method.bytes[this.pc++],r=this.method.bytes[this.pc++],void this.generateCallPrimitive(t+256*r);case 140:return t=this.method.bytes[this.pc++],r=this.method.bytes[this.pc++],void this.generatePush("temp[",6+r,"].pointers[",t,"]");case 141:return t=this.method.bytes[this.pc++],r=this.method.bytes[this.pc++],void this.generateStoreInto("temp[",6+r,"].pointers[",t,"]");case 142:return t=this.method.bytes[this.pc++],r=this.method.bytes[this.pc++],void this.generatePopInto("temp[",6+r,"].pointers[",t,"]");case 143:var s=15&(t=this.method.bytes[this.pc++]),n=t>>4,o=(r=this.method.bytes[this.pc++])<<8|this.method.bytes[this.pc++];return void this.generateClosureCopy(s,n,o)}},generatePush:function(e,t,r,i,a){this.debug&&this.generateDebugCode("push",e,t,r,i,a),this.generateLabel(),this.needsVar[e]=!0,this.needsVar.stack=!0,this.source.push("stack[++vm.sp] = ",e),void 0!==t&&(this.source.push(t,r),void 0!==i&&this.source.push(i,a)),this.source.push(";\n")},generateStoreInto:function(e,t,r,i,a){this.debug&&this.generateDebugCode("store into",e,t,r,i,a),this.generateLabel(),this.needsVar[e]=!0,this.needsVar.stack=!0,this.source.push(e),void 0!==t&&(this.source.push(t,r),void 0!==i&&this.source.push(i,a)),this.source.push(" = stack[vm.sp];\n"),this.generateDirty(e,t)},generatePopInto:function(e,t,r,i,a){this.debug&&this.generateDebugCode("pop into",e,t,r,i,a),this.generateLabel(),this.needsVar[e]=!0,this.needsVar.stack=!0,this.source.push(e),void 0!==t&&(this.source.push(t,r),void 0!==i&&this.source.push(i,a)),this.source.push(" = stack[vm.sp--];\n"),this.generateDirty(e,t)},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(){this.debug&&this.generateDebugCode("block return"),this.generateLabel(),this.needsVar.stack=!0,this.source.push("vm.pc = ",this.pc,"; vm.doReturn(stack[vm.sp--], context.pointers[0]); return;\n"),this.needsBreak=!1},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 r=this.pc+t;this.debug&&this.generateDebugCode("jump if "+e+" to "+r),this.generateLabel(),this.needsVar.stack=!0,this.source.push("var cond = stack[vm.sp--]; if (cond === vm.",e,"Obj) {vm.pc = ",r,"; "),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[r]=!0,r>this.endPC&&(this.endPC=r)},generateQuickPrim:function(e){switch(this.debug&&this.generateDebugCode("quick send #"+this.specialSelectors[16+(15&e)]),this.generateLabel(),e){case 192: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 193: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 194: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 198: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 199: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 200: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 201:case 202:case 203: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,e){case 176: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 177: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 178: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 179: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 180: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 181: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 182: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 183: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 184: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 185: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 186: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 187:return void this.source.push("vm.success = true; if(!vm.primHandler.primitiveMakePoint(1, true)) { vm.pc = ",this.pc,"; vm.sendSpecial(11); return}\n");case 188: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 189: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 190: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 191: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,r,i,a){this.debug&&this.generateDebugCode("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,"; vm.send(",e,t,r,", ",i,", ",a,"); ","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 r=0;rthis.endPC&&(this.endPC=a)},generateCallPrimitive:function(e){this.debug&&this.generateDebugCode("call primitive "+e),this.generateLabel(),129===this.method.bytes[this.pc]&&(this.needsVar.stack=!0,this.source.push("if (vm.primFailCode) {stack[vm.sp] = vm.getErrorObjectFromPrimFailCode(); vm.primFailCode = 0;}\n"))},generateDirty:function(e,t){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[":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,r,i,a,s){this.needsBreak&&(this.source.push("if (vm.breakOutOfInterpreter) {vm.pc = ",this.prevPC,"; return}\n"),this.needsLabel[this.prevPC]=!0);for(var n=[],o=this.prevPC;o ",e),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[r]):this.source.push("inst var ",r);break;case"temp[":this.source.push("tmp",r-6),"]"!==i&&this.source.push("[",a,"]");break;case"lit[":var u=this.method.pointers[r];"]"===i?this.source.push(u):this.source.push(u.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 r=0;r<3;r++)this.source[this.sourceLabels[t]+r]="";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>u|(a&n)>>u+1,n>>>=1;r[i]=o}return{obj:e.obj,bits:r,depth:2,width:16,height:16,offsetX:e.offsetX,offsetY:e.offsetY,msb:!0,pixPerWord:16,pitch:1}},primitiveBeDisplay:function(e){var t=this.vm.stackValue(0);return this.vm.specialObjects[Squeak.splOb_TheDisplay]=t,this.vm.popN(e),!0},primitiveReverseDisplay:function(e){if(this.reverseDisplay=!this.reverseDisplay,this.redrawDisplay(),this.display.cursorCanvas){for(var t=this.display.cursorCanvas,r=t.getContext("2d"),i=r.getImageData(0,0,t.width,t.height),a=new Uint32Array(i.data.buffer),s=0;sr.left&&(r.left=e.left),e.rightr.top&&(r.top=e.top),e.bottom>16)+((255&O)<<16);h[f]=d}this.swappedColors=h}this.reverseDisplay&&(h=i?i.map(function(e){return 16777215^e}):(this.reversedColors||(this.reversedColors=h.map(function(e){return 16777215^e})),this.reversedColors));for(var p=(1<>>g&p],(g-=t.depth)<0&&(g=32-t.depth,k=t.bits[++v]);s++}break;case 16:for(b=a%2?0:16,m=0;m>>g;c[_++]=((31744&y)>>7)+((992&y)<<6)+((31&y)<<19)+4278190080,(g-=16)<0&&(g=16,k=t.bits[++v])}s++}break;case 32:var I=i?0:4278190080;for(m=0;m>16|(255&O)<<16|I;c[_++]=d}s++}break;default:throw Error("depth not implemented")}u.data!==l&&u.data.set(l),e.putImageData(u,r.left,r.top)}},primitiveDeferDisplayUpdates:function(e){var t=this.stackBoolean(0);return!!this.success&&(this.deferDisplayUpdates=t,this.vm.popN(e),!0)},primitiveForceDisplayUpdate:function(e){return this.vm.breakOut(),this.vm.popN(e),!0},primitiveScanCharacters:function(e){if(6!==e)return!1;var t=this.stackInteger(0),r=this.stackNonInteger(1),i=this.stackInteger(2),a=this.stackNonInteger(3),s=this.stackInteger(4),n=this.stackInteger(5);if(!this.success)return!1;if(r.pointersSize()<258||!a.isBytes())return!1;if(!(0r.pitch*r.height))return null;this.vm.warnOnce("loadForm(): "+r.bits.length+" !== "+r.pitch+"*"+r.height+"="+r.pitch*r.height)}return r},theDisplay:function(){return this.loadForm(this.vm.specialObjects[Squeak.splOb_TheDisplay])},displayDirty:function(e,t){this.deferDisplayUpdates||e!=this.vm.specialObjects[Squeak.splOb_TheDisplay]||this.displayUpdate(this.theDisplay(),t)},displayUpdate:function(e,t){this.showForm(this.display.context,e,t),this.display.lastTick=this.vm.lastTick,this.display.idle=0},primitiveBeep:function(e){var t=Squeak.startAudioOut();if(t){var r=t.createOscillator();r.connect(t.destination),r.type="square",r.frequency.value=880,r.start(),r.stop(t.currentTime+.05)}else this.vm.warnOnce("could not initialize audio");return this.popNIfOK(e)}}),Object.extend(Squeak,"files",{fsck:function(r,i,a,s){if(i=i||"",s=s||{dirs:0,files:0,bytes:0,deleted:0},!a&&(a={},Object.keys(Squeak.Settings).forEach(function(e){var t=e.match(/squeak-file(\.lz)?:(.*)$/);t&&(a[t[2]]=!0)}),window.SqueakDBFake&&Object.keys(SqueakDBFake.bigFiles).forEach(function(e){a[e]=!0}),"undefined"!=typeof indexedDB))return this.dbTransaction("readonly","fsck cursor",function(e){var t=e.openCursor();t.onsuccess=function(e){var t=e.target.result;t?(a[t.key]=!0,t.continue()):Squeak.fsck(r,i,a,s)},t.onerror=function(e){console.error("fsck failed")}});var e=Squeak.dirList(i);for(var t in e){var n=i+"/"+t;if(e[t][3])"squeak:"+n in Squeak.Settings?(Squeak.fsck(null,n,a,s),s.dirs++):(console.log("Deleting stale directory "+n),Squeak.dirDelete(n),s.deleted++);else a[n]?(a[n]=!1,s.files++,s.bytes+=e[t][4]):(console.log("Deleting stale file entry "+n),Squeak.fileDelete(n,!0),s.deleted++)}if(""===i){console.log("squeak fsck: "+s.dirs+" directories, "+s.files+" files, "+(s.bytes/1e6).toFixed(1)+" MBytes");var o=[];for(var n in a)a[n]&&o.push(n);if(0SqueakDBFake.bigFileThreshold)SqueakDBFake.bigFiles[t]||console.log("File "+t+" ("+e.byteLength+" bytes) too large, storing in memory only"),SqueakDBFake.bigFiles[t]=e;else{var r=Squeak.bytesAsString(new Uint8Array(e));if("object"==typeof LZString){var i=LZString.compressToUTF16(r);Squeak.Settings["squeak-file.lz:"+t]=i,delete Squeak.Settings["squeak-file:"+t]}else Squeak.Settings["squeak-file:"+t]=r}var a={};return setTimeout(function(){a.onsuccess&&a.onsuccess()},0),a},delete:function(e){delete Squeak.Settings["squeak-file:"+e],delete Squeak.Settings["squeak-file.lz:"+e],delete SqueakDBFake.bigFiles[e];var t={};return setTimeout(function(){t.onsuccess&&t.onsuccess()},0),t},openCursor:function(){var e={};return setTimeout(function(){e.onsuccess&&e.onsuccess({target:e})},0),e}}),SqueakDBFake},fileGet:function(e,r,i){i=i||function(e){console.log(e)};var a=this.splitFilePath(e);if(!a.basename)return i("Invalid path: "+e);if(Squeak.debugFiles){console.log("Reading "+a.fullname);var t=r;r=function(e){console.log("Read "+e.byteLength+" bytes from "+a.fullname),t(e)}}if(window.SqueakDBFake&&SqueakDBFake.bigFiles[a.fullname])return r(SqueakDBFake.bigFiles[a.fullname]);this.dbTransaction("readonly","get "+e,function(e){var t=e.get(a.fullname);t.onerror=function(e){i(e.target.error.name)},t.onsuccess=function(e){if(void 0!==this.result)return r(this.result);Squeak.fetchTemplateFile(a.fullname,function(e){r(e)},function(){if("undefined"==typeof indexedDB)return i("file not found: "+a.fullname);var e=Squeak.dbFake().get(a.fullname);e.onerror=function(e){i("file not found: "+a.fullname)},e.onsuccess=function(e){r(this.result)}})}})},filePut:function(e,t,r){var i=this.splitFilePath(e);if(!i.basename)return null;var a=this.dirList(i.dirname);if(!a)return null;var s=a[i.basename],n=this.totalSeconds();if(s){if(s[3])return null}else s=[i.basename,n,0,!1,0],a[i.basename]=s;return Squeak.debugFiles&&(console.log("Writing "+i.fullname+" ("+t.byteLength+" bytes)"),0>Squeak.FFIAtomicTypeShift){case Squeak.FFITypeVoid:return null;case Squeak.FFITypeBool:return!e.isFalse;case Squeak.FFITypeUnsignedInt8:case Squeak.FFITypeSignedInt8:case Squeak.FFITypeUnsignedInt16:case Squeak.FFITypeSignedInt16:case Squeak.FFITypeUnsignedInt32:case Squeak.FFITypeSignedInt32:case Squeak.FFITypeUnsignedInt64:case Squeak.FFITypeSignedInt64:case Squeak.FFITypeUnsignedChar8:case Squeak.FFITypeSignedChar8:case Squeak.FFITypeUnsignedChar16:case Squeak.FFITypeUnsignedChar32:if("number"==typeof e)return e;throw Error("FFI: expected integer, got "+e);case Squeak.FFITypeSingleFloat:case Squeak.FFITypeDoubleFloat:return"number"==typeof e?e:(e.isFloat,e.float);default:throw Error("FFI: unimplemented atomic arg type: "+i)}case Squeak.FFIFlagAtomicPointer:var i;switch(i=(r&Squeak.FFIAtomicTypeMask)>>Squeak.FFIAtomicTypeShift){case Squeak.FFITypeUnsignedChar8:if(e.bytes)return e.bytesAsString();throw Error("FFI: expected string, got "+e);case Squeak.FFITypeUnsignedInt8:if(e.bytes)return e.bytes;if(e.words)return e.wordsAsUint8Array();throw Error("FFI: expected bytes, got "+e);case Squeak.FFITypeUnsignedInt32:if(e.words)return e.words;throw Error("FFI: expected words, got "+e);case Squeak.FFITypeSignedInt32:if(e.words)return e.wordsAsInt32Array();throw Error("FFI: expected words, got "+e);case Squeak.FFITypeSingleFloat:if(e.words)return e.wordsAsFloat32Array();if(e.isFloat)return new Float32Array([e.float]);throw Error("FFI: expected floats, got "+e);case Squeak.FFITypeVoid:if(e.words)return e.words.buffer;if(e.bytes)return e.bytes.buffer;throw Error("FFI: expected words or bytes, got "+e);default:throw Error("FFI: unimplemented atomic array arg type: "+i)}default:throw Error("FFI: unimplemented arg type flags: "+r)}},ffiResultToSt:function(e,t){var r=t.pointers[0].words[0];switch(r&Squeak.FFIFlagMask){case Squeak.FFIFlagAtomic:switch(i=(r&Squeak.FFIAtomicTypeMask)>>Squeak.FFIAtomicTypeShift){case Squeak.FFITypeVoid:return this.vm.nilObj;case Squeak.FFITypeBool:return e?this.vm.trueObj:this.vm.falseObj;case Squeak.FFITypeUnsignedInt8:case Squeak.FFITypeSignedInt8:case Squeak.FFITypeUnsignedInt16:case Squeak.FFITypeSignedInt16:case Squeak.FFITypeUnsignedInt32:case Squeak.FFITypeSignedInt32:case Squeak.FFITypeUnsignedInt64:case Squeak.FFITypeSignedInt64:case Squeak.FFITypeUnsignedChar8:case Squeak.FFITypeSignedChar8:case Squeak.FFITypeUnsignedChar16:case Squeak.FFITypeUnsignedChar32:case Squeak.FFITypeSingleFloat:case Squeak.FFITypeDoubleFloat:if("number"!=typeof e)throw Error("FFI: expected number, got "+e);return this.makeStObject(e);default:throw Error("FFI: unimplemented atomic return type: "+i)}case Squeak.FFIFlagAtomicPointer:var i;switch(i=(r&Squeak.FFIAtomicTypeMask)>>Squeak.FFIAtomicTypeShift){case Squeak.FFITypeSignedChar8:case Squeak.FFITypeUnsignedChar8:return this.makeStString(e);default:return this.makeStExternalData(e,t)}default:throw Error("FFI: unimplemented return type flags: "+r)}},makeStExternalData:function(e,t){var r=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassExternalAddress],4);r.jsData=e;var i=this.vm.instantiateClass(this.vm.specialObjects[Squeak.splOb_ClassExternalData],0);return i.pointers[0]=r,i.pointers[1]=t,i},primitiveCalloutToFFI:function(e,t){var r=t.pointers[1];if(!this.isKindOf(r,Squeak.splOb_ClassExternalFunction))return!1;for(var i=[],a=e-1;0<=a;a--)i.push(this.vm.stackValue(a));return this.calloutToFFI(e,r,i)},ffi_primitiveCalloutWithArgs:function(e){var t=this.stackNonInteger(1),r=this.stackNonInteger(0);return!!this.isKindOf(t,Squeak.splOb_ClassExternalFunction)&&this.calloutToFFI(e,t,r.pointers)},ffi_primitiveFFIGetLastError:function(e){return this.popNandPushIfOK(e+1,this.ffi_lastError)},ffi_primitiveFFIIntegerAt:function(e){var t=this.stackNonInteger(3),r=this.stackInteger(2),i=this.stackInteger(1),a=this.stackBoolean(0);if(!this.success)return!1;if(r<0||i<1||8=t.file.size)),!0)},primitiveFileClose:function(e){var t=this.stackNonInteger(0);return!(!this.success||!t.file)&&("string"==typeof t.file?this.fileConsoleFlush(t.file):(this.fileClose(t.file),this.vm.breakOut(),t.file=null),this.popNIfOK(e))},primitiveFileDelete:function(e){var t=this.stackNonInteger(0);if(!this.success)return!1;var r=this.filenameFromSqueak(t.bytesAsString());return this.success=Squeak.fileDelete(r),this.popNIfOK(e)},primitiveFileFlush:function(e){var t=this.stackNonInteger(0);return!(!this.success||!t.file)&&("string"==typeof t.file?this.fileConsoleFlush(t.file):(Squeak.flushFile(t.file),this.vm.breakOut()),this.popNIfOK(e))},primitiveFileGetPosition:function(e){var t=this.stackNonInteger(0);return!(!this.success||!t.file)&&(this.popNandPushIfOK(e+1,this.makeLargeIfNeeded(t.filePos)),!0)},makeFileHandle:function(e,t,r){var i=this.makeStString("squeakjs:"+e);return i.file=t,i.fileWrite=r,i.filePos=0,i},primitiveFileOpen:function(e){var t=this.stackBoolean(0),r=this.stackNonInteger(1);if(!this.success)return!1;var i=this.filenameFromSqueak(r.bytesAsString()),a=this.fileOpen(i,t);if(!a)return!1;var s=this.makeFileHandle(a.name,a,t);return this.popNandPushIfOK(e+1,s),!0},primitiveFileRead:function(a){var s=this.stackInteger(0),n=this.stackInteger(1)-1,e=this.stackNonInteger(2),o=this.stackNonInteger(3);if(!this.success||!e.isWordsOrBytes()||!o.file)return!1;if(!s)return this.popNandPushIfOK(a+1,0);var u=e.bytes;return u||(u=e.wordsAsUint8Array(),n*=4,s*=4),!(n<0||n+s>u.length)&&("string"==typeof o.file?(this.popNandPushIfOK(a+1,0),!0):this.fileContentsDo(o.file,function(e){if(!e.contents)return this.popNandPushIfOK(a+1,0);var t=e.contents,r=u;s=Math.min(s,e.size-o.filePos);for(var i=0;it&&(r.file.size=t,r.file.modified=!0,r.filePos>r.file.size&&(r.filePos=r.file.size)),this.popNIfOK(e))},primitiveDisableFileAccess:function(e){return this.fakePrimitive("FilePlugin.primitiveDisableFileAccess",0,e)},primitiveFileWrite:function(s){var n=this.stackInteger(0),o=this.stackInteger(1)-1,e=this.stackNonInteger(2),u=this.stackNonInteger(3);if(!this.success||!u.file||!u.fileWrite)return!1;if(!n)return this.popNandPushIfOK(s+1,0);var l=e.bytes;return l||(l=e.wordsAsUint8Array(),o*=4,n*=4),!!l&&(!(o<0||o+n>l.length)&&("string"==typeof u.file?(this.fileConsoleWrite(u.file,l,o,n),this.popNandPushIfOK(s+1,n),!0):this.fileContentsDo(u.file,function(e){var t=l,r=e.contents||[];if(u.filePos+n>r.length){var i=0===r.length?u.filePos+n:Math.max(u.filePos+n,r.length+1e4);e.contents=new Uint8Array(i),e.contents.set(r),r=e.contents}for(var a=0;ae.size&&(e.size=u.filePos),e.modified=!0,this.popNandPushIfOK(s+1,n)}.bind(this))))},fileOpen:function(e,t){"undefined"==typeof SqueakFiles&&(window.SqueakFiles={});var r=Squeak.splitFilePath(e);if(!r.basename)return null;var i=Squeak.dirList(r.dirname,!0);if(!i)return null;var a=i[r.basename],s=null;if(a){if(n=SqueakFiles[r.fullname])return++n.refCount,n}else{if(!t)return console.log("File not found: "+r.fullname),null;if(s=new Uint8Array,!(a=Squeak.filePut(r.fullname,s.buffer)))return console.log("Cannot create file: "+r.fullname),null}var n={name:r.fullname,size:a[4],contents:s,modified:!1,refCount:1};return SqueakFiles[n.name]=n},fileClose:function(e){Squeak.flushFile(e),0==--e.refCount&&delete SqueakFiles[e.name]},fileContentsDo:function(i,a){if(i.contents)a(i);else{if(!1===i.contents)return!1;this.vm.freeze(function(t){var r=function(e){console.log("File get failed: "+e),i.contents=!1,t(),a(i)}.bind(this),e=function(e){if(null==e)return r(i.name);i.contents=this.asUint8Array(e),t(),a(i)}.bind(this);Squeak.fileGet(i.name,e,r)}.bind(this))}return!0},fileConsoleBuffer:{log:"",error:""},fileConsoleWrite:function(e,t,r,i){var a=t.subarray(r,r+i),s=this.fileConsoleBuffer[e]+Squeak.bytesAsString(a),n=s.match("([^]*)\n(.*)");n&&(console[e](n[1]),s=n[2]),this.fileConsoleBuffer[e]=s},fileConsoleFlush:function(e){var t=this.fileConsoleBuffer[e];t&&(console[e](t),this.fileConsoleBuffer[e]="")}}),Object.extend(Squeak.Primitives.prototype,"JPEGReadWriter2Plugin",{jpeg2_primJPEGPluginIsPresent:function(e){return this.popNandPushIfOK(e+1,this.vm.trueObj)},jpeg2_primImageHeight:function(e){var t=this.stackNonInteger(0).wordsOrBytes();if(!t)return!1;var r=t[1];return this.popNandPushIfOK(e+1,r)},jpeg2_primImageWidth:function(e){var t=this.stackNonInteger(0).wordsOrBytes();if(!t)return!1;var r=t[0];return this.popNandPushIfOK(e+1,r)},jpeg2_primJPEGCompressStructSize:function(e){return this.popNandPushIfOK(e+1,0)},jpeg2_primJPEGDecompressStructSize:function(e){return this.popNandPushIfOK(e+1,8)},jpeg2_primJPEGErrorMgr2StructSize:function(e){return this.popNandPushIfOK(e+1,0)},jpeg2_primJPEGReadHeaderfromByteArrayerrorMgr:function(e){var t=this.stackNonInteger(2).wordsOrBytes(),r=this.stackNonInteger(1).bytes;if(!t||!r)return!1;var i=this.vm.freeze();return this.jpeg2_readImageFromBytes(r,function(e){this.jpeg2state={src:r,img:e},t[0]=e.width,t[1]=e.height,i()}.bind(this),function(){t[0]=0,t[1]=0,i()}.bind(this)),this.popNIfOK(e)},jpeg2_primJPEGReadImagefromByteArrayonFormdoDitheringerrorMgr:function(e){var t=this.stackNonInteger(3).bytes,r=this.stackNonInteger(2).pointers,i=this.stackBoolean(1);if(!this.success||!t||!r)return!1;var a=this.jpeg2state;if(!a||a.src!==t)return console.error("jpeg read did not match header info"),!1;var s=r[Squeak.Form_depth],n=this.jpeg2_getPixelsFromImage(a.img),o=r[Squeak.Form_bits].words;if(32===s)this.jpeg2_copyPixelsToForm32(n,o);else{if(16!==s)return!1;i?this.jpeg2_ditherPixelsToForm16(n,o):this.jpeg2_copyPixelsToForm16(n,o)}return this.popNIfOK(e)},jpeg2_primJPEGWriteImageonByteArrayformqualityprogressiveJPEGerrorMgr:function(e){return this.vm.warnOnce("JPEGReadWritePlugin2: writing not implemented yet"),!1},jpeg2_readImageFromBytes:function(e,t,r){var i=new Blob([e],{type:"image/jpeg"}),a=new Image;a.onload=function(){t(a)},a.onerror=function(){console.warn("could not render JPEG"),r()},a.src=(window.URL||window.webkitURL).createObjectURL(i)},jpeg2_getPixelsFromImage:function(e){var t=document.createElement("canvas"),r=t.getContext("2d");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height)},jpeg2_copyPixelsToForm32:function(e,t){for(var r=e.data,i=0;i>3<<10|a[4*o+1]>>3<<5|a[4*o+2]>>3;0===u&&(u=1),0==(65535&(u=u<<16|a[4*o+4]>>3<<10|a[4*o+5]>>3<<5|a[4*o+6]>>3))&&(u|=1),t[o>>1]=u}},jpeg2_ditherPixelsToForm16:function(e,t){for(var r=e.width>>1,i=e.height,a=e.data,s=[2,0,14,12,1,3,13,15],n=[10,8,6,4,9,11,5,7],o=0;o>8)>>4,f=k<(15&l)?c+1:c,c=(l=496*d>>8)>>4,d=k<(15&l)?c+1:c,c=(l=496*p>>8)>>4,p=k<(15&l)?c+1:c,c=(l=496*b>>8)>>4,b=_<(15&l)?c+1:c,c=(l=496*m>>8)>>4,m=_<(15&l)?c+1:c,c=(l=496*v>>8)>>4;var S=f<<10|d<<5|p;0===S&&(S=1),0==(65535&(S=S<<16|b<<10|m<<5|(v=_<(15&l)?c+1:c)))&&(S|=1),t[h>>3]=S}}}),Object.extend(Squeak.Primitives.prototype,"ScratchPluginAdditions",{scratch_primitiveOpenURL:function(e){var t=this.stackNonInteger(0).bytesAsString();if(""==t)return!1;if(/^\/SqueakJS\//.test(t)){t=t.slice(10);var r=Squeak.splitFilePath(t),i=Squeak.Settings["squeak-template:"+r.dirname];i&&(t=JSON.parse(i).url+"/"+r.basename)}return window.open(t,"_blank"),this.popNIfOK(e)},scratch_primitiveGetFolderPath:function(e){var t,r=this.stackInteger(0);if(!this.success)return!1;switch(r){case 1:t="/"}return!!t&&(this.vm.popNandPush(e+1,this.makeStString(this.filenameToSqueak(t))),!0)}}),Object.extend(Squeak.Primitives.prototype,"SoundPlugin",{snd_primitiveSoundStart:function(e){return this.snd_primitiveSoundStartWithSemaphore(e)},snd_primitiveSoundStartWithSemaphore:function(e){var t=this.stackInteger(e-1),r=this.stackInteger(e-2),i=this.stackBoolean(e-3),a=3>8,r=255&e.charCodeAt(l/2),i=l/2+1>8:NaN):(t=255&e.charCodeAt((l-1)/2),(l+1)/2>8,i=255&e.charCodeAt((l+1)/2)):r=i=NaN),l+=3,a=t>>2,s=(3&t)<<4|r>>4,n=(15&r)<<2|i>>6,o=63&i,isNaN(r)?n=o=64:isNaN(i)&&(o=64),u=u+LZString$1._keyStr.charAt(a)+LZString$1._keyStr.charAt(s)+LZString$1._keyStr.charAt(n)+LZString$1._keyStr.charAt(o);return u},decompressFromBase64:function(e){if(null==e)return"";var t,r,i,a,s,n,o,u="",l=0,c=0,h=LZString$1._f;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c>4,i=(15&s)<<4|(n=LZString$1._keyStr.indexOf(e.charAt(c++)))>>2,a=(3&n)<<6|(o=LZString$1._keyStr.indexOf(e.charAt(c++))),l%2==0?(t=r<<8,64!=n&&(u+=h(t|i)),64!=o&&(t=a<<8)):(u+=h(t|r),64!=n&&(t=i<<8),64!=o&&(u+=h(t|a))),l+=3;return LZString$1.decompress(u)},compressToUTF16:function(e){if(null==e)return"";var t,r,i,a="",s=0,n=LZString$1._f;for(e=LZString$1.compress(e),t=0;t>1)),i=(1&r)<<14;break;case 1:a+=n(i+(r>>2)+32),i=(3&r)<<13;break;case 2:a+=n(i+(r>>3)+32),i=(7&r)<<12;break;case 3:a+=n(i+(r>>4)+32),i=(15&r)<<11;break;case 4:a+=n(i+(r>>5)+32),i=(31&r)<<10;break;case 5:a+=n(i+(r>>6)+32),i=(63&r)<<9;break;case 6:a+=n(i+(r>>7)+32),i=(127&r)<<8;break;case 7:a+=n(i+(r>>8)+32),i=(255&r)<<7;break;case 8:a+=n(i+(r>>9)+32),i=(511&r)<<6;break;case 9:a+=n(i+(r>>10)+32),i=(1023&r)<<5;break;case 10:a+=n(i+(r>>11)+32),i=(2047&r)<<4;break;case 11:a+=n(i+(r>>12)+32),i=(4095&r)<<3;break;case 12:a+=n(i+(r>>13)+32),i=(8191&r)<<2;break;case 13:a+=n(i+(r>>14)+32),i=(16383&r)<<1;break;case 14:a+=n(i+(r>>15)+32,32+(32767&r)),s=0}return a+n(i+32)},decompressFromUTF16:function(e){if(null==e)return"";for(var t,r,i="",a=0,s=0,n=LZString$1._f;s>14),t=(16383&r)<<2;break;case 2:i+=n(t|r>>13),t=(8191&r)<<3;break;case 3:i+=n(t|r>>12),t=(4095&r)<<4;break;case 4:i+=n(t|r>>11),t=(2047&r)<<5;break;case 5:i+=n(t|r>>10),t=(1023&r)<<6;break;case 6:i+=n(t|r>>9),t=(511&r)<<7;break;case 7:i+=n(t|r>>8),t=(255&r)<<8;break;case 8:i+=n(t|r>>7),t=(127&r)<<9;break;case 9:i+=n(t|r>>6),t=(63&r)<<10;break;case 10:i+=n(t|r>>5),t=(31&r)<<11;break;case 11:i+=n(t|r>>4),t=(15&r)<<12;break;case 12:i+=n(t|r>>3),t=(7&r)<<13;break;case 13:i+=n(t|r>>2),t=(3&r)<<14;break;case 14:i+=n(t|r>>1),t=(1&r)<<15;break;case 15:i+=n(t|r),a=0}s++}return LZString$1.decompress(i)},compress:function(e){if(null==e)return"";var t,r,i,a={},s={},n="",o="",u="",l=2,c=3,h=2,f="",d=0,p=0,b=LZString$1._f;for(i=0;i>=1}else{for(r=1,t=0;t>=1}0==--l&&(l=Math.pow(2,h),h++),delete s[u]}else for(r=a[u],t=0;t>=1;0==--l&&(l=Math.pow(2,h),h++),a[o]=c++,u=String(n)}if(""!==u){if(Object.prototype.hasOwnProperty.call(s,u)){if(u.charCodeAt(0)<256){for(t=0;t>=1}else{for(r=1,t=0;t>=1}0==--l&&(l=Math.pow(2,h),h++),delete s[u]}else for(r=a[u],t=0;t>=1;0==--l&&(l=Math.pow(2,h),h++)}for(r=2,t=0;t>=1;for(;;){if(d<<=1,15==p){f+=b(d);break}p++}return f},decompress:function(e){if(null==e)return"";if(""==e)return null;var t,r,i,a,s,n,o,u=[],l=4,c=4,h=3,f="",d="",p=LZString$1._f,b={string:e,val:e.charCodeAt(0),position:32768,index:1};for(t=0;t<3;t+=1)u[t]=t;for(i=0,s=Math.pow(2,2),n=1;n!=s;)a=b.val&b.position,b.position>>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0b.string.length)return"";for(i=0,s=Math.pow(2,h),n=1;n!=s;)a=b.val&b.position,b.position>>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0>=1,0==b.position&&(b.position=32768,b.val=b.string.charCodeAt(b.index++)),i|=(0>2,s=(3&t)<<4|r>>4,n=1>6:64,o=2>4,r=(15&a)<<4|(s=p.indexOf(e.charAt(u++)))>>2,i=(3&s)<<6|(n=p.indexOf(e.charAt(u++))),o[l++]=t,64!==s&&(o[l++]=r),64!==n&&(o[l++]=i);return o}},{"./support":27,"./utils":29}],2:[function(e,t,r){var i=e("./external"),a=e("./stream/DataWorker"),s=e("./stream/DataLengthProbe"),n=e("./stream/Crc32Probe");s=e("./stream/DataLengthProbe");function o(e,t,r,i,a){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=i,this.compressedContent=a}o.prototype={getContentWorker:function(){var e=new a(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new a(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new n).pipe(new s("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new s("compressedSize")).withStreamInfo("compression",t)},t.exports=o},{"./external":6,"./stream/Crc32Probe":22,"./stream/DataLengthProbe":23,"./stream/DataWorker":24}],3:[function(e,t,r){var i=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(e){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":25}],4:[function(e,t,r){var i=e("./utils");var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?("string"!==i.getTypeOf(e)?function(e,t,r,i){var a=o,s=i+r;e^=-1;for(var n=i;n>>8^a[255&(e^t[n])];return-1^e}:function(e,t,r,i){var a=o,s=i+r;e^=-1;for(var n=i;n>>8^a[255&(e^t.charCodeAt(n))];return-1^e})(0|t,e,e.length,0):0}},{"./utils":29}],5:[function(e,t,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){var i=e("es6-promise").Promise;t.exports={Promise:i}},{"es6-promise":37}],7:[function(e,t,r){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,a=e("pako"),s=e("./utils"),n=e("./stream/GenericWorker"),o=i?"uint8array":"array";function u(e,t){n.call(this,"FlateWorker/"+e),this._pako=new a[e]({raw:!0,level:t.level||-1}),this.meta={};var r=this;this._pako.onData=function(e){r.push({data:e,meta:r.meta})}}r.magic="\b\0",s.inherits(u,n),u.prototype.processChunk=function(e){this.meta=e.meta,this._pako.push(s.transformTo(o,e.data),!1)},u.prototype.flush=function(){n.prototype.flush.call(this),this._pako.push([],!0)},u.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this._pako=null},r.compressWorker=function(e){return new u("Deflate",e)},r.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":25,"./utils":29,pako:38}],8:[function(e,t,r){function $(e,t){var r,i="";for(r=0;r>>=8;return i}function i(e,t,r,i,a,s){var n,o,u=e.file,l=e.compression,c=s!==Y.utf8encode,h=V.transformTo("string",s(u.name)),f=V.transformTo("string",Y.utf8encode(u.name)),d=u.comment,p=V.transformTo("string",s(d)),b=V.transformTo("string",Y.utf8encode(d)),m=f.length!==u.name.length,v=b.length!==d.length,g="",k="",_="",S=u.dir,y=u.date,I={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(I.crc32=e.crc32,I.compressedSize=e.compressedSize,I.uncompressedSize=e.uncompressedSize);var O=0;t&&(O|=8),c||!m&&!v||(O|=2048);var w,F,C,x=0,A=0;S&&(x|=16),"UNIX"===a?(A=798,x|=(w=u.unixPermissions,F=S,(C=w)||(C=F?16893:33204),(65535&C)<<16)):(A=20,x|=63&(u.dosPermissions||0)),n=y.getUTCHours(),n<<=6,n|=y.getUTCMinutes(),n<<=5,n|=y.getUTCSeconds()/2,o=y.getUTCFullYear()-1980,o<<=4,o|=y.getUTCMonth()+1,o<<=5,o|=y.getUTCDate(),m&&(k=$(1,1)+$(M(h),4)+f,g+="up"+$(k.length,2)+k),v&&(_=$(1,1)+$(M(p),4)+b,g+="uc"+$(_.length,2)+_);var P="";return P+="\n\0",P+=$(O,2),P+=l.magic,P+=$(n,2),P+=$(o,2),P+=$(I.crc32,4),P+=$(I.compressedSize,4),P+=$(I.uncompressedSize,4),P+=$(h.length,2),P+=$(g.length,2),{fileRecord:j.LOCAL_FILE_HEADER+P+h+g,dirRecord:j.CENTRAL_FILE_HEADER+$(A,2)+P+$(p.length,2)+"\0\0\0\0"+$(x,4)+$(i,4)+h+g+p}}var V=e("../utils"),a=e("../stream/GenericWorker"),Y=e("../utf8"),M=e("../crc32"),j=e("../signature");function s(e,t,r,i){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}V.inherits(s,a),s.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,a.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-i-1))/r:100}}))},s.prototype.openedSource=function(e){if(this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name,this.streamFiles&&!e.file.dir){var t=i(e,this.streamFiles,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:t.fileRecord,meta:{percent:0}})}else this.accumulate=!0},s.prototype.closedSource=function(e){this.accumulate=!1;var t,r=i(e,this.streamFiles,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),this.streamFiles&&!e.file.dir)this.push({data:(t=e,j.DATA_DESCRIPTOR+$(t.crc32,4)+$(t.compressedSize,4)+$(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},s.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=a},{"../utils":29}],16:[function(e,t,r){var i=e("./Uint8ArrayReader");function a(e){i.call(this,e)}e("../utils").inherits(a,i),a.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=a},{"../utils":29,"./Uint8ArrayReader":18}],17:[function(e,t,r){var i=e("./DataReader");function a(e){i.call(this,e)}e("../utils").inherits(a,i),a.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},a.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},a.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},a.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=a},{"../utils":29,"./DataReader":15}],18:[function(e,t,r){var i=e("./ArrayReader");function a(e){i.call(this,e)}e("../utils").inherits(a,i),a.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=a},{"../utils":29,"./ArrayReader":14}],19:[function(e,t,r){var i=e("../utils"),a=e("../support"),s=e("./ArrayReader"),n=e("./StringReader"),o=e("./NodeBufferReader"),u=e("./Uint8ArrayReader");t.exports=function(e){var t=i.getTypeOf(e);return i.checkSupport(t),"string"!==t||a.uint8array?"nodebuffer"===t?new o(e):a.uint8array?new u(i.transformTo("uint8array",e)):new s(i.transformTo("array",e)):new n(e)}},{"../support":27,"../utils":29,"./ArrayReader":14,"./NodeBufferReader":16,"./StringReader":17,"./Uint8ArrayReader":18}],20:[function(e,t,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],21:[function(e,t,r){var i=e("./GenericWorker"),a=e("../utils");function s(e){i.call(this,"ConvertWorker to "+e),this.destType=e}a.inherits(s,i),s.prototype.processChunk=function(e){this.push({data:a.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":29,"./GenericWorker":25}],22:[function(e,t,r){var i=e("./GenericWorker"),a=e("../crc32");function s(){i.call(this,"Crc32Probe")}e("../utils").inherits(s,i),s.prototype.processChunk=function(e){this.streamInfo.crc32=a(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":29,"./GenericWorker":25}],23:[function(e,t,r){var i=e("../utils"),a=e("./GenericWorker");function s(e){a.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}i.inherits(s,a),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}a.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":29,"./GenericWorker":25}],24:[function(e,t,r){var i=e("../utils"),a=e("./GenericWorker");function s(e){a.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}i.inherits(s,a),s.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":29,"./GenericWorker":25}],25:[function(e,t,r){function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r "+e:e}},t.exports=i},{}],26:[function(n,o,e){(function(u){var l=n("../utils"),a=n("./ConvertWorker"),s=n("./GenericWorker"),c=n("../base64"),t=n("../nodejs/NodejsStreamOutputAdapter"),r=n("../external");function i(e,o){return new r.Promise(function(t,r){var i=[],a=e._internalType,s=e._outputType,n=e._mimeType;e.on("data",function(e,t){i.push(e),o&&o(t)}).on("error",function(e){i=[],r(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return l.newBlob(l.transformTo("arraybuffer",t),r);case"base64":return c.encode(t);default:return l.transformTo(e,t)}}(s,function(e,t){var r,i=0,a=null,s=0;for(r=0;r>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},s.utf8decode=function(e){return u.nodebuffer?o.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,i,a,s=e.length,n=new Array(2*s);for(t=r=0;t>10&1023,n[r++]=56320|1023&i)}return n.length!==r&&(n.subarray?n=n.subarray(0,r):n.length=r),o.applyFromCharCode(n)}(e=o.transformTo(u.uint8array?"uint8array":"array",e))},o.inherits(n,i),n.prototype.processChunk=function(e){var t=o.transformTo(u.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(u.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var i=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return!(r<0)&&0!==r&&r+l[e[r]]>t?r:t}(t),a=t;i!==t.length&&(u.uint8array?(a=t.subarray(0,i),this.leftOver=t.subarray(i,t.length)):(a=t.slice(0,i),this.leftOver=t.slice(i,t.length))),this.push({data:s.utf8decode(a),meta:e.meta})},n.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=n,o.inherits(c,i),c.prototype.processChunk=function(e){this.push({data:s.utf8encode(e.data),meta:e.meta})},s.Utf8EncodeWorker=c},{"./nodejsUtils":12,"./stream/GenericWorker":25,"./support":27,"./utils":29}],29:[function(e,t,u){var l=e("./support"),c=e("./base64"),r=e("./nodejsUtils"),i=e("asap"),h=e("./external");function a(e){return e}function f(e,t){for(var r=0;r>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,r,i,a=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return c(e,e.length)},r.binstring2buf=function(e){for(var t=new u.Buf8(e.length),r=0,i=t.length;r>10&1023,o[i++]=56320|1023&a)}return c(o,i)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return!(r<0)&&0!==r&&r+l[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){t.exports=function(e,t,r,i){for(var a=65535&e|0,s=e>>>16&65535|0,n=0;0!==r;){for(r-=n=2e3>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,i){var a=o,s=i+r;e^=-1;for(var n=i;n>>8^a[255&(e^t[n])];return-1^e}},{}],46:[function(e,t,r){var u,f=e("../utils/common"),l=e("./trees"),d=e("./adler32"),p=e("./crc32"),i=e("./messages"),c=0,h=4,b=0,m=-2,v=-1,g=4,a=2,k=8,_=9,s=286,n=30,o=19,S=2*s+1,y=15,I=3,O=258,w=O+I+1,F=42,C=113,x=1,A=2,P=3,$=4;function V(e,t){return e.msg=i[t],t}function Y(e){return(e<<1)-(4e.avail_out&&(r=e.avail_out),0!==r&&(f.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function N(e,t){l._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,j(e.strm)}function q(e,t){e.pending_buf[e.pending++]=t}function B(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function W(e,t){var r,i,a=e.max_chain_length,s=e.strstart,n=e.prev_length,o=e.nice_match,u=e.strstart>e.w_size-w?e.strstart-(e.w_size-w):0,l=e.window,c=e.w_mask,h=e.prev,f=e.strstart+O,d=l[s+n-1],p=l[s+n];e.prev_length>=e.good_match&&(a>>=2),o>e.lookahead&&(o=e.lookahead);do{if(l[(r=t)+n]===p&&l[r+n-1]===d&&l[r]===l[s]&&l[++r]===l[s+1]){s+=2,r++;do{}while(l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&su&&0!=--a);return n<=e.lookahead?n:e.lookahead}function E(e){var t,r,i,a,s,n,o,u,l,c,h=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=h+(h-w)){for(f.arraySet(e.window,e.window,h,h,0),e.match_start-=h,e.strstart-=h,e.block_start-=h,t=r=e.hash_size;i=e.head[--t],e.head[t]=h<=i?i-h:0,--r;);for(t=r=h;i=e.prev[--t],e.prev[t]=h<=i?i-h:0,--r;);a+=h}if(0===e.strm.avail_in)break;if(n=e.strm,o=e.window,u=e.strstart+e.lookahead,l=a,c=void 0,c=n.avail_in,l=I)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<=I&&(e.ins_h=(e.ins_h<=I)if(i=l._tr_tally(e,e.strstart-e.match_start,e.match_length-I),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=I){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=I&&(e.ins_h=(e.ins_h<=I&&e.match_length<=e.prev_length){for(a=e.strstart+e.lookahead-I,i=l._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-I),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=a&&(e.ins_h=(e.ins_h<>1,o.l_buf=3*o.lit_bufsize,o.level=t,o.strategy=s,o.method=r,U(e)}u=[new R(0,0,0,0,function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(E(e),0===e.lookahead&&t===c)return x;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,N(e,!1),0===e.strm.avail_out))return x;if(e.strstart-e.block_start>=e.w_size-w&&(N(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===h?(N(e,!0),0===e.strm.avail_out?P:$):(e.strstart>e.block_start&&(N(e,!1),e.strm.avail_out),x)}),new R(4,4,8,4,L),new R(4,5,16,8,L),new R(4,6,32,32,L),new R(4,4,16,16,T),new R(8,16,32,32,T),new R(8,16,128,128,T),new R(8,32,128,256,T),new R(32,128,258,1024,T),new R(32,258,258,4096,T)],r.deflateInit=function(e,t){return z(e,t,k,15,8,0)},r.deflateInit2=z,r.deflateReset=U,r.deflateResetKeep=D,r.deflateSetHeader=function(e,t){return!e||!e.state||2!==e.state.wrap?m:(e.state.gzhead=t,b)},r.deflate=function(e,t){var r,i,a,s;if(!e||!e.state||5>8&255),q(i,i.gzhead.time>>16&255),q(i,i.gzhead.time>>24&255),q(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),q(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(q(i,255&i.gzhead.extra.length),q(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=p(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(q(i,0),q(i,0),q(i,0),q(i,0),q(i,0),q(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),q(i,3),i.status=C);else{var n=k+(i.w_bits-8<<4)<<8;n|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(n|=32),n+=31-n%31,i.status=C,B(i,n),0!==i.strstart&&(B(i,e.adler>>>16),B(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),j(e),a=i.pending,i.pending!==i.pending_buf_size));)q(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),j(e),a=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindexa&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),0===s&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),j(e),a=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindexa&&(e.adler=p(e.adler,i.pending_buf,i.pending-a,a)),0===s&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&j(e),i.pending+2<=i.pending_buf_size&&(q(i,255&e.adler),q(i,e.adler>>8&255),e.adler=0,i.status=C)):i.status=C),0!==i.pending){if(j(e),0===e.avail_out)return i.last_flush=-1,b}else if(0===e.avail_in&&Y(t)<=Y(r)&&t!==h)return V(e,-5);if(666===i.status&&0!==e.avail_in)return V(e,-5);if(0!==e.avail_in||0!==i.lookahead||t!==c&&666!==i.status){var o=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(E(e),0===e.lookahead)){if(t===c)return x;break}if(e.match_length=0,r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(N(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===h?(N(e,!0),0===e.strm.avail_out?P:$):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?x:A}(i,t):3===i.strategy?function(e,t){for(var r,i,a,s,n=e.window;;){if(e.lookahead<=O){if(E(e),e.lookahead<=O&&t===c)return x;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=I&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=I?(r=l._tr_tally(e,1,e.match_length-I),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=l._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(N(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===h?(N(e,!0),0===e.strm.avail_out?P:$):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?x:A}(i,t):u[i.level].func(i,t);if(o!==P&&o!==$||(i.status=666),o===x||o===P)return 0===e.avail_out&&(i.last_flush=-1),b;if(o===A&&(1===t?l._tr_align(i):5!==t&&(l._tr_stored_block(i,0,0,!1),3===t&&(M(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),j(e),0===e.avail_out))return i.last_flush=-1,b}return t!==h?b:i.wrap<=0?1:(2===i.wrap?(q(i,255&e.adler),q(i,e.adler>>8&255),q(i,e.adler>>16&255),q(i,e.adler>>24&255),q(i,255&e.total_in),q(i,e.total_in>>8&255),q(i,e.total_in>>16&255),q(i,e.total_in>>24&255)):(B(i,e.adler>>>16),B(i,65535&e.adler)),j(e),0=r.w_size&&(0===s&&(M(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new f.Buf8(r.w_size),f.arraySet(l,t,c-r.w_size,r.w_size,0),t=l,c=r.w_size),n=e.avail_in,o=e.next_in,u=e.input,e.avail_in=c,e.next_in=0,e.input=t,E(r);r.lookahead>=I;){for(i=r.strstart,a=r.lookahead-(I-1);r.ins_h=(r.ins_h<>>=_=k>>>24,p-=_,0===(_=k>>>16&255))F[s++]=65535&k;else{if(!(16&_)){if(0==(64&_)){k=b[(65535&k)+(d&(1<<_)-1)];continue t}if(32&_){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}S=65535&k,(_&=15)&&(p<_&&(d+=w[i++]<>>=_,p-=_),p<15&&(d+=w[i++]<>>=_=k>>>24,p-=_,!(16&(_=k>>>16&255))){if(0==(64&_)){k=m[(65535&k)+(d&(1<<_)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(y=65535&k,p<(_&=15)&&(d+=w[i++]<>>=_,p-=_,(_=s-n)>3,d&=(1<<(p-=S<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new A.Buf16(320),this.work=new A.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function n(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=B,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new A.Buf32(i),t.distcode=t.distdyn=new A.Buf32(a),t.sane=1,t.back=-1,N):q}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,n(e)):q}function u(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(A.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(a=s.wsize-s.wnext)&&(a=i),A.arraySet(s.window,t,r-i,a,s.wnext),(i-=a)?(A.arraySet(s.window,t,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=a,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=$(r.check,C,2,0),c=l=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&l)){e.msg="unknown compression method",r.mode=30;break}if(c-=4,y=8+(15&(l>>>=4)),0===r.wbits)r.wbits=y;else if(y>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(C[0]=255&l,C[1]=l>>>8&255,r.check=$(r.check,C,2,0)),c=l=0,r.mode=3;case 3:for(;c<32;){if(0===o)break e;o--,l+=i[s++]<>>8&255,C[2]=l>>>16&255,C[3]=l>>>24&255,r.check=$(r.check,C,4,0)),c=l=0,r.mode=4;case 4:for(;c<16;){if(0===o)break e;o--,l+=i[s++]<>8),512&r.flags&&(C[0]=255&l,C[1]=l>>>8&255,r.check=$(r.check,C,2,0)),c=l=0,r.mode=5;case 5:if(1024&r.flags){for(;c<16;){if(0===o)break e;o--,l+=i[s++]<>>8&255,r.check=$(r.check,C,2,0)),c=l=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(d=r.length)&&(d=o),d&&(r.head&&(y=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),A.arraySet(r.head.extra,i,s,d,y)),512&r.flags&&(r.check=$(r.check,i,d,s)),o-=d,s+=d,r.length-=d),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break e;for(d=0;y=i[s+d++],r.head&&y&&r.length<65536&&(r.head.name+=String.fromCharCode(y)),y&&d>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;c<32;){if(0===o)break e;o--,l+=i[s++]<>>=7&c,c-=7&c,r.mode=27;break}for(;c<3;){if(0===o)break e;o--,l+=i[s++]<>>=1)){case 0:r.mode=14;break;case 1:if(E(r),r.mode=20,6!==t)break;l>>>=2,c-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}l>>>=2,c-=2;break;case 14:for(l>>>=7&c,c-=7&c;c<32;){if(0===o)break e;o--,l+=i[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&l,c=l=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(d=r.length){if(o>>=5,c-=5,r.ndist=1+(31&l),l>>>=5,c-=5,r.ncode=4+(15&l),l>>>=4,c-=4,286>>=3,c-=3}for(;r.have<19;)r.lens[x[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,O={bits:r.lenbits},I=Y(0,r.lens,0,19,r.lencode,0,r.work,O),r.lenbits=O.bits,I){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,g=65535&F,!((m=F>>>24)<=c);){if(0===o)break e;o--,l+=i[s++]<>>=m,c-=m,r.lens[r.have++]=g;else{if(16===g){for(w=m+2;c>>=m,c-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}y=r.lens[r.have-1],d=3+(3&l),l>>>=2,c-=2}else if(17===g){for(w=m+3;c>>=m)),l>>>=3,c-=3}else{for(w=m+7;c>>=m)),l>>>=7,c-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;d--;)r.lens[r.have++]=y}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,O={bits:r.lenbits},I=Y(M,r.lens,0,r.nlen,r.lencode,0,r.work,O),r.lenbits=O.bits,I){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,O={bits:r.distbits},I=Y(j,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,O),r.distbits=O.bits,I){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=o&&258<=u){e.next_out=n,e.avail_out=u,e.next_in=s,e.avail_in=o,r.hold=l,r.bits=c,V(e,f),n=e.next_out,a=e.output,u=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,l=r.hold,c=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;v=(F=r.lencode[l&(1<>>16&255,g=65535&F,!((m=F>>>24)<=c);){if(0===o)break e;o--,l+=i[s++]<>k)])>>>16&255,g=65535&F,!(k+(m=F>>>24)<=c);){if(0===o)break e;o--,l+=i[s++]<>>=k,c-=k,r.back+=k}if(l>>>=m,c-=m,r.back+=m,r.length=g,0===v){r.mode=26;break}if(32&v){r.back=-1,r.mode=12;break}if(64&v){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&v,r.mode=22;case 22:if(r.extra){for(w=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;v=(F=r.distcode[l&(1<>>16&255,g=65535&F,!((m=F>>>24)<=c);){if(0===o)break e;o--,l+=i[s++]<>k)])>>>16&255,g=65535&F,!(k+(m=F>>>24)<=c);){if(0===o)break e;o--,l+=i[s++]<>>=k,c-=k,r.back+=k}if(l>>>=m,c-=m,r.back+=m,64&v){e.msg="invalid distance code",r.mode=30;break}r.offset=g,r.extra=15&v,r.mode=24;case 24:if(r.extra){for(w=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===u)break e;if(d=f-u,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}p=d>r.wnext?(d-=r.wnext,r.wsize-d):r.wnext-d,d>r.length&&(d=r.length),b=r.window}else b=a,p=n-r.offset,d=r.length;for(ud?(b=V[Y+n[k]],x[A+n[k]]):(b=96,0),u=1<>O)+(l-=u)]=p<<24|b<<16|m|0,0!==l;);for(u=1<>=1;if(0!==u?(C&=u-1,C+=u):C=0,k++,0==--P[g]){if(g===S)break;g=t[r+n[k]]}if(y>>7)]}function q(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function B(e,t,r){e.bi_valid>a-r?(e.bi_buf|=t<>a-e.bi_valid,e.bi_valid+=r-a):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function L(e,t,r){var i,a,s=new Array(v+1),n=0;for(i=1;i<=v;i++)s[i]=n=n+r[i-1]<<1;for(a=0;a<=t;a++){var o=e[2*a+1];0!==o&&(e[2*a]=E(s[o]++,o))}}function T(e){var t;for(t=0;t>1;1<=r;r--)D(e,s,r);for(a=u;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],D(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,s[2*a]=s[2*r]+s[2*i],e.depth[a]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,s[2*r+1]=s[2*i+1]=a,e.heap[1]=a++,D(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,a,s,n,o,u=t.dyn_tree,l=t.max_code,c=t.stat_desc.static_tree,h=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,b=0;for(s=0;s<=v;s++)e.bl_count[s]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r>=7;i>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return o;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return l;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=a&&(a=s)):a=s=r+5,r+4<=a&&-1!==t?Z(e,t,r,i):4===e.strategy||s===a?(B(e,2+(i?1:0),3),U(e,F,C)):(B(e,4+(i?1:0),3),function(e,t,r,i){var a;for(B(e,t-257,5),B(e,r-1,5),B(e,i-4,4),a=0;a>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(A[r]+h+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){var t;B(e,2,3),W(e,g,F),16===(t=e).bi_valid?(q(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,r){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}]},{},[10])(10)}),function(o){if(!(void 0===o||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var e=o.document,u=function(){return o.URL||o.webkitURL||o},l=e.createElementNS("http://www.w3.org/1999/xhtml","a"),c="download"in l,h=/constructor/i.test(o.HTMLElement)||o.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent),d=o.setImmediate||o.setTimeout,p=function(e){d(function(){throw e},0)},b=function(e){setTimeout(function(){"string"==typeof e?u().revokeObjectURL(e):e.remove()},4e4)},m=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},i=function(e,r,t){t||(e=m(e));function i(){!function(e,t,r){for(var i=(t=[].concat(t)).length;i--;){var a=e["on"+t[i]];if("function"==typeof a)try{a.call(e,r||e)}catch(e){p(e)}}}(s,"writestart progress write writeend".split(" "))}var a,s=this,n="application/octet-stream"===e.type;if(s.readyState=s.INIT,c)return a=u().createObjectURL(e),void d(function(){var e,t;l.href=a,l.download=r,e=l,t=new MouseEvent("click"),e.dispatchEvent(t),i(),b(a),s.readyState=s.DONE},0);!function(){if((f||n&&h)&&o.FileReader){var t=new FileReader;return t.onloadend=function(){var e=f?t.result:t.result.replace(/^data:[^;]*;/,"data:attachment/file;");o.open(e,"_blank")||(o.location.href=e),e=void 0,s.readyState=s.DONE,i()},t.readAsDataURL(e),s.readyState=s.INIT}(a=a||u().createObjectURL(e),n)?o.location.href=a:o.open(a,"_blank")||(o.location.href=a);s.readyState=s.DONE,i(),b(a)}()},t=i.prototype;if("undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob)return;t.abort=function(){},t.readyState=t.INIT=0,t.WRITING=1,t.DONE=2,t.error=t.onwritestart=t.onprogress=t.onwrite=t.onabort=t.onerror=t.onwriteend=null,o.FileSaver_saveAs=function(e,t,r){return new i(e,t||e.name||"download",r)}}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||void 0),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=global);var COMMON_JS=!root.JS_SHA1_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD="function"==typeof define&&define.amd,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[],createOutputMethod=function(t){return function(e){return new Sha1(!0).update(e)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Sha1},t.update=function(e){return t.create().update(e)};for(var e=0;e>2]|=e[a]<>2]|=r<>2]|=(192|r>>6)<>2]|=(224|r>>12)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<>2]|=EXTRA[3&t],this.block=e[16],56<=t&&(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,r=this.h0,i=this.h1,a=this.h2,s=this.h3,n=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)r=(t=(i=(t=(a=(t=(s=(t=(n=(t=r<<5|r>>>27)+(i&a|~i&s)+n+1518500249+o[e]<<0)<<5|n>>>27)+(r&(i=i<<30|i>>>2)|~r&a)+s+1518500249+o[e+1]<<0)<<5|s>>>27)+(n&(r=r<<30|r>>>2)|~n&i)+a+1518500249+o[e+2]<<0)<<5|a>>>27)+(s&(n=n<<30|n>>>2)|~s&r)+i+1518500249+o[e+3]<<0)<<5|i>>>27)+(a&(s=s<<30|s>>>2)|~a&n)+r+1518500249+o[e+4]<<0,a=a<<30|a>>>2;for(;e<40;e+=5)r=(t=(i=(t=(a=(t=(s=(t=(n=(t=r<<5|r>>>27)+(i^a^s)+n+1859775393+o[e]<<0)<<5|n>>>27)+(r^(i=i<<30|i>>>2)^a)+s+1859775393+o[e+1]<<0)<<5|s>>>27)+(n^(r=r<<30|r>>>2)^i)+a+1859775393+o[e+2]<<0)<<5|a>>>27)+(s^(n=n<<30|n>>>2)^r)+i+1859775393+o[e+3]<<0)<<5|i>>>27)+(a^(s=s<<30|s>>>2)^n)+r+1859775393+o[e+4]<<0,a=a<<30|a>>>2;for(;e<60;e+=5)r=(t=(i=(t=(a=(t=(s=(t=(n=(t=r<<5|r>>>27)+(i&a|i&s|a&s)+n-1894007588+o[e]<<0)<<5|n>>>27)+(r&(i=i<<30|i>>>2)|r&a|i&a)+s-1894007588+o[e+1]<<0)<<5|s>>>27)+(n&(r=r<<30|r>>>2)|n&i|r&i)+a-1894007588+o[e+2]<<0)<<5|a>>>27)+(s&(n=n<<30|n>>>2)|s&r|n&r)+i-1894007588+o[e+3]<<0)<<5|i>>>27)+(a&(s=s<<30|s>>>2)|a&n|s&n)+r-1894007588+o[e+4]<<0,a=a<<30|a>>>2;for(;e<80;e+=5)r=(t=(i=(t=(a=(t=(s=(t=(n=(t=r<<5|r>>>27)+(i^a^s)+n-899497514+o[e]<<0)<<5|n>>>27)+(r^(i=i<<30|i>>>2)^a)+s-899497514+o[e+1]<<0)<<5|s>>>27)+(n^(r=r<<30|r>>>2)^i)+a-899497514+o[e+2]<<0)<<5|a>>>27)+(s^(n=n<<30|n>>>2)^r)+i-899497514+o[e+3]<<0)<<5|i>>>27)+(a^(s=s<<30|s>>>2)^n)+r-899497514+o[e+4]<<0,a=a<<30|a>>>2;this.h0=this.h0+r<<0,this.h1=this.h1+i<<0,this.h2=this.h2+a<<0,this.h3=this.h3+s<<0,this.h4=this.h4+n<<0},Sha1.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,i=this.h3,a=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[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]+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[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a]},Sha1.prototype.toString=Sha1.prototype.hex,Sha1.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,i=this.h3,a=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,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a]},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,AMD&&define(function(){return exports}))}(),Object.extend(Squeak,{vmPath:"/",platformSubtype:"Browser",osVersion:navigator.userAgent,windowSystem:"HTML"}),window.SqueakJS={};var canUseMouseOffset=navigator.userAgent.match("AppleWebKit/");function updateMousePos(e,t,r){var i=canUseMouseOffset?e.offsetX:e.layerX,a=canUseMouseOffset?e.offsetY:e.layerY;r.cursorCanvas&&(r.cursorCanvas.style.left=i+t.offsetLeft+r.cursorOffsetX+"px",r.cursorCanvas.style.top=a+t.offsetTop+r.cursorOffsetY+"px");var s=i*t.width/t.offsetWidth|0,n=a*t.height/t.offsetHeight|0;r.mouseX=Math.max(0,Math.min(r.width,s)),r.mouseY=Math.max(0,Math.min(r.height,n))}function recordMouseEvent(e,t,r,i,a){if(updateMousePos(t,r,i),i.vm){var s=i.buttons&Squeak.Mouse_All;switch(e){case"mousedown":switch(t.button||0){case 0:s=Squeak.Mouse_Red;break;case 1:s=Squeak.Mouse_Yellow;break;case 2:s=Squeak.Mouse_Blue}a.swapButtons&&(s==Squeak.Mouse_Yellow?s=Squeak.Mouse_Blue:s==Squeak.Mouse_Blue&&(s=Squeak.Mouse_Yellow));break;case"mousemove":break;case"mouseup":s=0}i.buttons=s|recordModifiers(t,i),i.eventQueue&&(i.eventQueue.push([Squeak.EventTypeMouse,t.timeStamp,i.mouseX,i.mouseY,i.buttons&Squeak.Mouse_All,i.buttons>>3]),i.signalInputEvent&&i.signalInputEvent()),i.idle=0,"mouseup"==e?i.runFor&&i.runFor(100):i.runNow&&i.runNow()}}function recordKeyboardEvent(e,t,r){if(r.vm){var i=r.buttons>>3<<8|e;r.eventQueue?(r.eventQueue.push([Squeak.EventTypeKeyboard,t,e,Squeak.EventKeyChar,r.buttons>>3,e]),r.signalInputEvent&&r.signalInputEvent(),r.keys[0]=i):i===r.vm.interruptKeycode?r.vm.interruptPending=!0:r.keys.push(i),r.idle=0,r.runNow&&r.runNow()}}function recordDragDropEvent(e,t,r,i){i.vm&&i.eventQueue&&(updateMousePos(t,r,i),i.eventQueue.push([Squeak.EventTypeDragDropFiles,t.timeStamp,e,i.mouseX,i.mouseY,i.buttons>>3,i.droppedFiles.length]),i.signalInputEvent&&i.signalInputEvent())}function fakeCmdOrCtrlKey(e,t,r){r.buttons&=~Squeak.Keyboard_All,r.buttons|=Squeak.Keyboard_Cmd|Squeak.Keyboard_Ctrl,r.keys=[],recordKeyboardEvent(e,t,r)}function makeSqueakEvent(e,t,r){t[0]=e[0],t[1]=e[1]-r&Squeak.MillisecondClockMask;for(var i=2;ib.width&&(r.font="bold 24px sans-serif"),r.textAlign="center",r.textBaseline="middle",r.fillText(e,b.width/2,b.height/2)},v.showProgress=function(e,t){t=t||{};var r=v.context,i=b.width/3|0,a=.5*b.width-i/2,s=.5*b.height+48;r.fillStyle=t.background||"#000",r.fillRect(a,s,i,24),r.lineWidth=2,r.strokeStyle=t.color||"#F90",r.strokeRect(a,s,i,24),r.fillStyle=t.color||"#F90",r.fillRect(a,s,i*e,24)},v.executeClipboardPaste=function(e,t){if(!v.vm)return!0;try{v.clipboardString=e,fakeCmdOrCtrlKey("v".charCodeAt(0),t,v)}catch(e){console.error("paste error "+e)}},v.executeClipboardCopy=function(e,t){if(!v.vm)return!0;v.clipboardStringChanged=!1,fakeCmdOrCtrlKey((e||"c").charCodeAt(0),t,v);for(var r=Date.now();!v.clipboardStringChanged&&Date.now()-r<500;)v.vm.interpret(20);if(v.clipboardStringChanged)try{return v.clipboardString}catch(e){console.error("copy error "+e)}},b.onmousedown=function(e){return o(),recordMouseEvent("mousedown",e,b,v,m),e.preventDefault(),!1},b.onmouseup=function(e){recordMouseEvent("mouseup",e,b,v,m),o(),e.preventDefault()},b.onmousemove=function(e){recordMouseEvent("mousemove",e,b,v,m),e.preventDefault()},b.oncontextmenu=function(){return!1};var g={state:"idle",button:0,x:0,y:0,dist:0,down:{}};function u(e){if(e.touches.length){g.x=g.y=0;for(var t=0;t',t.setAttribute("style","position:fixed;right:0;bottom:0;background-color:rgba(128,128,128,0.5);border-radius:5px"),b.parentElement.appendChild(t),t.onmousedown=function(e){b.contentEditable=!0,b.setAttribute("autocomplete","off"),b.setAttribute("autocorrect","off"),b.setAttribute("autocapitalize","off"),b.setAttribute("spellcheck","off"),b.focus(),e.preventDefault()},t.ontouchstart=t.onmousedown}function f(e){for(var t=0;t