1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/extensions/shumway/content/shumway.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51428 @@ 1.4 +/* 1.5 + * Copyright 2013 Mozilla Foundation 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +// This file is automatically generated 1.21 + 1.22 +(function (global) { 1.23 + if (global.DataView) 1.24 + return; 1.25 + if (!global.ArrayBuffer) 1.26 + fail('ArrayBuffer not supported'); 1.27 + if (!Object.defineProperties) 1.28 + fail('This module requires ECMAScript 5'); 1.29 + var nativele = new Int8Array(new Int32Array([ 1.30 + 1 1.31 + ]).buffer)[0] === 1; 1.32 + var temp = new Uint8Array(8); 1.33 + global.DataView = function DataView(buffer, offset, length) { 1.34 + if (!(buffer instanceof ArrayBuffer)) 1.35 + fail('Bad ArrayBuffer'); 1.36 + offset = offset || 0; 1.37 + length = length || buffer.byteLength - offset; 1.38 + if (offset < 0 || length < 0 || offset + length > buffer.byteLength) 1.39 + fail('Illegal offset and/or length'); 1.40 + Object.defineProperties(this, { 1.41 + buffer: { 1.42 + value: buffer, 1.43 + enumerable: false, 1.44 + writable: false, 1.45 + configurable: false 1.46 + }, 1.47 + byteOffset: { 1.48 + value: offset, 1.49 + enumerable: false, 1.50 + writable: false, 1.51 + configurable: false 1.52 + }, 1.53 + byteLength: { 1.54 + value: length, 1.55 + enumerable: false, 1.56 + writable: false, 1.57 + configurable: false 1.58 + }, 1.59 + _bytes: { 1.60 + value: new Uint8Array(buffer, offset, length), 1.61 + enumerable: false, 1.62 + writable: false, 1.63 + configurable: false 1.64 + } 1.65 + }); 1.66 + }; 1.67 + global.DataView.prototype = { 1.68 + constructor: DataView, 1.69 + getInt8: function getInt8(offset) { 1.70 + return get(this, Int8Array, 1, offset); 1.71 + }, 1.72 + getUint8: function getUint8(offset) { 1.73 + return get(this, Uint8Array, 1, offset); 1.74 + }, 1.75 + getInt16: function getInt16(offset, le) { 1.76 + return get(this, Int16Array, 2, offset, le); 1.77 + }, 1.78 + getUint16: function getUint16(offset, le) { 1.79 + return get(this, Uint16Array, 2, offset, le); 1.80 + }, 1.81 + getInt32: function getInt32(offset, le) { 1.82 + return get(this, Int32Array, 4, offset, le); 1.83 + }, 1.84 + getUint32: function getUint32(offset, le) { 1.85 + return get(this, Uint32Array, 4, offset, le); 1.86 + }, 1.87 + getFloat32: function getFloat32(offset, le) { 1.88 + return get(this, Float32Array, 4, offset, le); 1.89 + }, 1.90 + getFloat64: function getFloat32(offset, le) { 1.91 + return get(this, Float64Array, 8, offset, le); 1.92 + }, 1.93 + setInt8: function setInt8(offset, value) { 1.94 + set(this, Int8Array, 1, offset, value); 1.95 + }, 1.96 + setUint8: function setUint8(offset, value) { 1.97 + set(this, Uint8Array, 1, offset, value); 1.98 + }, 1.99 + setInt16: function setInt16(offset, value, le) { 1.100 + set(this, Int16Array, 2, offset, value, le); 1.101 + }, 1.102 + setUint16: function setUint16(offset, value, le) { 1.103 + set(this, Uint16Array, 2, offset, value, le); 1.104 + }, 1.105 + setInt32: function setInt32(offset, value, le) { 1.106 + set(this, Int32Array, 4, offset, value, le); 1.107 + }, 1.108 + setUint32: function setUint32(offset, value, le) { 1.109 + set(this, Uint32Array, 4, offset, value, le); 1.110 + }, 1.111 + setFloat32: function setFloat32(offset, value, le) { 1.112 + set(this, Float32Array, 4, offset, value, le); 1.113 + }, 1.114 + setFloat64: function setFloat64(offset, value, le) { 1.115 + set(this, Float64Array, 8, offset, value, le); 1.116 + } 1.117 + }; 1.118 + function get(view, type, size, offset, le) { 1.119 + if (offset === undefined) 1.120 + fail('Missing required offset argument'); 1.121 + if (offset < 0 || offset + size > view.byteLength) 1.122 + fail('Invalid index: ' + offset); 1.123 + if (size === 1 || !(!le) === nativele) { 1.124 + if ((view.byteOffset + offset) % size === 0) 1.125 + return new type(view.buffer, view.byteOffset + offset, 1)[0]; 1.126 + else { 1.127 + for (var i = 0; i < size; i++) 1.128 + temp[i] = view._bytes[offset + i]; 1.129 + return new type(temp.buffer)[0]; 1.130 + } 1.131 + } else { 1.132 + for (var i = 0; i < size; i++) 1.133 + temp[size - i - 1] = view._bytes[offset + i]; 1.134 + return new type(temp.buffer)[0]; 1.135 + } 1.136 + } 1.137 + function set(view, type, size, offset, value, le) { 1.138 + if (offset === undefined) 1.139 + fail('Missing required offset argument'); 1.140 + if (value === undefined) 1.141 + fail('Missing required value argument'); 1.142 + if (offset < 0 || offset + size > view.byteLength) 1.143 + fail('Invalid index: ' + offset); 1.144 + if (size === 1 || !(!le) === nativele) { 1.145 + if ((view.byteOffset + offset) % size === 0) { 1.146 + new type(view.buffer, view.byteOffset + offset, 1)[0] = value; 1.147 + } else { 1.148 + new type(temp.buffer)[0] = value; 1.149 + for (var i = 0; i < size; i++) 1.150 + view._bytes[i + offset] = temp[i]; 1.151 + } 1.152 + } else { 1.153 + new type(temp.buffer)[0] = value; 1.154 + for (var i = 0; i < size; i++) 1.155 + view._bytes[offset + i] = temp[size - 1 - i]; 1.156 + } 1.157 + } 1.158 + function fail(msg) { 1.159 + throw new Error(msg); 1.160 + } 1.161 +}(this)); 1.162 +; 1.163 +var ByteArray = ByteArray || function (undefined) { 1.164 + ByteArrayClass.INITIAL_SIZE = 128; 1.165 + ByteArrayClass.DEFAULT_OBJECT_ENCODING = 3; 1.166 + function ByteArrayClass(bytes) { 1.167 + if (bytes instanceof ByteArray) { 1.168 + return bytes; 1.169 + } 1.170 + var initData = bytes || this.symbol && this.symbol.data; 1.171 + if (initData) { 1.172 + this.a = new ArrayBuffer(initData.length); 1.173 + this.length = initData.length; 1.174 + new Uint8Array(this.a).set(initData); 1.175 + } else { 1.176 + this.a = new ArrayBuffer(ByteArrayClass.INITIAL_SIZE); 1.177 + this.length = 0; 1.178 + } 1.179 + this.position = 0; 1.180 + this.cacheViews(); 1.181 + this.nativele = new Int8Array(new Int32Array([]).buffer)[0] === 1; 1.182 + this.le = this.nativele; 1.183 + this.objectEncoding = ByteArrayClass.DEFAULT_OBJECT_ENCODING; 1.184 + this.bitBuffer = 0; 1.185 + this.bitLength = 0; 1.186 + } 1.187 + ; 1.188 + function throwEOFError() { 1.189 + runtime.throwErrorFromVM('flash.errors.EOFError', 'End of file was encountered.'); 1.190 + } 1.191 + function throwRangeError() { 1.192 + var error = Errors.ParamRangeError; 1.193 + runtime.throwErrorFromVM('RangeError', getErrorMessage(error.code), error.code); 1.194 + } 1.195 + function throwCompressedDataError() { 1.196 + var error = Errors.CompressedDataError; 1.197 + runtime.throwErrorFromVM('CompressedDataError', getErrorMessage(error.code), error.code); 1.198 + } 1.199 + function checkRange(x, min, max) { 1.200 + if (x !== clamp(x, min, max)) { 1.201 + throwRangeError(); 1.202 + } 1.203 + } 1.204 + function get(b, m, size) { 1.205 + if (b.position + size > b.length) { 1.206 + throwEOFError(); 1.207 + } 1.208 + var v = b.view[m](b.position, b.le); 1.209 + b.position += size; 1.210 + return v; 1.211 + } 1.212 + function set(b, m, size, v) { 1.213 + var len = b.position + size; 1.214 + b.ensureCapacity(len); 1.215 + b.view[m](b.position, v, b.le); 1.216 + b.position = len; 1.217 + if (len > b.length) { 1.218 + b.length = len; 1.219 + } 1.220 + } 1.221 + var BAp = ByteArrayClass.prototype; 1.222 + BAp.cacheViews = function cacheViews() { 1.223 + var a = this.a; 1.224 + this.int8v = new Int8Array(a); 1.225 + this.uint8v = new Uint8Array(a); 1.226 + this.view = new DataView(a); 1.227 + }; 1.228 + BAp.getBytes = function getBytes() { 1.229 + return new Uint8Array(this.a, 0, this.length); 1.230 + }; 1.231 + BAp.ensureCapacity = function ensureCapacity(size) { 1.232 + var origa = this.a; 1.233 + if (origa.byteLength < size) { 1.234 + var newSize = origa.byteLength; 1.235 + while (newSize < size) { 1.236 + newSize *= 2; 1.237 + } 1.238 + var copya = new ArrayBuffer(newSize); 1.239 + var origv = this.int8v; 1.240 + this.a = copya; 1.241 + this.cacheViews(); 1.242 + this.int8v.set(origv); 1.243 + } 1.244 + }; 1.245 + BAp.clear = function clear() { 1.246 + this.length = 0; 1.247 + this.position = 0; 1.248 + }; 1.249 + BAp.readBoolean = function readBoolean() { 1.250 + if (this.position + 1 > this.length) { 1.251 + throwEOFError(); 1.252 + } 1.253 + return this.int8v[this.position++] !== 0; 1.254 + }; 1.255 + BAp.readByte = function readByte() { 1.256 + if (this.position + 1 > this.length) { 1.257 + throwEOFError(); 1.258 + } 1.259 + return this.int8v[this.position++]; 1.260 + }; 1.261 + BAp.readUnsignedByte = function readUnsignedByte() { 1.262 + if (this.position + 1 > this.length) { 1.263 + throwEOFError(); 1.264 + } 1.265 + return this.uint8v[this.position++]; 1.266 + }; 1.267 + BAp.readBytes = function readBytes(bytes, offset, length) { 1.268 + var pos = this.position; 1.269 + if (!offset) { 1.270 + offset = 0; 1.271 + } 1.272 + if (!length) { 1.273 + length = this.length - pos; 1.274 + } 1.275 + if (pos + length > this.length) { 1.276 + throwEOFError(); 1.277 + } 1.278 + if (bytes.length < offset + length) { 1.279 + bytes.ensureCapacity(offset + length); 1.280 + bytes.length = offset + length; 1.281 + } 1.282 + bytes.int8v.set(new Int8Array(this.a, pos, length), offset); 1.283 + this.position += length; 1.284 + }; 1.285 + BAp.writeBoolean = function writeBoolean(v) { 1.286 + var len = this.position + 1; 1.287 + this.ensureCapacity(len); 1.288 + this.int8v[this.position++] = v ? 1 : 0; 1.289 + if (len > this.length) { 1.290 + this.length = len; 1.291 + } 1.292 + }; 1.293 + BAp.writeByte = function writeByte(v) { 1.294 + var len = this.position + 1; 1.295 + this.ensureCapacity(len); 1.296 + this.int8v[this.position++] = v; 1.297 + if (len > this.length) { 1.298 + this.length = len; 1.299 + } 1.300 + }; 1.301 + BAp.writeUnsignedByte = function writeUnsignedByte(v) { 1.302 + var len = this.position + 1; 1.303 + this.ensureCapacity(len); 1.304 + this.uint8v[this.position++] = v; 1.305 + if (len > this.length) { 1.306 + this.length = len; 1.307 + } 1.308 + }; 1.309 + BAp.writeRawBytes = function writeRawBytes(bytes) { 1.310 + var len = this.position + bytes.length; 1.311 + this.ensureCapacity(len); 1.312 + this.int8v.set(bytes, this.position); 1.313 + this.position = len; 1.314 + if (len > this.length) { 1.315 + this.length = len; 1.316 + } 1.317 + }; 1.318 + BAp.readRawBytes = function readRawBytes() { 1.319 + return new Int8Array(this.a, 0, this.length); 1.320 + }; 1.321 + BAp.writeBytes = function writeBytes(bytes, offset, length) { 1.322 + if (arguments.length < 2) { 1.323 + offset = 0; 1.324 + } 1.325 + if (arguments.length < 3) { 1.326 + length = 0; 1.327 + } 1.328 + checkRange(offset, 0, bytes.length); 1.329 + checkRange(offset + length, 0, bytes.length); 1.330 + if (length === 0) { 1.331 + length = bytes.length - offset; 1.332 + } 1.333 + this.writeRawBytes(new Int8Array(bytes.a, offset, length)); 1.334 + }; 1.335 + BAp.readDouble = function readDouble() { 1.336 + return get(this, 'getFloat64', 8); 1.337 + }; 1.338 + BAp.readFloat = function readFloat() { 1.339 + return get(this, 'getFloat32', 4); 1.340 + }; 1.341 + BAp.readInt = function readInt() { 1.342 + return get(this, 'getInt32', 4); 1.343 + }; 1.344 + BAp.readShort = function readShort() { 1.345 + return get(this, 'getInt16', 2); 1.346 + }; 1.347 + BAp.readUnsignedInt = function readUnsignedInt() { 1.348 + return get(this, 'getUint32', 4); 1.349 + }; 1.350 + BAp.readUnsignedShort = function readUnsignedShort() { 1.351 + return get(this, 'getUint16', 2); 1.352 + }; 1.353 + BAp.writeDouble = function writeDouble(v) { 1.354 + set(this, 'setFloat64', 8, v); 1.355 + }; 1.356 + BAp.writeFloat = function writeFloat(v) { 1.357 + set(this, 'setFloat32', 4, v); 1.358 + }; 1.359 + BAp.writeInt = function writeInt(v) { 1.360 + set(this, 'setInt32', 4, v); 1.361 + }; 1.362 + BAp.writeShort = function writeShort(v) { 1.363 + set(this, 'setInt16', 2, v); 1.364 + }; 1.365 + BAp.writeUnsignedInt = function writeUnsignedInt(v) { 1.366 + set(this, 'setUint32', 4, v); 1.367 + }; 1.368 + BAp.writeUnsignedShort = function writeUnsignedShort(v) { 1.369 + set(this, 'setUint16', 2, v); 1.370 + }; 1.371 + var codeLengthOrder = [ 1.372 + 16, 1.373 + 17, 1.374 + 18, 1.375 + 0, 1.376 + 8, 1.377 + 7, 1.378 + 9, 1.379 + 6, 1.380 + 10, 1.381 + 5, 1.382 + 11, 1.383 + 4, 1.384 + 12, 1.385 + 3, 1.386 + 13, 1.387 + 2, 1.388 + 14, 1.389 + 1, 1.390 + 15 1.391 + ]; 1.392 + var distanceCodes = []; 1.393 + var distanceExtraBits = []; 1.394 + for (var i = 0, j = 0, code = 1; i < 30; ++i) { 1.395 + distanceCodes[i] = code; 1.396 + code += 1 << (distanceExtraBits[i] = ~(~((j += i > 2 ? 1 : 0) / 2))); 1.397 + } 1.398 + var bitLengths = []; 1.399 + for (var i = 0; i < 32; ++i) { 1.400 + bitLengths[i] = 5; 1.401 + } 1.402 + var fixedDistanceTable = makeHuffmanTable(bitLengths); 1.403 + var lengthCodes = []; 1.404 + var lengthExtraBits = []; 1.405 + for (var i = 0, j = 0, code = 3; i < 29; ++i) { 1.406 + lengthCodes[i] = code - (i == 28 ? 1 : 0); 1.407 + code += 1 << (lengthExtraBits[i] = ~(~((j += i > 4 ? 1 : 0) / 4 % 6))); 1.408 + } 1.409 + for (var i = 0; i < 288; ++i) { 1.410 + bitLengths[i] = i < 144 || i > 279 ? 8 : i < 256 ? 9 : 7; 1.411 + } 1.412 + var fixedLiteralTable = makeHuffmanTable(bitLengths); 1.413 + function makeHuffmanTable(bitLengths) { 1.414 + var maxBits = Math.max.apply(null, bitLengths); 1.415 + var numLengths = bitLengths.length; 1.416 + var size = 1 << maxBits; 1.417 + var codes = new Uint32Array(size); 1.418 + for (var code = 0, len = 1, skip = 2; len <= maxBits; code <<= 1, ++len, skip <<= 1) { 1.419 + for (var val = 0; val < numLengths; ++val) { 1.420 + if (bitLengths[val] === len) { 1.421 + var lsb = 0; 1.422 + for (var i = 0; i < len; ++i) { 1.423 + lsb = lsb * 2 + (code >> i & 1); 1.424 + } 1.425 + for (var i = lsb; i < size; i += skip) { 1.426 + codes[i] = len << 16 | val; 1.427 + } 1.428 + ++code; 1.429 + } 1.430 + } 1.431 + } 1.432 + return { 1.433 + codes: codes, 1.434 + maxBits: maxBits 1.435 + }; 1.436 + } 1.437 + function inflateBlock(input, output) { 1.438 + var header = readBits(input, 3); 1.439 + switch (header >> 1) { 1.440 + case 0: 1.441 + input.bitBuffer = input.bitLength = 0; 1.442 + var len = input.readUnsignedShort(); 1.443 + var nlen = input.readUnsignedShort(); 1.444 + if ((~nlen & 65535) !== len) { 1.445 + throwCompressedDataError(); 1.446 + } 1.447 + output.writeBytes(input, input.position, len); 1.448 + input.position += len; 1.449 + break; 1.450 + case 1: 1.451 + inflate(input, output, fixedLiteralTable, fixedDistanceTable); 1.452 + break; 1.453 + case 2: 1.454 + var bitLengths = []; 1.455 + var numLiteralCodes = readBits(input, 5) + 257; 1.456 + var numDistanceCodes = readBits(input, 5) + 1; 1.457 + var numCodes = numLiteralCodes + numDistanceCodes; 1.458 + var numLengthCodes = readBits(input, 4) + 4; 1.459 + for (var i = 0; i < 19; ++i) { 1.460 + bitLengths[codeLengthOrder[i]] = i < numLengthCodes ? readBits(input, 3) : 0; 1.461 + } 1.462 + var codeLengthTable = makeHuffmanTable(bitLengths); 1.463 + bitLengths = []; 1.464 + var i = 0; 1.465 + var prev = 0; 1.466 + while (i < numCodes) { 1.467 + var j = 1; 1.468 + var sym = readCode(input, codeLengthTable); 1.469 + switch (sym) { 1.470 + case 16: 1.471 + j = readBits(input, 2) + 3; 1.472 + sym = prev; 1.473 + break; 1.474 + case 17: 1.475 + j = readBits(input, 3) + 3; 1.476 + sym = 0; 1.477 + break; 1.478 + case 18: 1.479 + j = readBits(input, 7) + 11; 1.480 + sym = 0; 1.481 + break; 1.482 + default: 1.483 + prev = sym; 1.484 + } 1.485 + while (j--) { 1.486 + bitLengths[i++] = sym; 1.487 + } 1.488 + } 1.489 + var distanceTable = makeHuffmanTable(bitLengths.splice(numLiteralCodes, numDistanceCodes)); 1.490 + var literalTable = makeHuffmanTable(bitLengths); 1.491 + inflate(input, output, literalTable, distanceTable); 1.492 + break; 1.493 + default: 1.494 + fail('unknown block type', 'inflate'); 1.495 + } 1.496 + } 1.497 + function readBits(input, size) { 1.498 + var buffer = input.bitBuffer; 1.499 + var bufflen = input.bitLength; 1.500 + while (size > bufflen) { 1.501 + buffer |= input.readUnsignedByte() << bufflen; 1.502 + bufflen += 8; 1.503 + } 1.504 + input.bitBuffer = buffer >>> size; 1.505 + input.bitLength = bufflen - size; 1.506 + return buffer & (1 << size) - 1; 1.507 + } 1.508 + function inflate(input, output, literalTable, distanceTable) { 1.509 + var sym; 1.510 + while ((sym = readCode(input, literalTable)) !== 256) { 1.511 + if (sym < 256) { 1.512 + output.writeUnsignedByte(sym); 1.513 + } else { 1.514 + sym -= 257; 1.515 + var len = lengthCodes[sym] + readBits(input, lengthExtraBits[sym]); 1.516 + sym = readCode(input, distanceTable); 1.517 + var distance = distanceCodes[sym] + readBits(input, distanceExtraBits[sym]); 1.518 + output.writeBytes(output, output.position - distance, len); 1.519 + } 1.520 + } 1.521 + } 1.522 + function readCode(input, codeTable) { 1.523 + var buffer = input.bitBuffer; 1.524 + var bitlen = input.bitLength; 1.525 + var maxBits = codeTable.maxBits; 1.526 + while (maxBits > bitlen) { 1.527 + buffer |= input.readUnsignedByte() << bitlen; 1.528 + bitlen += 8; 1.529 + } 1.530 + var code = codeTable.codes[buffer & (1 << maxBits) - 1]; 1.531 + var len = code >> 16; 1.532 + if (!len) { 1.533 + throwCompressedDataError(); 1.534 + } 1.535 + input.bitBuffer = buffer >>> len; 1.536 + input.bitLength = bitlen - len; 1.537 + return code & 65535; 1.538 + } 1.539 + function adler32(data, start, end) { 1.540 + var a = 1; 1.541 + var b = 0; 1.542 + for (var i = start; i < end; ++i) { 1.543 + a = (a + (data[i] & 255)) % 65521; 1.544 + b = (b + a) % 65521; 1.545 + } 1.546 + return b << 16 | a; 1.547 + } 1.548 + BAp.compress = function (algorithm) { 1.549 + this.position = 0; 1.550 + var output = new ByteArray(); 1.551 + switch (algorithm) { 1.552 + case 'zlib': 1.553 + output.writeUnsignedByte(120); 1.554 + output.writeUnsignedByte(156); 1.555 + case 'deflate': 1.556 + output.le = true; 1.557 + var len = this.length; 1.558 + output.ensureCapacity(len + Math.ceil(len / 65535) * 5 + 4); 1.559 + while (len > 65535) { 1.560 + output.writeUnsignedByte(0); 1.561 + output.writeUnsignedShort(65535); 1.562 + output.writeUnsignedShort(0); 1.563 + output.writeBytes(this, this.position, 65535); 1.564 + this.position += 65535; 1.565 + len -= 65535; 1.566 + } 1.567 + output.writeUnsignedByte(0); 1.568 + output.writeUnsignedShort(len); 1.569 + output.writeUnsignedShort(~len & 65535); 1.570 + output.writeBytes(this, this.position, len); 1.571 + if (algorithm === 'zlib') { 1.572 + output.writeUnsignedInt(adler32(this.uint8v, 0, this.length)); 1.573 + } 1.574 + break; 1.575 + default: 1.576 + return; 1.577 + } 1.578 + this.ensureCapacity(output.uint8v.length); 1.579 + this.uint8v.set(output.uint8v); 1.580 + this.length = output.length; 1.581 + this.position = 0; 1.582 + }; 1.583 + BAp.uncompress = function (algorithm) { 1.584 + var output = new ByteArray(); 1.585 + switch (algorithm) { 1.586 + case 'zlib': 1.587 + var header = this.readUnsignedShort(); 1.588 + if ((header & 3840) !== 2048 || header % 31 !== 0 || header & 32) { 1.589 + throwCompressedDataError(); 1.590 + } 1.591 + case 'deflate': 1.592 + var le = this.le; 1.593 + this.le = true; 1.594 + while (this.position < this.length - 6) { 1.595 + inflateBlock(this, output); 1.596 + } 1.597 + this.le = le; 1.598 + break; 1.599 + default: 1.600 + return; 1.601 + } 1.602 + this.ensureCapacity(output.uint8v.length); 1.603 + this.uint8v.set(output.uint8v); 1.604 + this.length = output.length; 1.605 + this.position = 0; 1.606 + }; 1.607 + return ByteArrayClass; 1.608 + }(); 1.609 +var Shumway; 1.610 +(function (Shumway) { 1.611 + (function (Options) { 1.612 + var Argument = function () { 1.613 + function Argument(shortName, longName, type, options) { 1.614 + this.shortName = shortName; 1.615 + this.longName = longName; 1.616 + this.type = type; 1.617 + options = options || {}; 1.618 + this.positional = options.positional; 1.619 + this.parseFn = options.parse; 1.620 + this.value = options.defaultValue; 1.621 + } 1.622 + Argument.prototype.parse = function (value) { 1.623 + if (this.type === 'boolean') { 1.624 + true; 1.625 + this.value = value; 1.626 + } else if (this.type === 'number') { 1.627 + true; 1.628 + this.value = parseInt(value, 10); 1.629 + } else { 1.630 + this.value = value; 1.631 + } 1.632 + if (this.parseFn) { 1.633 + this.parseFn(this.value); 1.634 + } 1.635 + }; 1.636 + return Argument; 1.637 + }(); 1.638 + Options.Argument = Argument; 1.639 + var ArgumentParser = function () { 1.640 + function ArgumentParser() { 1.641 + this.args = []; 1.642 + } 1.643 + ArgumentParser.prototype.addArgument = function (shortName, longName, type, options) { 1.644 + var argument = new Argument(shortName, longName, type, options); 1.645 + this.args.push(argument); 1.646 + return argument; 1.647 + }; 1.648 + ArgumentParser.prototype.addBoundOption = function (option) { 1.649 + var options = { 1.650 + parse: function (x) { 1.651 + option.value = x; 1.652 + } 1.653 + }; 1.654 + this.args.push(new Argument(option.shortName, option.longName, option.type, options)); 1.655 + }; 1.656 + ArgumentParser.prototype.addBoundOptionSet = function (optionSet) { 1.657 + var self = this; 1.658 + optionSet.options.forEach(function (x) { 1.659 + if (x instanceof OptionSet) { 1.660 + self.addBoundOptionSet(x); 1.661 + } else { 1.662 + true; 1.663 + self.addBoundOption(x); 1.664 + } 1.665 + }); 1.666 + }; 1.667 + ArgumentParser.prototype.getUsage = function () { 1.668 + var str = ''; 1.669 + this.args.forEach(function (x) { 1.670 + if (!x.positional) { 1.671 + str += '[-' + x.shortName + '|--' + x.longName + (x.type === 'boolean' ? '' : ' ' + x.type[0].toUpperCase()) + ']'; 1.672 + } else { 1.673 + str += x.longName; 1.674 + } 1.675 + str += ' '; 1.676 + }); 1.677 + return str; 1.678 + }; 1.679 + ArgumentParser.prototype.parse = function (args) { 1.680 + var nonPositionalArgumentMap = {}; 1.681 + var positionalArgumentList = []; 1.682 + this.args.forEach(function (x) { 1.683 + if (x.positional) { 1.684 + positionalArgumentList.push(x); 1.685 + } else { 1.686 + nonPositionalArgumentMap['-' + x.shortName] = x; 1.687 + nonPositionalArgumentMap['--' + x.longName] = x; 1.688 + } 1.689 + }); 1.690 + var leftoverArguments = []; 1.691 + while (args.length) { 1.692 + var argString = args.shift(); 1.693 + var argument = null, value = argString; 1.694 + if (argString == '--') { 1.695 + leftoverArguments = leftoverArguments.concat(args); 1.696 + break; 1.697 + } else if (argString.slice(0, 1) == '-' || argString.slice(0, 2) == '--') { 1.698 + argument = nonPositionalArgumentMap[argString]; 1.699 + true; 1.700 + if (!argument) { 1.701 + continue; 1.702 + } 1.703 + if (argument.type !== 'boolean') { 1.704 + value = args.shift(); 1.705 + true; 1.706 + } else { 1.707 + value = true; 1.708 + } 1.709 + } else if (positionalArgumentList.length) { 1.710 + argument = positionalArgumentList.shift(); 1.711 + } else { 1.712 + leftoverArguments.push(value); 1.713 + } 1.714 + if (argument) { 1.715 + argument.parse(value); 1.716 + } 1.717 + } 1.718 + true; 1.719 + return leftoverArguments; 1.720 + }; 1.721 + return ArgumentParser; 1.722 + }(); 1.723 + Options.ArgumentParser = ArgumentParser; 1.724 + var OptionSet = function () { 1.725 + function OptionSet(name) { 1.726 + this.name = name; 1.727 + this.options = []; 1.728 + } 1.729 + OptionSet.prototype.register = function (option) { 1.730 + this.options.push(option); 1.731 + return option; 1.732 + }; 1.733 + OptionSet.prototype.trace = function (writer) { 1.734 + writer.enter(this.name + ' {'); 1.735 + this.options.forEach(function (option) { 1.736 + option.trace(writer); 1.737 + }); 1.738 + writer.leave('}'); 1.739 + }; 1.740 + return OptionSet; 1.741 + }(); 1.742 + Options.OptionSet = OptionSet; 1.743 + var Option = function () { 1.744 + function Option(shortName, longName, type, defaultValue, description) { 1.745 + this.longName = longName; 1.746 + this.shortName = shortName; 1.747 + this.type = type; 1.748 + this.defaultValue = defaultValue; 1.749 + this.value = defaultValue; 1.750 + this.description = description; 1.751 + } 1.752 + Option.prototype.parse = function (value) { 1.753 + this.value = value; 1.754 + }; 1.755 + Option.prototype.trace = function (writer) { 1.756 + writer.writeLn(('-' + this.shortName + '|--' + this.longName).padRight(' ', 30) + ' = ' + this.type + ' ' + this.value + ' [' + this.defaultValue + ']' + ' (' + this.description + ')'); 1.757 + }; 1.758 + return Option; 1.759 + }(); 1.760 + Options.Option = Option; 1.761 + }(Shumway.Options || (Shumway.Options = {}))); 1.762 + var Options = Shumway.Options; 1.763 +}(Shumway || (Shumway = {}))); 1.764 +if (typeof exports !== 'undefined') { 1.765 + exports['Shumway'] = Shumway; 1.766 +} 1.767 +var ArgumentParser = Shumway.Options.ArgumentParser; 1.768 +var Option = Shumway.Options.Option; 1.769 +var OptionSet = Shumway.Options.OptionSet; 1.770 +var Option = Shumway.Options.Option; 1.771 +var OptionSet = Shumway.Options.OptionSet; 1.772 +var coreOptions = new OptionSet('Core Options'); 1.773 +var Timeline = function () { 1.774 + var barColor = 'rgba(255,255,255, 0.075)'; 1.775 + var backgroundColor = 'rgb(61, 61, 61)'; 1.776 + var backgroundColorInfo = 'rgba(0,0,0, 0.85)'; 1.777 + var fpsLineColor = 'rgb(255,64,0)'; 1.778 + var textColor = '#ccc'; 1.779 + function timeline(canvas) { 1.780 + this.depth = 0; 1.781 + this.start = 0; 1.782 + this.index = 0; 1.783 + this.marks = new Shumway.CircularBuffer(Int32Array); 1.784 + this.times = new Shumway.CircularBuffer(Float64Array); 1.785 + this.frameRate = 12; 1.786 + this.maxFrameTime = 1000 * 2 / this.frameRate; 1.787 + this.refreshFrequency = 10; 1.788 + this.refreshCounter = 0; 1.789 + this.count = 0; 1.790 + this.kinds = createEmptyObject(); 1.791 + this.kindCount = 0; 1.792 + this.canvas = canvas; 1.793 + this.context = canvas.getContext('2d', { 1.794 + original: true 1.795 + }); 1.796 + this.fillStyles = [ 1.797 + 'rgb(85, 152, 213)', 1.798 + '#bfd8a7', 1.799 + '#d906d7' 1.800 + ]; 1.801 + window.addEventListener('resize', this.resizeHandler.bind(this), false); 1.802 + this.resizeHandler(); 1.803 + } 1.804 + timeline.prototype.setFrameRate = function setFrameRate(frameRate) { 1.805 + this.frameRate = frameRate; 1.806 + this.maxFrameTime = 1000 * 2 / frameRate; 1.807 + }; 1.808 + timeline.prototype.refreshEvery = function refreshEvery(freq) { 1.809 + this.refreshFrequency = freq; 1.810 + this.refreshCounter = 0; 1.811 + }; 1.812 + var ENTER = 3203334144 | 0; 1.813 + var LEAVE = 3735879680 | 0; 1.814 + timeline.prototype.registerKind = function getKind(name, fillStyle) { 1.815 + if (this.kinds[name] === undefined) { 1.816 + this.fillStyles[this.kindCount] = fillStyle; 1.817 + this.kinds[name] = this.kindCount++; 1.818 + } else { 1.819 + this.fillStyles[this.kinds[name]] = fillStyle; 1.820 + } 1.821 + }; 1.822 + timeline.prototype.getKind = function getKind(name) { 1.823 + if (this.kinds[name] === undefined) { 1.824 + this.kinds[name] = this.kindCount++; 1.825 + if (this.kindCount > this.fillStyles.length) { 1.826 + this.fillStyles.push(randomStyle()); 1.827 + } 1.828 + } 1.829 + return this.kinds[name]; 1.830 + }; 1.831 + timeline.prototype.enter = function enter(name) { 1.832 + this.depth++; 1.833 + this.marks.write(ENTER | this.getKind(name)); 1.834 + this.times.write(performance.now()); 1.835 + }; 1.836 + timeline.prototype.leave = function leave(name) { 1.837 + this.marks.write(LEAVE | this.getKind(name)); 1.838 + this.times.write(performance.now()); 1.839 + this.depth--; 1.840 + if (this.depth === 0) { 1.841 + this.count++; 1.842 + if (++this.refreshCounter == this.refreshFrequency) { 1.843 + this.refreshCounter = 0; 1.844 + this.paint(); 1.845 + } 1.846 + } 1.847 + }; 1.848 + timeline.prototype.gatherFrames = function gatherFrames(maxFrames) { 1.849 + var stack = []; 1.850 + var frames = []; 1.851 + var times = this.times; 1.852 + maxFrames++; 1.853 + this.marks.forEachInReverse(function (mark, i) { 1.854 + var time = times.get(i); 1.855 + if ((mark & 4294901760) === ENTER) { 1.856 + var node = stack.pop(); 1.857 + node.startTime = time; 1.858 + if (!stack.length) { 1.859 + if (frames.length && !frames[0].total) { 1.860 + frames[0].total = frames[0].startTime - time; 1.861 + } 1.862 + frames.unshift(node); 1.863 + } else { 1.864 + var top = stack.top(); 1.865 + if (!top.children) { 1.866 + top.children = [ 1.867 + node 1.868 + ]; 1.869 + } else { 1.870 + top.children.push(node); 1.871 + } 1.872 + } 1.873 + } else if ((mark & 4294901760) === LEAVE) { 1.874 + if (frames.length > maxFrames) { 1.875 + return true; 1.876 + } 1.877 + stack.push({ 1.878 + kind: mark & 65535, 1.879 + endTime: time 1.880 + }); 1.881 + } 1.882 + }); 1.883 + return frames; 1.884 + }; 1.885 + timeline.prototype.resizeHandler = function resizeHandler(event) { 1.886 + var parent = this.canvas.parentElement; 1.887 + this.cw = parent.offsetWidth; 1.888 + this.ch = parent.offsetHeight - 1; 1.889 + var devicePixelRatio = window.devicePixelRatio || 1; 1.890 + var backingStoreRatio = this.context.webkitBackingStorePixelRatio || this.context.mozBackingStorePixelRatio || this.context.msBackingStorePixelRatio || this.context.oBackingStorePixelRatio || this.context.backingStorePixelRatio || 1; 1.891 + if (devicePixelRatio !== backingStoreRatio) { 1.892 + var ratio = devicePixelRatio / backingStoreRatio; 1.893 + this.canvas.width = this.cw * ratio; 1.894 + this.canvas.height = this.ch * ratio; 1.895 + this.canvas.style.width = this.cw + 'px'; 1.896 + this.canvas.style.height = this.ch + 'px'; 1.897 + this.context.scale(ratio, ratio); 1.898 + } else { 1.899 + this.canvas.width = this.cw; 1.900 + this.canvas.height = this.ch; 1.901 + } 1.902 + this.context.font = '10px Consolas, "Liberation Mono", Courier, monospace'; 1.903 + }; 1.904 + timeline.prototype.paint = function paint() { 1.905 + var w = 10; 1.906 + var gap = 1; 1.907 + var maxFrames = this.cw / (w + gap) | 0; 1.908 + var frames = this.gatherFrames(maxFrames); 1.909 + var context = this.context; 1.910 + var maxFrameTime = this.maxFrameTime; 1.911 + var fillStyles = this.fillStyles; 1.912 + context.clearRect(0, 0, this.cw, this.ch); 1.913 + var maxFrameRate = 0; 1.914 + var maxFrameRateCount = 0; 1.915 + var avgFrameRate = 0; 1.916 + var avgFrameRateCount = 0; 1.917 + var offsetW; 1.918 + context.save(); 1.919 + context.translate(0, this.ch); 1.920 + context.scale(1, -this.ch / maxFrameTime); 1.921 + for (var i = 0; i < frames.length - 1; i++) { 1.922 + var frame = frames[i]; 1.923 + maxFrameRate += frame.endTime - frame.startTime; 1.924 + maxFrameRateCount++; 1.925 + if (frame.total) { 1.926 + avgFrameRate += frame.total; 1.927 + avgFrameRateCount++; 1.928 + } 1.929 + offsetW = i * (w + gap); 1.930 + context.fillStyle = barColor; 1.931 + context.fillRect(offsetW, 0, w, frames[i + 1].startTime - frame.startTime); 1.932 + drawNode(frame, frame.startTime); 1.933 + } 1.934 + function drawNode(node, frameStartTime) { 1.935 + var nodeTime = node.endTime - node.startTime; 1.936 + var offsetH = node.startTime - frameStartTime; 1.937 + context.fillStyle = fillStyles[node.kind]; 1.938 + context.fillRect(offsetW, offsetH, w, nodeTime); 1.939 + if (node.children) { 1.940 + var children = node.children; 1.941 + for (var i = 0, n = children.length; i < n; i++) { 1.942 + drawNode(children[i], frameStartTime); 1.943 + } 1.944 + } 1.945 + } 1.946 + var lineH = 1000 / this.frameRate; 1.947 + context.beginPath(); 1.948 + context.lineWidth = 0.5; 1.949 + context.moveTo(0, lineH); 1.950 + context.lineTo(this.cw, lineH); 1.951 + context.strokeStyle = fpsLineColor; 1.952 + context.stroke(); 1.953 + context.restore(); 1.954 + context.fillStyle = backgroundColorInfo; 1.955 + context.fillRect(0, 0, this.cw, 20); 1.956 + var textOffset; 1.957 + var sFrameCount = this.count; 1.958 + var sMaxFrameRate = Math.round(1000 * maxFrameRateCount / maxFrameRate); 1.959 + var sAvgFrameRate = Math.round(1000 * avgFrameRateCount / avgFrameRate); 1.960 + var space = 5; 1.961 + textOffset = 5; 1.962 + context.fillStyle = textColor; 1.963 + context.fillText(sFrameCount, textOffset, 13); 1.964 + textOffset += context.measureText(sFrameCount).width + space; 1.965 + context.fillText(sMaxFrameRate, textOffset, 13); 1.966 + textOffset += context.measureText(sMaxFrameRate).width + space; 1.967 + context.fillText(sAvgFrameRate, textOffset, 13); 1.968 + var basicOffset = textOffset + context.measureText(sAvgFrameRate).width + space; 1.969 + textOffset = this.cw; 1.970 + for (var k in this.kinds) { 1.971 + context.fillStyle = this.fillStyles[this.getKind(k)]; 1.972 + textOffset -= context.measureText(k).width + space; 1.973 + if (textOffset > basicOffset) { 1.974 + this.context.fillText(k, textOffset, 13); 1.975 + } 1.976 + } 1.977 + }; 1.978 + return timeline; 1.979 + }(); 1.980 +var create = Object.create; 1.981 +var defineProperty = Object.defineProperty; 1.982 +var keys = Object.keys; 1.983 +var isArray = Array.isArray; 1.984 +var fromCharCode = String.fromCharCode; 1.985 +var logE = Math.log; 1.986 +var max = Math.max; 1.987 +var min = Math.min; 1.988 +var pow = Math.pow; 1.989 +var push = Array.prototype.push; 1.990 +var slice = Array.prototype.slice; 1.991 +var splice = Array.prototype.splice; 1.992 +function fail(msg, context) { 1.993 + throw new Error((context ? context + ': ' : '') + msg); 1.994 +} 1.995 +function assert(cond, msg, context) { 1.996 + if (!cond) 1.997 + fail(msg, context); 1.998 +} 1.999 +function scriptProperties(namespace, props) { 1.1000 + return props.reduce(function (o, p) { 1.1001 + o[p] = namespace + ' ' + p; 1.1002 + return o; 1.1003 + }, {}); 1.1004 +} 1.1005 +function cloneObject(obj) { 1.1006 + var clone = Object.create(null); 1.1007 + for (var prop in obj) 1.1008 + clone[prop] = obj[prop]; 1.1009 + return clone; 1.1010 +} 1.1011 +function sortNumeric(a, b) { 1.1012 + return a - b; 1.1013 +} 1.1014 +function sortByZindex(a, b) { 1.1015 + return a._zindex - b._zindex; 1.1016 +} 1.1017 +function rgbaObjToStr(color) { 1.1018 + return 'rgba(' + color.red + ',' + color.green + ',' + color.blue + ',' + color.alpha / 255 + ')'; 1.1019 +} 1.1020 +function rgbIntAlphaToStr(color, alpha) { 1.1021 + color |= 0; 1.1022 + if (alpha >= 1) { 1.1023 + var colorStr = color.toString(16); 1.1024 + while (colorStr.length < 6) { 1.1025 + colorStr = '0' + colorStr; 1.1026 + } 1.1027 + return '#' + colorStr; 1.1028 + } 1.1029 + var red = color >> 16 & 255; 1.1030 + var green = color >> 8 & 255; 1.1031 + var blue = color & 255; 1.1032 + return 'rgba(' + red + ',' + green + ',' + blue + ',' + alpha + ')'; 1.1033 +} 1.1034 +function argbUintToStr(argb) { 1.1035 + return 'rgba(' + (argb >>> 16 & 255) + ',' + (argb >>> 8 & 255) + ',' + (argb & 255) + ',' + (argb >>> 24 & 255) / 255 + ')'; 1.1036 +} 1.1037 +(function functionNameSupport() { 1.1038 + if (eval('function t() {} t.name === \'t\'')) { 1.1039 + return; 1.1040 + } 1.1041 + Object.defineProperty(Function.prototype, 'name', { 1.1042 + get: function () { 1.1043 + if (this.__name) { 1.1044 + return this.__name; 1.1045 + } 1.1046 + var m = /function\s([^\(]+)/.exec(this.toString()); 1.1047 + var name = m && m[1] !== 'anonymous' ? m[1] : null; 1.1048 + this.__name = name; 1.1049 + return name; 1.1050 + }, 1.1051 + configurable: true, 1.1052 + enumerable: false 1.1053 + }); 1.1054 +}()); 1.1055 +var randomStyleCache; 1.1056 +var nextStyle = 0; 1.1057 +function randomStyle() { 1.1058 + if (!randomStyleCache) { 1.1059 + randomStyleCache = [ 1.1060 + '#ff5e3a', 1.1061 + '#ff9500', 1.1062 + '#ffdb4c', 1.1063 + '#87fc70', 1.1064 + '#52edc7', 1.1065 + '#1ad6fd', 1.1066 + '#c644fc', 1.1067 + '#ef4db6', 1.1068 + '#4a4a4a', 1.1069 + '#dbddde', 1.1070 + '#ff3b30', 1.1071 + '#ff9500', 1.1072 + '#ffcc00', 1.1073 + '#4cd964', 1.1074 + '#34aadc', 1.1075 + '#007aff', 1.1076 + '#5856d6', 1.1077 + '#ff2d55', 1.1078 + '#8e8e93', 1.1079 + '#c7c7cc', 1.1080 + '#5ad427', 1.1081 + '#c86edf', 1.1082 + '#d1eefc', 1.1083 + '#e0f8d8', 1.1084 + '#fb2b69', 1.1085 + '#f7f7f7', 1.1086 + '#1d77ef', 1.1087 + '#d6cec3', 1.1088 + '#55efcb', 1.1089 + '#ff4981', 1.1090 + '#ffd3e0', 1.1091 + '#f7f7f7', 1.1092 + '#ff1300', 1.1093 + '#1f1f21', 1.1094 + '#bdbec2', 1.1095 + '#ff3a2d' 1.1096 + ]; 1.1097 + } 1.1098 + return randomStyleCache[nextStyle++ % randomStyleCache.length]; 1.1099 +} 1.1100 +(function PromiseClosure() { 1.1101 + var global = Function('return this')(); 1.1102 + if (global.Promise) { 1.1103 + if (typeof global.Promise.all !== 'function') { 1.1104 + global.Promise.all = function (iterable) { 1.1105 + var count = 0, results = [], resolve, reject; 1.1106 + var promise = new global.Promise(function (resolve_, reject_) { 1.1107 + resolve = resolve_; 1.1108 + reject = reject_; 1.1109 + }); 1.1110 + iterable.forEach(function (p, i) { 1.1111 + count++; 1.1112 + p.then(function (result) { 1.1113 + results[i] = result; 1.1114 + count--; 1.1115 + if (count === 0) { 1.1116 + resolve(results); 1.1117 + } 1.1118 + }, reject); 1.1119 + }); 1.1120 + if (count === 0) { 1.1121 + resolve(results); 1.1122 + } 1.1123 + return promise; 1.1124 + }; 1.1125 + } 1.1126 + if (typeof global.Promise.resolve !== 'function') { 1.1127 + global.Promise.resolve = function (x) { 1.1128 + return new global.Promise(function (resolve) { 1.1129 + resolve(x); 1.1130 + }); 1.1131 + }; 1.1132 + } 1.1133 + return; 1.1134 + } 1.1135 + function getDeferred(C) { 1.1136 + if (typeof C !== 'function') { 1.1137 + throw new TypeError('Invalid deferred constructor'); 1.1138 + } 1.1139 + var resolver = createDeferredConstructionFunctions(); 1.1140 + var promise = new C(resolver); 1.1141 + var resolve = resolver.resolve; 1.1142 + if (typeof resolve !== 'function') { 1.1143 + throw new TypeError('Invalid resolve construction function'); 1.1144 + } 1.1145 + var reject = resolver.reject; 1.1146 + if (typeof reject !== 'function') { 1.1147 + throw new TypeError('Invalid reject construction function'); 1.1148 + } 1.1149 + return { 1.1150 + promise: promise, 1.1151 + resolve: resolve, 1.1152 + reject: reject 1.1153 + }; 1.1154 + } 1.1155 + function updateDeferredFromPotentialThenable(x, deferred) { 1.1156 + if (typeof x !== 'object' || x === null) { 1.1157 + return false; 1.1158 + } 1.1159 + try { 1.1160 + var then = x.then; 1.1161 + if (typeof then !== 'function') { 1.1162 + return false; 1.1163 + } 1.1164 + var thenCallResult = then.call(x, deferred.resolve, deferred.reject); 1.1165 + } catch (e) { 1.1166 + var reject = deferred.reject; 1.1167 + reject(e); 1.1168 + } 1.1169 + return true; 1.1170 + } 1.1171 + function isPromise(x) { 1.1172 + return typeof x === 'object' && x !== null && typeof x.promiseStatus !== 'undefined'; 1.1173 + } 1.1174 + function rejectPromise(promise, reason) { 1.1175 + if (promise.promiseStatus !== 'unresolved') { 1.1176 + return; 1.1177 + } 1.1178 + var reactions = promise.rejectReactions; 1.1179 + promise.result = reason; 1.1180 + promise.resolveReactions = undefined; 1.1181 + promise.rejectReactions = undefined; 1.1182 + promise.promiseStatus = 'has-rejection'; 1.1183 + triggerPromiseReactions(reactions, reason); 1.1184 + } 1.1185 + function resolvePromise(promise, resolution) { 1.1186 + if (promise.promiseStatus !== 'unresolved') { 1.1187 + return; 1.1188 + } 1.1189 + var reactions = promise.resolveReactions; 1.1190 + promise.result = resolution; 1.1191 + promise.resolveReactions = undefined; 1.1192 + promise.rejectReactions = undefined; 1.1193 + promise.promiseStatus = 'has-resolution'; 1.1194 + triggerPromiseReactions(reactions, resolution); 1.1195 + } 1.1196 + function triggerPromiseReactions(reactions, argument) { 1.1197 + for (var i = 0; i < reactions.length; i++) { 1.1198 + queueMicrotask({ 1.1199 + reaction: reactions[i], 1.1200 + argument: argument 1.1201 + }); 1.1202 + } 1.1203 + } 1.1204 + function queueMicrotask(task) { 1.1205 + if (microtasksQueue.length === 0) { 1.1206 + setTimeout(handleMicrotasksQueue, 0); 1.1207 + } 1.1208 + microtasksQueue.push(task); 1.1209 + } 1.1210 + function executePromiseReaction(reaction, argument) { 1.1211 + var deferred = reaction.deferred; 1.1212 + var handler = reaction.handler; 1.1213 + var handlerResult, updateResult; 1.1214 + try { 1.1215 + handlerResult = handler(argument); 1.1216 + } catch (e) { 1.1217 + var reject = deferred.reject; 1.1218 + return reject(e); 1.1219 + } 1.1220 + if (handlerResult === deferred.promise) { 1.1221 + var reject = deferred.reject; 1.1222 + return reject(new TypeError('Self resolution')); 1.1223 + } 1.1224 + try { 1.1225 + updateResult = updateDeferredFromPotentialThenable(handlerResult, deferred); 1.1226 + if (!updateResult) { 1.1227 + var resolve = deferred.resolve; 1.1228 + return resolve(handlerResult); 1.1229 + } 1.1230 + } catch (e) { 1.1231 + var reject = deferred.reject; 1.1232 + return reject(e); 1.1233 + } 1.1234 + } 1.1235 + var microtasksQueue = []; 1.1236 + function handleMicrotasksQueue() { 1.1237 + while (microtasksQueue.length > 0) { 1.1238 + var task = microtasksQueue[0]; 1.1239 + try { 1.1240 + executePromiseReaction(task.reaction, task.argument); 1.1241 + } catch (e) { 1.1242 + if (typeof Promise.onerror === 'function') { 1.1243 + Promise.onerror(e); 1.1244 + } 1.1245 + } 1.1246 + microtasksQueue.shift(); 1.1247 + } 1.1248 + } 1.1249 + function throwerFunction(e) { 1.1250 + throw e; 1.1251 + } 1.1252 + function identityFunction(x) { 1.1253 + return x; 1.1254 + } 1.1255 + function createRejectPromiseFunction(promise) { 1.1256 + return function (reason) { 1.1257 + rejectPromise(promise, reason); 1.1258 + }; 1.1259 + } 1.1260 + function createResolvePromiseFunction(promise) { 1.1261 + return function (resolution) { 1.1262 + resolvePromise(promise, resolution); 1.1263 + }; 1.1264 + } 1.1265 + function createDeferredConstructionFunctions() { 1.1266 + var fn = function (resolve, reject) { 1.1267 + fn.resolve = resolve; 1.1268 + fn.reject = reject; 1.1269 + }; 1.1270 + return fn; 1.1271 + } 1.1272 + function createPromiseResolutionHandlerFunctions(promise, fulfillmentHandler, rejectionHandler) { 1.1273 + return function (x) { 1.1274 + if (x === promise) { 1.1275 + return rejectionHandler(new TypeError('Self resolution')); 1.1276 + } 1.1277 + var cstr = promise.promiseConstructor; 1.1278 + if (isPromise(x)) { 1.1279 + var xConstructor = x.promiseConstructor; 1.1280 + if (xConstructor === cstr) { 1.1281 + return x.then(fulfillmentHandler, rejectionHandler); 1.1282 + } 1.1283 + } 1.1284 + var deferred = getDeferred(cstr); 1.1285 + var updateResult = updateDeferredFromPotentialThenable(x, deferred); 1.1286 + if (updateResult) { 1.1287 + var deferredPromise = deferred.promise; 1.1288 + return deferredPromise.then(fulfillmentHandler, rejectionHandler); 1.1289 + } 1.1290 + return fulfillmentHandler(x); 1.1291 + }; 1.1292 + } 1.1293 + function createPromiseAllCountdownFunction(index, values, deferred, countdownHolder) { 1.1294 + return function (x) { 1.1295 + values[index] = x; 1.1296 + countdownHolder.countdown--; 1.1297 + if (countdownHolder.countdown === 0) { 1.1298 + deferred.resolve(values); 1.1299 + } 1.1300 + }; 1.1301 + } 1.1302 + function Promise(resolver) { 1.1303 + if (typeof resolver !== 'function') { 1.1304 + throw new TypeError('resolver is not a function'); 1.1305 + } 1.1306 + var promise = this; 1.1307 + if (typeof promise !== 'object') { 1.1308 + throw new TypeError('Promise to initialize is not an object'); 1.1309 + } 1.1310 + promise.promiseStatus = 'unresolved'; 1.1311 + promise.resolveReactions = []; 1.1312 + promise.rejectReactions = []; 1.1313 + promise.result = undefined; 1.1314 + var resolve = createResolvePromiseFunction(promise); 1.1315 + var reject = createRejectPromiseFunction(promise); 1.1316 + try { 1.1317 + var result = resolver(resolve, reject); 1.1318 + } catch (e) { 1.1319 + rejectPromise(promise, e); 1.1320 + } 1.1321 + promise.promiseConstructor = Promise; 1.1322 + return promise; 1.1323 + } 1.1324 + Promise.all = function (iterable) { 1.1325 + var deferred = getDeferred(this); 1.1326 + var values = []; 1.1327 + var countdownHolder = { 1.1328 + countdown: 0 1.1329 + }; 1.1330 + var index = 0; 1.1331 + iterable.forEach(function (nextValue) { 1.1332 + var nextPromise = this.cast(nextValue); 1.1333 + var fn = createPromiseAllCountdownFunction(index, values, deferred, countdownHolder); 1.1334 + nextPromise.then(fn, deferred.reject); 1.1335 + index++; 1.1336 + countdownHolder.countdown++; 1.1337 + }, this); 1.1338 + if (index === 0) { 1.1339 + deferred.resolve(values); 1.1340 + } 1.1341 + return deferred.promise; 1.1342 + }; 1.1343 + Promise.cast = function (x) { 1.1344 + if (isPromise(x)) { 1.1345 + return x; 1.1346 + } 1.1347 + var deferred = getDeferred(this); 1.1348 + deferred.resolve(x); 1.1349 + return deferred.promise; 1.1350 + }; 1.1351 + Promise.reject = function (r) { 1.1352 + var deferred = getDeferred(this); 1.1353 + var rejectResult = deferred.reject(r); 1.1354 + return deferred.promise; 1.1355 + }; 1.1356 + Promise.resolve = function (x) { 1.1357 + var deferred = getDeferred(this); 1.1358 + var rejectResult = deferred.resolve(x); 1.1359 + return deferred.promise; 1.1360 + }; 1.1361 + Promise.prototype = { 1.1362 + 'catch': function (onRejected) { 1.1363 + this.then(undefined, onRejected); 1.1364 + }, 1.1365 + then: function (onFulfilled, onRejected) { 1.1366 + var promise = this; 1.1367 + if (!isPromise(promise)) { 1.1368 + throw new TypeError('this is not a Promises'); 1.1369 + } 1.1370 + var cstr = promise.promiseConstructor; 1.1371 + var deferred = getDeferred(cstr); 1.1372 + var rejectionHandler = typeof onRejected === 'function' ? onRejected : throwerFunction; 1.1373 + var fulfillmentHandler = typeof onFulfilled === 'function' ? onFulfilled : identityFunction; 1.1374 + var resolutionHandler = createPromiseResolutionHandlerFunctions(promise, fulfillmentHandler, rejectionHandler); 1.1375 + var resolveReaction = { 1.1376 + deferred: deferred, 1.1377 + handler: resolutionHandler 1.1378 + }; 1.1379 + var rejectReaction = { 1.1380 + deferred: deferred, 1.1381 + handler: rejectionHandler 1.1382 + }; 1.1383 + switch (promise.promiseStatus) { 1.1384 + case 'unresolved': 1.1385 + promise.resolveReactions.push(resolveReaction); 1.1386 + promise.rejectReactions.push(rejectReaction); 1.1387 + break; 1.1388 + case 'has-resolution': 1.1389 + var resolution = promise.result; 1.1390 + queueMicrotask({ 1.1391 + reaction: resolveReaction, 1.1392 + argument: resolution 1.1393 + }); 1.1394 + break; 1.1395 + case 'has-rejection': 1.1396 + var rejection = promise.result; 1.1397 + queueMicrotask({ 1.1398 + reaction: rejectReaction, 1.1399 + argument: rejection 1.1400 + }); 1.1401 + break; 1.1402 + } 1.1403 + return deferred.promise; 1.1404 + } 1.1405 + }; 1.1406 + global.Promise = Promise; 1.1407 +}()); 1.1408 +var QuadTree = function (x, y, width, height, parent) { 1.1409 + this.x = x | 0; 1.1410 + this.y = y | 0; 1.1411 + this.width = width | 0; 1.1412 + this.height = height | 0; 1.1413 + if (parent) { 1.1414 + this.root = parent.root; 1.1415 + this.parent = parent; 1.1416 + this.level = parent.level + 1; 1.1417 + } else { 1.1418 + this.root = this; 1.1419 + this.parent = null; 1.1420 + this.level = 0; 1.1421 + } 1.1422 + this.reset(); 1.1423 +}; 1.1424 +QuadTree.prototype.reset = function () { 1.1425 + this.stuckObjects = null; 1.1426 + this.objects = null; 1.1427 + this.nodes = []; 1.1428 +}; 1.1429 +QuadTree.prototype._findIndex = function (xMin, xMax, yMin, yMax) { 1.1430 + var midX = this.x + (this.width / 2 | 0); 1.1431 + var midY = this.y + (this.height / 2 | 0); 1.1432 + var top = yMin < midY && yMax < midY; 1.1433 + var bottom = yMin > midY; 1.1434 + if (xMin < midX && xMax < midX) { 1.1435 + if (top) { 1.1436 + return 1; 1.1437 + } else if (bottom) { 1.1438 + return 2; 1.1439 + } 1.1440 + } else if (xMin > midX) { 1.1441 + if (top) { 1.1442 + return 0; 1.1443 + } else if (bottom) { 1.1444 + return 3; 1.1445 + } 1.1446 + } 1.1447 + return -1; 1.1448 +}; 1.1449 +QuadTree.prototype.insert = function (obj) { 1.1450 + var nodes = this.nodes; 1.1451 + if (nodes.length) { 1.1452 + var index = this._findIndex(obj.xMin, obj.xMax, obj.yMin, obj.yMax); 1.1453 + if (index > -1) { 1.1454 + nodes[index].insert(obj); 1.1455 + } else { 1.1456 + obj.prev = null; 1.1457 + if (this.stuckObjects) { 1.1458 + obj.next = this.stuckObjects; 1.1459 + this.stuckObjects.prev = obj; 1.1460 + } else { 1.1461 + obj.next = null; 1.1462 + } 1.1463 + this.stuckObjects = obj; 1.1464 + obj.parent = this; 1.1465 + } 1.1466 + return; 1.1467 + } 1.1468 + var numChildren = 1; 1.1469 + var item = this.objects; 1.1470 + if (!item) { 1.1471 + obj.prev = null; 1.1472 + obj.next = null; 1.1473 + this.objects = obj; 1.1474 + } else { 1.1475 + while (item.next) { 1.1476 + numChildren++; 1.1477 + item = item.next; 1.1478 + } 1.1479 + obj.prev = item; 1.1480 + obj.next = null; 1.1481 + item.next = obj; 1.1482 + } 1.1483 + if (numChildren > 4 && this.level < 10) { 1.1484 + this._subdivide(); 1.1485 + item = this.objects; 1.1486 + while (item) { 1.1487 + var next = item.next; 1.1488 + this.insert(item); 1.1489 + item = next; 1.1490 + } 1.1491 + this.objects = null; 1.1492 + return; 1.1493 + } 1.1494 + obj.parent = this; 1.1495 +}; 1.1496 +QuadTree.prototype.update = function (obj) { 1.1497 + var node = obj.parent; 1.1498 + if (node) { 1.1499 + if (obj.xMin >= node.x && obj.xMax <= node.x + node.width && obj.yMin >= node.y && obj.yMax <= node.y + node.height) { 1.1500 + if (node.nodes.length) { 1.1501 + var index = this._findIndex(obj.xMin, obj.xMax, obj.yMin, obj.yMax); 1.1502 + if (index > -1) { 1.1503 + node.remove(obj); 1.1504 + node = this.nodes[index]; 1.1505 + node.insert(obj); 1.1506 + } 1.1507 + } else { 1.1508 + node.remove(obj); 1.1509 + node.insert(obj); 1.1510 + } 1.1511 + return; 1.1512 + } 1.1513 + node.remove(obj); 1.1514 + } 1.1515 + this.root.insert(obj); 1.1516 +}; 1.1517 +QuadTree.prototype.remove = function (obj) { 1.1518 + var prev = obj.prev; 1.1519 + var next = obj.next; 1.1520 + if (prev) { 1.1521 + prev.next = next; 1.1522 + obj.prev = null; 1.1523 + } else { 1.1524 + var node = obj.parent; 1.1525 + if (node.objects === obj) { 1.1526 + node.objects = next; 1.1527 + } else if (node.stuckObjects === obj) { 1.1528 + node.stuckObjects = next; 1.1529 + } 1.1530 + } 1.1531 + if (next) { 1.1532 + next.prev = prev; 1.1533 + obj.next = null; 1.1534 + } 1.1535 + obj.parent = null; 1.1536 +}; 1.1537 +QuadTree.prototype.retrieve = function (xMin, xMax, yMin, yMax) { 1.1538 + var stack = []; 1.1539 + var out = []; 1.1540 + var node = this; 1.1541 + do { 1.1542 + if (node.nodes.length) { 1.1543 + var index = node._findIndex(xMin, xMax, yMin, yMax); 1.1544 + if (index > -1) { 1.1545 + stack.push(node.nodes[index]); 1.1546 + } else { 1.1547 + stack.push.apply(stack, node.nodes); 1.1548 + } 1.1549 + } 1.1550 + var item = node.objects; 1.1551 + for (var i = 0; i < 2; i++) { 1.1552 + while (item) { 1.1553 + if (!(item.xMin > xMax || item.xMax < xMin || item.yMin > yMax || item.yMax < yMin)) { 1.1554 + out.push(item); 1.1555 + } 1.1556 + item = item.next; 1.1557 + } 1.1558 + item = node.stuckObjects; 1.1559 + } 1.1560 + node = stack.pop(); 1.1561 + } while (node); 1.1562 + return out; 1.1563 +}; 1.1564 +QuadTree.prototype._subdivide = function () { 1.1565 + var halfWidth = this.width / 2 | 0; 1.1566 + var halfHeight = this.height / 2 | 0; 1.1567 + var midX = this.x + halfWidth; 1.1568 + var midY = this.y + halfHeight; 1.1569 + this.nodes[0] = new QuadTree(midX, this.y, halfWidth, halfHeight, this); 1.1570 + this.nodes[1] = new QuadTree(this.x, this.y, halfWidth, halfHeight, this); 1.1571 + this.nodes[2] = new QuadTree(this.x, midY, halfWidth, halfHeight, this); 1.1572 + this.nodes[3] = new QuadTree(midX, midY, halfWidth, halfHeight, this); 1.1573 +}; 1.1574 +var RegionCluster = function () { 1.1575 + this.regions = []; 1.1576 +}; 1.1577 +RegionCluster.prototype.reset = function () { 1.1578 + this.regions.length = 0; 1.1579 +}; 1.1580 +RegionCluster.prototype.insert = function (region) { 1.1581 + var regions = this.regions; 1.1582 + if (regions.length < 3) { 1.1583 + regions.push({ 1.1584 + xMin: region.xMin, 1.1585 + xMax: region.xMax, 1.1586 + yMin: region.yMin, 1.1587 + yMax: region.yMax 1.1588 + }); 1.1589 + return; 1.1590 + } 1.1591 + var a = region; 1.1592 + var b = regions[0]; 1.1593 + var c = regions[1]; 1.1594 + var d = regions[2]; 1.1595 + var ab = (max(a.xMax, b.xMax) - min(a.xMin, b.xMin)) * (max(a.yMax, b.yMax) - min(a.yMin, b.yMin)); 1.1596 + var rb = regions[0]; 1.1597 + var ac = (max(a.xMax, c.xMax) - min(a.xMin, c.xMin)) * (max(a.yMax, c.yMax) - min(a.yMin, c.yMin)); 1.1598 + var ad = (max(a.xMax, d.xMax) - min(a.xMin, d.xMin)) * (max(a.yMax, d.yMax) - min(a.yMin, d.yMin)); 1.1599 + if (ac < ab) { 1.1600 + ab = ac; 1.1601 + rb = c; 1.1602 + } 1.1603 + if (ad < ab) { 1.1604 + ab = ad; 1.1605 + rb = d; 1.1606 + } 1.1607 + var bc = (max(b.xMax, c.xMax) - min(b.xMin, c.xMin)) * (max(b.yMax, c.yMax) - min(b.yMin, c.yMin)); 1.1608 + var bd = (max(b.xMax, d.xMax) - min(b.xMin, d.xMin)) * (max(b.yMax, d.yMax) - min(b.yMin, d.yMin)); 1.1609 + var cd = (max(c.xMax, d.xMax) - min(c.xMin, d.xMin)) * (max(c.yMax, d.yMax) - min(c.yMin, d.yMin)); 1.1610 + if (ab < bc && ab < bd && ab < cd) { 1.1611 + if (a.xMin < rb.xMin) { 1.1612 + rb.xMin = a.xMin; 1.1613 + } 1.1614 + if (a.xMax > rb.xMax) { 1.1615 + rb.xMax = a.xMax; 1.1616 + } 1.1617 + if (a.yMin < rb.yMin) { 1.1618 + rb.yMin = a.yMin; 1.1619 + } 1.1620 + if (a.yMax > rb.yMax) { 1.1621 + rb.yMax = a.yMax; 1.1622 + } 1.1623 + return; 1.1624 + } 1.1625 + rb = regions[0]; 1.1626 + var rc = regions[1]; 1.1627 + if (bd < bc) { 1.1628 + bc = bd; 1.1629 + rc = regions[2]; 1.1630 + } 1.1631 + if (cd < bc) { 1.1632 + rb = regions[1]; 1.1633 + rc = regions[2]; 1.1634 + } 1.1635 + if (rc.xMin < rb.xMin) { 1.1636 + rb.xMin = rc.xMin; 1.1637 + } 1.1638 + if (rc.xMax > rb.xMax) { 1.1639 + rb.xMax = rc.xMax; 1.1640 + } 1.1641 + if (rc.yMin < rb.yMin) { 1.1642 + rb.yMin = rc.yMin; 1.1643 + } 1.1644 + if (rc.yMax > rb.yMax) { 1.1645 + rb.yMax = rc.yMax; 1.1646 + } 1.1647 + rc.xMin = a.xMin; 1.1648 + rc.xMax = a.xMax; 1.1649 + rc.yMin = a.yMin; 1.1650 + rc.yMax = a.yMax; 1.1651 +}; 1.1652 +RegionCluster.prototype.retrieve = function () { 1.1653 + return this.regions; 1.1654 +}; 1.1655 +var EXTERNAL_INTERFACE_FEATURE = 1; 1.1656 +var CLIPBOARD_FEATURE = 2; 1.1657 +var SHAREDOBJECT_FEATURE = 3; 1.1658 +var VIDEO_FEATURE = 4; 1.1659 +var SOUND_FEATURE = 5; 1.1660 +var NETCONNECTION_FEATURE = 6; 1.1661 +if (!this.performance) { 1.1662 + this.performance = {}; 1.1663 +} 1.1664 +if (!this.performance.now) { 1.1665 + this.performance.now = Date.now; 1.1666 +} 1.1667 +var SWF_TAG_CODE_CSM_TEXT_SETTINGS = 74; 1.1668 +var SWF_TAG_CODE_DEFINE_BINARY_DATA = 87; 1.1669 +var SWF_TAG_CODE_DEFINE_BITS = 6; 1.1670 +var SWF_TAG_CODE_DEFINE_BITS_JPEG2 = 21; 1.1671 +var SWF_TAG_CODE_DEFINE_BITS_JPEG3 = 35; 1.1672 +var SWF_TAG_CODE_DEFINE_BITS_JPEG4 = 90; 1.1673 +var SWF_TAG_CODE_DEFINE_BITS_LOSSLESS = 20; 1.1674 +var SWF_TAG_CODE_DEFINE_BITS_LOSSLESS2 = 36; 1.1675 +var SWF_TAG_CODE_DEFINE_BUTTON = 7; 1.1676 +var SWF_TAG_CODE_DEFINE_BUTTON2 = 34; 1.1677 +var SWF_TAG_CODE_DEFINE_BUTTON_CXFORM = 23; 1.1678 +var SWF_TAG_CODE_DEFINE_BUTTON_SOUND = 17; 1.1679 +var SWF_TAG_CODE_DEFINE_EDIT_TEXT = 37; 1.1680 +var SWF_TAG_CODE_DEFINE_FONT = 10; 1.1681 +var SWF_TAG_CODE_DEFINE_FONT2 = 48; 1.1682 +var SWF_TAG_CODE_DEFINE_FONT3 = 75; 1.1683 +var SWF_TAG_CODE_DEFINE_FONT4 = 91; 1.1684 +var SWF_TAG_CODE_DEFINE_FONT_ALIGN_ZONES = 73; 1.1685 +var SWF_TAG_CODE_DEFINE_FONT_INFO = 13; 1.1686 +var SWF_TAG_CODE_DEFINE_FONT_INFO2 = 62; 1.1687 +var SWF_TAG_CODE_DEFINE_FONT_NAME = 88; 1.1688 +var SWF_TAG_CODE_DEFINE_MORPH_SHAPE = 46; 1.1689 +var SWF_TAG_CODE_DEFINE_MORPH_SHAPE2 = 84; 1.1690 +var SWF_TAG_CODE_DEFINE_SCALING_GRID = 78; 1.1691 +var SWF_TAG_CODE_DEFINE_SCENE_AND_FRAME_LABEL_DATA = 86; 1.1692 +var SWF_TAG_CODE_DEFINE_SHAPE = 2; 1.1693 +var SWF_TAG_CODE_DEFINE_SHAPE2 = 22; 1.1694 +var SWF_TAG_CODE_DEFINE_SHAPE3 = 32; 1.1695 +var SWF_TAG_CODE_DEFINE_SHAPE4 = 83; 1.1696 +var SWF_TAG_CODE_DEFINE_SOUND = 14; 1.1697 +var SWF_TAG_CODE_DEFINE_SPRITE = 39; 1.1698 +var SWF_TAG_CODE_DEFINE_TEXT = 11; 1.1699 +var SWF_TAG_CODE_DEFINE_TEXT2 = 33; 1.1700 +var SWF_TAG_CODE_DEFINE_VIDEO_STREAM = 60; 1.1701 +var SWF_TAG_CODE_DO_ABC = 82; 1.1702 +var SWF_TAG_CODE_DO_ABC_ = 72; 1.1703 +var SWF_TAG_CODE_DO_ACTION = 12; 1.1704 +var SWF_TAG_CODE_DO_INIT_ACTION = 59; 1.1705 +var SWF_TAG_CODE_ENABLE_DEBUGGER = 58; 1.1706 +var SWF_TAG_CODE_ENABLE_DEBUGGER2 = 64; 1.1707 +var SWF_TAG_CODE_END = 0; 1.1708 +var SWF_TAG_CODE_EXPORT_ASSETS = 56; 1.1709 +var SWF_TAG_CODE_FILE_ATTRIBUTES = 69; 1.1710 +var SWF_TAG_CODE_FRAME_LABEL = 43; 1.1711 +var SWF_TAG_CODE_IMPORT_ASSETS = 57; 1.1712 +var SWF_TAG_CODE_IMPORT_ASSETS2 = 71; 1.1713 +var SWF_TAG_CODE_JPEG_TABLES = 8; 1.1714 +var SWF_TAG_CODE_METADATA = 77; 1.1715 +var SWF_TAG_CODE_PLACE_OBJECT = 4; 1.1716 +var SWF_TAG_CODE_PLACE_OBJECT2 = 26; 1.1717 +var SWF_TAG_CODE_PLACE_OBJECT3 = 70; 1.1718 +var SWF_TAG_CODE_PROTECT = 24; 1.1719 +var SWF_TAG_CODE_REMOVE_OBJECT = 5; 1.1720 +var SWF_TAG_CODE_REMOVE_OBJECT2 = 28; 1.1721 +var SWF_TAG_CODE_SCRIPT_LIMITS = 65; 1.1722 +var SWF_TAG_CODE_SET_BACKGROUND_COLOR = 9; 1.1723 +var SWF_TAG_CODE_SET_TAB_INDEX = 66; 1.1724 +var SWF_TAG_CODE_SHOW_FRAME = 1; 1.1725 +var SWF_TAG_CODE_SOUND_STREAM_BLOCK = 19; 1.1726 +var SWF_TAG_CODE_SOUND_STREAM_HEAD = 18; 1.1727 +var SWF_TAG_CODE_SOUND_STREAM_HEAD2 = 45; 1.1728 +var SWF_TAG_CODE_START_SOUND = 15; 1.1729 +var SWF_TAG_CODE_START_SOUND2 = 89; 1.1730 +var SWF_TAG_CODE_SYMBOL_CLASS = 76; 1.1731 +var SWF_TAG_CODE_VIDEO_FRAME = 61; 1.1732 +self.SWF = {}; 1.1733 +var codeLengthOrder = [ 1.1734 + 16, 1.1735 + 17, 1.1736 + 18, 1.1737 + 0, 1.1738 + 8, 1.1739 + 7, 1.1740 + 9, 1.1741 + 6, 1.1742 + 10, 1.1743 + 5, 1.1744 + 11, 1.1745 + 4, 1.1746 + 12, 1.1747 + 3, 1.1748 + 13, 1.1749 + 2, 1.1750 + 14, 1.1751 + 1, 1.1752 + 15 1.1753 + ]; 1.1754 +var distanceCodes = []; 1.1755 +var distanceExtraBits = []; 1.1756 +for (var i = 0, j = 0, code = 1; i < 30; ++i) { 1.1757 + distanceCodes[i] = code; 1.1758 + code += 1 << (distanceExtraBits[i] = ~(~((j += i > 2 ? 1 : 0) / 2))); 1.1759 +} 1.1760 +var bitLengths = []; 1.1761 +for (var i = 0; i < 32; ++i) 1.1762 + bitLengths[i] = 5; 1.1763 +var fixedDistanceTable = makeHuffmanTable(bitLengths); 1.1764 +var lengthCodes = []; 1.1765 +var lengthExtraBits = []; 1.1766 +for (var i = 0, j = 0, code = 3; i < 29; ++i) { 1.1767 + lengthCodes[i] = code - (i == 28 ? 1 : 0); 1.1768 + code += 1 << (lengthExtraBits[i] = ~(~((j += i > 4 ? 1 : 0) / 4 % 6))); 1.1769 +} 1.1770 +for (var i = 0; i < 288; ++i) 1.1771 + bitLengths[i] = i < 144 || i > 279 ? 8 : i < 256 ? 9 : 7; 1.1772 +var fixedLiteralTable = makeHuffmanTable(bitLengths); 1.1773 +function makeHuffmanTable(bitLengths) { 1.1774 + var maxBits = Math.max.apply(null, bitLengths); 1.1775 + var numLengths = bitLengths.length; 1.1776 + var size = 1 << maxBits; 1.1777 + var codes = new Uint32Array(size); 1.1778 + for (var code = 0, len = 1, skip = 2; len <= maxBits; code <<= 1, ++len, skip <<= 1) { 1.1779 + for (var val = 0; val < numLengths; ++val) { 1.1780 + if (bitLengths[val] === len) { 1.1781 + var lsb = 0; 1.1782 + for (var i = 0; i < len; ++i) 1.1783 + lsb = lsb * 2 + (code >> i & 1); 1.1784 + for (var i = lsb; i < size; i += skip) 1.1785 + codes[i] = len << 16 | val; 1.1786 + ++code; 1.1787 + } 1.1788 + } 1.1789 + } 1.1790 + return { 1.1791 + codes: codes, 1.1792 + maxBits: maxBits 1.1793 + }; 1.1794 +} 1.1795 +function verifyDeflateHeader(bytes) { 1.1796 + var header = bytes[0] << 8 | bytes[1]; 1.1797 +} 1.1798 +function createInflatedStream(bytes, outputLength) { 1.1799 + verifyDeflateHeader(bytes); 1.1800 + var stream = new Stream(bytes, 2); 1.1801 + var output = { 1.1802 + data: new Uint8Array(outputLength), 1.1803 + available: 0, 1.1804 + completed: false 1.1805 + }; 1.1806 + var state = { 1.1807 + header: null, 1.1808 + distanceTable: null, 1.1809 + literalTable: null, 1.1810 + sym: null, 1.1811 + len: null, 1.1812 + sym2: null 1.1813 + }; 1.1814 + do { 1.1815 + inflateBlock(stream, output, state); 1.1816 + } while (!output.completed && stream.pos < stream.end); 1.1817 + return new Stream(output.data, 0, output.available); 1.1818 +} 1.1819 +var InflateNoDataError = {}; 1.1820 +function inflateBlock(stream, output, state) { 1.1821 + var header = state.header !== null ? state.header : state.header = readBits(stream.bytes, stream, 3); 1.1822 + switch (header >> 1) { 1.1823 + case 0: 1.1824 + stream.align(); 1.1825 + var pos = stream.pos; 1.1826 + if (stream.end - pos < 4) { 1.1827 + throw InflateNoDataError; 1.1828 + } 1.1829 + var len = stream.getUint16(pos, true); 1.1830 + var nlen = stream.getUint16(pos + 2, true); 1.1831 + if (stream.end - pos < 4 + len) { 1.1832 + throw InflateNoDataError; 1.1833 + } 1.1834 + var begin = pos + 4; 1.1835 + var end = stream.pos = begin + len; 1.1836 + var sbytes = stream.bytes, dbytes = output.data; 1.1837 + dbytes.set(sbytes.subarray(begin, end), output.available); 1.1838 + output.available += len; 1.1839 + break; 1.1840 + case 1: 1.1841 + inflate(stream, output, fixedLiteralTable, fixedDistanceTable, state); 1.1842 + break; 1.1843 + case 2: 1.1844 + var distanceTable, literalTable; 1.1845 + if (state.distanceTable !== null) { 1.1846 + distanceTable = state.distanceTable; 1.1847 + literalTable = state.literalTable; 1.1848 + } else { 1.1849 + var sbytes = stream.bytes; 1.1850 + var savedBufferPos = stream.pos; 1.1851 + var savedBitBuffer = stream.bitBuffer; 1.1852 + var savedBitLength = stream.bitLength; 1.1853 + var bitLengths = []; 1.1854 + var numLiteralCodes, numDistanceCodes; 1.1855 + try { 1.1856 + numLiteralCodes = readBits(sbytes, stream, 5) + 257; 1.1857 + numDistanceCodes = readBits(sbytes, stream, 5) + 1; 1.1858 + var numCodes = numLiteralCodes + numDistanceCodes; 1.1859 + var numLengthCodes = readBits(sbytes, stream, 4) + 4; 1.1860 + for (var i = 0; i < 19; ++i) 1.1861 + bitLengths[codeLengthOrder[i]] = i < numLengthCodes ? readBits(sbytes, stream, 3) : 0; 1.1862 + var codeLengthTable = makeHuffmanTable(bitLengths); 1.1863 + bitLengths = []; 1.1864 + var i = 0; 1.1865 + var prev = 0; 1.1866 + while (i < numCodes) { 1.1867 + var j = 1; 1.1868 + var sym = readCode(sbytes, stream, codeLengthTable); 1.1869 + switch (sym) { 1.1870 + case 16: 1.1871 + j = readBits(sbytes, stream, 2) + 3; 1.1872 + sym = prev; 1.1873 + break; 1.1874 + case 17: 1.1875 + j = readBits(sbytes, stream, 3) + 3; 1.1876 + sym = 0; 1.1877 + break; 1.1878 + case 18: 1.1879 + j = readBits(sbytes, stream, 7) + 11; 1.1880 + sym = 0; 1.1881 + break; 1.1882 + default: 1.1883 + prev = sym; 1.1884 + } 1.1885 + while (j--) 1.1886 + bitLengths[i++] = sym; 1.1887 + } 1.1888 + } catch (e) { 1.1889 + stream.pos = savedBufferPos; 1.1890 + stream.bitBuffer = savedBitBuffer; 1.1891 + stream.bitLength = savedBitLength; 1.1892 + throw e; 1.1893 + } 1.1894 + distanceTable = state.distanceTable = makeHuffmanTable(bitLengths.splice(numLiteralCodes, numDistanceCodes)); 1.1895 + literalTable = state.literalTable = makeHuffmanTable(bitLengths); 1.1896 + } 1.1897 + inflate(stream, output, literalTable, distanceTable, state); 1.1898 + state.distanceTable = null; 1.1899 + state.literalTable = null; 1.1900 + break; 1.1901 + default: 1.1902 + fail('unknown block type', 'inflate'); 1.1903 + } 1.1904 + state.header = null; 1.1905 + output.completed = !(!(header & 1)); 1.1906 +} 1.1907 +function readBits(bytes, stream, size) { 1.1908 + var bitBuffer = stream.bitBuffer; 1.1909 + var bitLength = stream.bitLength; 1.1910 + if (size > bitLength) { 1.1911 + var pos = stream.pos; 1.1912 + var end = stream.end; 1.1913 + do { 1.1914 + if (pos >= end) { 1.1915 + stream.pos = pos; 1.1916 + stream.bitBuffer = bitBuffer; 1.1917 + stream.bitLength = bitLength; 1.1918 + throw InflateNoDataError; 1.1919 + } 1.1920 + bitBuffer |= bytes[pos++] << bitLength; 1.1921 + bitLength += 8; 1.1922 + } while (size > bitLength); 1.1923 + stream.pos = pos; 1.1924 + } 1.1925 + stream.bitBuffer = bitBuffer >>> size; 1.1926 + stream.bitLength = bitLength - size; 1.1927 + return bitBuffer & (1 << size) - 1; 1.1928 +} 1.1929 +function inflate(stream, output, literalTable, distanceTable, state) { 1.1930 + var pos = output.available; 1.1931 + var dbytes = output.data; 1.1932 + var sbytes = stream.bytes; 1.1933 + var sym = state.sym !== null ? state.sym : readCode(sbytes, stream, literalTable); 1.1934 + while (sym !== 256) { 1.1935 + if (sym < 256) { 1.1936 + dbytes[pos++] = sym; 1.1937 + } else { 1.1938 + state.sym = sym; 1.1939 + sym -= 257; 1.1940 + var len = state.len !== null ? state.len : state.len = lengthCodes[sym] + readBits(sbytes, stream, lengthExtraBits[sym]); 1.1941 + var sym2 = state.sym2 !== null ? state.sym2 : state.sym2 = readCode(sbytes, stream, distanceTable); 1.1942 + var distance = distanceCodes[sym2] + readBits(sbytes, stream, distanceExtraBits[sym2]); 1.1943 + var i = pos - distance; 1.1944 + while (len--) 1.1945 + dbytes[pos++] = dbytes[i++]; 1.1946 + state.sym2 = null; 1.1947 + state.len = null; 1.1948 + state.sym = null; 1.1949 + } 1.1950 + output.available = pos; 1.1951 + sym = readCode(sbytes, stream, literalTable); 1.1952 + } 1.1953 +} 1.1954 +function readCode(bytes, stream, codeTable) { 1.1955 + var bitBuffer = stream.bitBuffer; 1.1956 + var bitLength = stream.bitLength; 1.1957 + var maxBits = codeTable.maxBits; 1.1958 + if (maxBits > bitLength) { 1.1959 + var pos = stream.pos; 1.1960 + var end = stream.end; 1.1961 + do { 1.1962 + if (pos >= end) { 1.1963 + stream.pos = pos; 1.1964 + stream.bitBuffer = bitBuffer; 1.1965 + stream.bitLength = bitLength; 1.1966 + throw InflateNoDataError; 1.1967 + } 1.1968 + bitBuffer |= bytes[pos++] << bitLength; 1.1969 + bitLength += 8; 1.1970 + } while (maxBits > bitLength); 1.1971 + stream.pos = pos; 1.1972 + } 1.1973 + var code = codeTable.codes[bitBuffer & (1 << maxBits) - 1]; 1.1974 + var len = code >> 16; 1.1975 + stream.bitBuffer = bitBuffer >>> len; 1.1976 + stream.bitLength = bitLength - len; 1.1977 + return code & 65535; 1.1978 +} 1.1979 +var StreamNoDataError = {}; 1.1980 +var Stream = function StreamClosure() { 1.1981 + function Stream_align() { 1.1982 + this.bitBuffer = this.bitLength = 0; 1.1983 + } 1.1984 + function Stream_ensure(size) { 1.1985 + if (this.pos + size > this.end) { 1.1986 + throw StreamNoDataError; 1.1987 + } 1.1988 + } 1.1989 + function Stream_remaining() { 1.1990 + return this.end - this.pos; 1.1991 + } 1.1992 + function Stream_substream(begin, end) { 1.1993 + var stream = new Stream(this.bytes); 1.1994 + stream.pos = begin; 1.1995 + stream.end = end; 1.1996 + return stream; 1.1997 + } 1.1998 + function Stream_push(data) { 1.1999 + var bytes = this.bytes; 1.2000 + var newBytesLength = this.end + data.length; 1.2001 + if (newBytesLength > bytes.length) { 1.2002 + throw 'stream buffer overfow'; 1.2003 + } 1.2004 + bytes.set(data, this.end); 1.2005 + this.end = newBytesLength; 1.2006 + } 1.2007 + function Stream(buffer, offset, length, maxLength) { 1.2008 + if (offset === undefined) 1.2009 + offset = 0; 1.2010 + if (buffer.buffer instanceof ArrayBuffer) { 1.2011 + offset += buffer.byteOffset; 1.2012 + buffer = buffer.buffer; 1.2013 + } 1.2014 + if (length === undefined) 1.2015 + length = buffer.byteLength - offset; 1.2016 + if (maxLength === undefined) 1.2017 + maxLength = length; 1.2018 + var bytes = new Uint8Array(buffer, offset, maxLength); 1.2019 + var stream = new DataView(buffer, offset, maxLength); 1.2020 + stream.bytes = bytes; 1.2021 + stream.pos = 0; 1.2022 + stream.end = length; 1.2023 + stream.bitBuffer = 0; 1.2024 + stream.bitLength = 0; 1.2025 + stream.align = Stream_align; 1.2026 + stream.ensure = Stream_ensure; 1.2027 + stream.remaining = Stream_remaining; 1.2028 + stream.substream = Stream_substream; 1.2029 + stream.push = Stream_push; 1.2030 + return stream; 1.2031 + } 1.2032 + return Stream; 1.2033 + }(); 1.2034 +var FORMAT_COLORMAPPED = 3; 1.2035 +var FORMAT_15BPP = 4; 1.2036 +var FORMAT_24BPP = 5; 1.2037 +var FACTOR_5BBP = 255 / 31; 1.2038 +var crcTable = []; 1.2039 +for (var i = 0; i < 256; i++) { 1.2040 + var c = i; 1.2041 + for (var h = 0; h < 8; h++) { 1.2042 + if (c & 1) 1.2043 + c = 3988292384 ^ c >> 1 & 2147483647; 1.2044 + else 1.2045 + c = c >> 1 & 2147483647; 1.2046 + } 1.2047 + crcTable[i] = c; 1.2048 +} 1.2049 +function crc32(data, start, end) { 1.2050 + var crc = -1; 1.2051 + for (var i = start; i < end; i++) { 1.2052 + var a = (crc ^ data[i]) & 255; 1.2053 + var b = crcTable[a]; 1.2054 + crc = crc >>> 8 ^ b; 1.2055 + } 1.2056 + return crc ^ -1; 1.2057 +} 1.2058 +function createPngChunk(type, data) { 1.2059 + var chunk = new Uint8Array(12 + data.length); 1.2060 + var p = 0; 1.2061 + var len = data.length; 1.2062 + chunk[p] = len >> 24 & 255; 1.2063 + chunk[p + 1] = len >> 16 & 255; 1.2064 + chunk[p + 2] = len >> 8 & 255; 1.2065 + chunk[p + 3] = len & 255; 1.2066 + chunk[p + 4] = type.charCodeAt(0) & 255; 1.2067 + chunk[p + 5] = type.charCodeAt(1) & 255; 1.2068 + chunk[p + 6] = type.charCodeAt(2) & 255; 1.2069 + chunk[p + 7] = type.charCodeAt(3) & 255; 1.2070 + if (data instanceof Uint8Array) 1.2071 + chunk.set(data, 8); 1.2072 + p = 8 + len; 1.2073 + var crc = crc32(chunk, 4, p); 1.2074 + chunk[p] = crc >> 24 & 255; 1.2075 + chunk[p + 1] = crc >> 16 & 255; 1.2076 + chunk[p + 2] = crc >> 8 & 255; 1.2077 + chunk[p + 3] = crc & 255; 1.2078 + return chunk; 1.2079 +} 1.2080 +function adler32(data, start, end) { 1.2081 + var a = 1; 1.2082 + var b = 0; 1.2083 + for (var i = start; i < end; ++i) { 1.2084 + a = (a + (data[i] & 255)) % 65521; 1.2085 + b = (b + a) % 65521; 1.2086 + } 1.2087 + return b << 16 | a; 1.2088 +} 1.2089 +function defineBitmap(tag) { 1.2090 + var width = tag.width; 1.2091 + var height = tag.height; 1.2092 + var hasAlpha = tag.hasAlpha; 1.2093 + var plte = ''; 1.2094 + var trns = ''; 1.2095 + var literals; 1.2096 + var bmpData = tag.bmpData; 1.2097 + switch (tag.format) { 1.2098 + case FORMAT_COLORMAPPED: 1.2099 + var colorType = 3; 1.2100 + var bytesPerLine = width + 3 & ~3; 1.2101 + var colorTableSize = tag.colorTableSize + 1; 1.2102 + var paletteSize = colorTableSize * (tag.hasAlpha ? 4 : 3); 1.2103 + var datalen = paletteSize + bytesPerLine * height; 1.2104 + var stream = createInflatedStream(bmpData, datalen); 1.2105 + var bytes = stream.bytes; 1.2106 + var pos = 0; 1.2107 + stream.ensure(paletteSize); 1.2108 + if (hasAlpha) { 1.2109 + var palette = new Uint8Array(paletteSize / 4 * 3); 1.2110 + var pp = 0; 1.2111 + var alphaValues = new Uint8Array(paletteSize / 4); 1.2112 + var pa = 0; 1.2113 + while (pos < paletteSize) { 1.2114 + palette[pp++] = bytes[pos]; 1.2115 + palette[pp++] = bytes[pos + 1]; 1.2116 + palette[pp++] = bytes[pos + 2]; 1.2117 + alphaValues[pa++] = bytes[pos + 3]; 1.2118 + pos += 4; 1.2119 + } 1.2120 + plte = createPngChunk('PLTE', palette); 1.2121 + trns = createPngChunk('tRNS', alphaValues); 1.2122 + } else { 1.2123 + plte = createPngChunk('PLTE', bytes.subarray(pos, pos + paletteSize)); 1.2124 + pos += paletteSize; 1.2125 + } 1.2126 + literals = new Uint8Array(width * height + height); 1.2127 + var pl = 0; 1.2128 + while (pos < datalen) { 1.2129 + stream.ensure(bytesPerLine); 1.2130 + var begin = pos; 1.2131 + var end = begin + width; 1.2132 + pl++; 1.2133 + literals.set(bytes.subarray(begin, end), pl); 1.2134 + pl += end - begin; 1.2135 + stream.pos = pos += bytesPerLine; 1.2136 + } 1.2137 + break; 1.2138 + case FORMAT_15BPP: 1.2139 + var colorType = 2; 1.2140 + var bytesPerLine = width * 2 + 3 & ~3; 1.2141 + var stream = createInflatedStream(bmpData, bytesPerLine * height); 1.2142 + var pos = 0; 1.2143 + literals = new Uint8Array(width * height * 3 + height); 1.2144 + var pl = 0; 1.2145 + for (var y = 0; y < height; ++y) { 1.2146 + pl++; 1.2147 + stream.ensure(bytesPerLine); 1.2148 + for (var x = 0; x < width; ++x) { 1.2149 + var word = stream.getUint16(pos); 1.2150 + pos += 2; 1.2151 + literals[pl++] = 0 | FACTOR_5BBP * (word >> 10 & 31); 1.2152 + literals[pl++] = 0 | FACTOR_5BBP * (word >> 5 & 31); 1.2153 + literals[pl++] = 0 | FACTOR_5BBP * (word & 31); 1.2154 + } 1.2155 + stream.pos = pos += bytesPerLine; 1.2156 + } 1.2157 + break; 1.2158 + case FORMAT_24BPP: 1.2159 + var padding; 1.2160 + if (hasAlpha) { 1.2161 + var colorType = 6; 1.2162 + padding = 0; 1.2163 + literals = new Uint8Array(width * height * 4 + height); 1.2164 + } else { 1.2165 + var colorType = 2; 1.2166 + padding = 1; 1.2167 + literals = new Uint8Array(width * height * 3 + height); 1.2168 + } 1.2169 + var bytesPerLine = width * 4; 1.2170 + var stream = createInflatedStream(bmpData, bytesPerLine * height); 1.2171 + var bytes = stream.bytes; 1.2172 + var pos = 0; 1.2173 + var pl = 0; 1.2174 + for (var y = 0; y < height; ++y) { 1.2175 + stream.ensure(bytesPerLine); 1.2176 + pl++; 1.2177 + for (var x = 0; x < width; ++x) { 1.2178 + pos += padding; 1.2179 + if (hasAlpha) { 1.2180 + var alpha = bytes[pos]; 1.2181 + if (alpha) { 1.2182 + var opacity = alpha / 255; 1.2183 + literals[pl++] = 0 | bytes[pos + 1] / opacity; 1.2184 + literals[pl++] = 0 | bytes[pos + 2] / opacity; 1.2185 + literals[pl++] = 0 | bytes[pos + 3] / opacity; 1.2186 + literals[pl++] = alpha; 1.2187 + } else { 1.2188 + pl += 4; 1.2189 + } 1.2190 + } else { 1.2191 + literals[pl++] = bytes[pos]; 1.2192 + literals[pl++] = bytes[pos + 1]; 1.2193 + literals[pl++] = bytes[pos + 2]; 1.2194 + } 1.2195 + pos += 4 - padding; 1.2196 + } 1.2197 + stream.pos = pos; 1.2198 + } 1.2199 + break; 1.2200 + default: 1.2201 + fail('invalid format', 'bitmap'); 1.2202 + } 1.2203 + var ihdr = new Uint8Array([ 1.2204 + width >> 24 & 255, 1.2205 + width >> 16 & 255, 1.2206 + width >> 8 & 255, 1.2207 + width & 255, 1.2208 + height >> 24 & 255, 1.2209 + height >> 16 & 255, 1.2210 + height >> 8 & 255, 1.2211 + height & 255, 1.2212 + 8, 1.2213 + colorType, 1.2214 + 0, 1.2215 + 0, 1.2216 + 0 1.2217 + ]); 1.2218 + var len = literals.length; 1.2219 + var maxBlockLength = 65535; 1.2220 + var idat = new Uint8Array(2 + len + Math.ceil(len / maxBlockLength) * 5 + 4); 1.2221 + var pi = 0; 1.2222 + idat[pi++] = 120; 1.2223 + idat[pi++] = 156; 1.2224 + var pos = 0; 1.2225 + while (len > maxBlockLength) { 1.2226 + idat[pi++] = 0; 1.2227 + idat[pi++] = 255; 1.2228 + idat[pi++] = 255; 1.2229 + idat[pi++] = 0; 1.2230 + idat[pi++] = 0; 1.2231 + idat.set(literals.subarray(pos, pos + maxBlockLength), pi); 1.2232 + pi += maxBlockLength; 1.2233 + pos += maxBlockLength; 1.2234 + len -= maxBlockLength; 1.2235 + } 1.2236 + idat[pi++] = 1; 1.2237 + idat[pi++] = len & 255; 1.2238 + idat[pi++] = len >> 8 & 255; 1.2239 + idat[pi++] = ~len & 65535 & 255; 1.2240 + idat[pi++] = (~len & 65535) >> 8 & 255; 1.2241 + idat.set(literals.subarray(pos), pi); 1.2242 + pi += literals.length - pos; 1.2243 + var adler = adler32(literals, 0, literals.length); 1.2244 + idat[pi++] = adler >> 24 & 255; 1.2245 + idat[pi++] = adler >> 16 & 255; 1.2246 + idat[pi++] = adler >> 8 & 255; 1.2247 + idat[pi++] = adler & 255; 1.2248 + var chunks = [ 1.2249 + new Uint8Array([ 1.2250 + 137, 1.2251 + 80, 1.2252 + 78, 1.2253 + 71, 1.2254 + 13, 1.2255 + 10, 1.2256 + 26, 1.2257 + 10 1.2258 + ]), 1.2259 + createPngChunk('IHDR', ihdr), 1.2260 + plte, 1.2261 + trns, 1.2262 + createPngChunk('IDAT', idat), 1.2263 + createPngChunk('IEND', '') 1.2264 + ]; 1.2265 + return { 1.2266 + type: 'image', 1.2267 + id: tag.id, 1.2268 + width: width, 1.2269 + height: height, 1.2270 + mimeType: 'image/png', 1.2271 + data: new Blob(chunks, { 1.2272 + type: 'image/png' 1.2273 + }) 1.2274 + }; 1.2275 +} 1.2276 +function defineButton(tag, dictionary) { 1.2277 + var characters = tag.characters; 1.2278 + var states = { 1.2279 + up: {}, 1.2280 + over: {}, 1.2281 + down: {}, 1.2282 + hitTest: {} 1.2283 + }; 1.2284 + var i = 0, character; 1.2285 + while (character = characters[i++]) { 1.2286 + if (character.eob) 1.2287 + break; 1.2288 + var characterItem = dictionary[character.symbolId]; 1.2289 + var entry = { 1.2290 + symbolId: characterItem.id, 1.2291 + hasMatrix: !(!character.matrix), 1.2292 + matrix: character.matrix 1.2293 + }; 1.2294 + if (character.stateUp) 1.2295 + states.up[character.depth] = entry; 1.2296 + if (character.stateOver) 1.2297 + states.over[character.depth] = entry; 1.2298 + if (character.stateDown) 1.2299 + states.down[character.depth] = entry; 1.2300 + if (character.stateHitTest) 1.2301 + states.hitTest[character.depth] = entry; 1.2302 + } 1.2303 + var button = { 1.2304 + type: 'button', 1.2305 + id: tag.id, 1.2306 + buttonActions: tag.buttonActions, 1.2307 + states: states 1.2308 + }; 1.2309 + return button; 1.2310 +} 1.2311 +var nextFontId = 1; 1.2312 +function maxPower2(num) { 1.2313 + var maxPower = 0; 1.2314 + var val = num; 1.2315 + while (val >= 2) { 1.2316 + val /= 2; 1.2317 + ++maxPower; 1.2318 + } 1.2319 + return pow(2, maxPower); 1.2320 +} 1.2321 +function toString16(val) { 1.2322 + return fromCharCode(val >> 8 & 255, val & 255); 1.2323 +} 1.2324 +function toString32(val) { 1.2325 + return toString16(val >> 16) + toString16(val); 1.2326 +} 1.2327 +function defineFont(tag, dictionary) { 1.2328 + var tables = {}; 1.2329 + var codes = []; 1.2330 + var glyphIndex = {}; 1.2331 + var ranges = []; 1.2332 + var glyphs = tag.glyphs; 1.2333 + var glyphCount = glyphs.length; 1.2334 + if (tag.codes) { 1.2335 + codes = codes.concat(tag.codes); 1.2336 + for (var i = 0, code; code = codes[i]; ++i) 1.2337 + glyphIndex[code] = i; 1.2338 + codes.sort(function (a, b) { 1.2339 + return a - b; 1.2340 + }); 1.2341 + var i = 0; 1.2342 + var code; 1.2343 + while (code = codes[i++]) { 1.2344 + var start = code; 1.2345 + var end = start; 1.2346 + var indices = [ 1.2347 + i - 1 1.2348 + ]; 1.2349 + while ((code = codes[i]) && end + 1 === code) { 1.2350 + ++end; 1.2351 + indices.push(i); 1.2352 + ++i; 1.2353 + } 1.2354 + ranges.push([ 1.2355 + start, 1.2356 + end, 1.2357 + indices 1.2358 + ]); 1.2359 + } 1.2360 + } else { 1.2361 + var indices = []; 1.2362 + var UAC_OFFSET = 57344; 1.2363 + for (var i = 0; i < glyphCount; i++) { 1.2364 + var code = UAC_OFFSET + i; 1.2365 + codes.push(code); 1.2366 + glyphIndex[code] = i; 1.2367 + indices.push(i); 1.2368 + } 1.2369 + ranges.push([ 1.2370 + UAC_OFFSET, 1.2371 + UAC_OFFSET + glyphCount - 1, 1.2372 + indices 1.2373 + ]); 1.2374 + } 1.2375 + var resolution = tag.resolution || 1; 1.2376 + var ascent = Math.ceil(tag.ascent / resolution) || 1024; 1.2377 + var descent = -Math.ceil(tag.descent / resolution) | 0; 1.2378 + var leading = tag.leading / resolution | 0; 1.2379 + tables['OS/2'] = '\0\x01\0\0' + toString16(tag.bold ? 700 : 400) + '\0\x05' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0\0\0\0\0\0\0\0\0' + '\0\0\0\0' + '\0\0\0\0' + '\0\0\0\0' + '\0\0\0\0' + 'ALF ' + toString16((tag.italic ? 1 : 0) | (tag.bold ? 32 : 0)) + toString16(codes[0]) + toString16(codes[codes.length - 1]) + toString16(ascent) + toString16(descent) + toString16(leading) + toString16(ascent) + toString16(-descent) + '\0\0\0\0' + '\0\0\0\0'; 1.2380 + ; 1.2381 + var startCount = ''; 1.2382 + var endCount = ''; 1.2383 + var idDelta = ''; 1.2384 + var idRangeOffset = ''; 1.2385 + var i = 0; 1.2386 + var range; 1.2387 + while (range = ranges[i++]) { 1.2388 + var start = range[0]; 1.2389 + var end = range[1]; 1.2390 + var code = range[2][0]; 1.2391 + startCount += toString16(start); 1.2392 + endCount += toString16(end); 1.2393 + idDelta += toString16(code - start + 1 & 65535); 1.2394 + idRangeOffset += toString16(0); 1.2395 + } 1.2396 + endCount += '\xff\xff'; 1.2397 + startCount += '\xff\xff'; 1.2398 + idDelta += '\0\x01'; 1.2399 + idRangeOffset += '\0\0'; 1.2400 + var segCount = ranges.length + 1; 1.2401 + var searchRange = maxPower2(segCount) * 2; 1.2402 + var rangeShift = 2 * segCount - searchRange; 1.2403 + var format314 = '\0\0' + toString16(segCount * 2) + toString16(searchRange) + toString16(logE(segCount) / logE(2)) + toString16(rangeShift) + endCount + '\0\0' + startCount + idDelta + idRangeOffset; 1.2404 + ; 1.2405 + tables['cmap'] = '\0\0\0\x01\0\x03\0\x01\0\0\0\f\0\x04' + toString16(format314.length + 4) + format314; 1.2406 + ; 1.2407 + var glyf = '\0\x01\0\0\0\0\0\0\0\0\0\0\0\x001\0'; 1.2408 + var loca = '\0\0'; 1.2409 + var offset = 16; 1.2410 + var maxPoints = 0; 1.2411 + var xMins = []; 1.2412 + var xMaxs = []; 1.2413 + var yMins = []; 1.2414 + var yMaxs = []; 1.2415 + var maxContours = 0; 1.2416 + var i = 0; 1.2417 + var code; 1.2418 + while (code = codes[i++]) { 1.2419 + var glyph = glyphs[glyphIndex[code]]; 1.2420 + var records = glyph.records; 1.2421 + var numberOfContours = 1; 1.2422 + var endPoint = 0; 1.2423 + var endPtsOfContours = ''; 1.2424 + var flags = ''; 1.2425 + var xCoordinates = ''; 1.2426 + var yCoordinates = ''; 1.2427 + var x = 0; 1.2428 + var y = 0; 1.2429 + var xMin = 1024; 1.2430 + var xMax = -1024; 1.2431 + var yMin = 1024; 1.2432 + var yMax = -1024; 1.2433 + for (var j = 0, record; record = records[j]; ++j) { 1.2434 + if (record.type) { 1.2435 + if (record.isStraight) { 1.2436 + if (record.isGeneral) { 1.2437 + flags += '\x01'; 1.2438 + var dx = record.deltaX / resolution; 1.2439 + var dy = -record.deltaY / resolution; 1.2440 + xCoordinates += toString16(dx); 1.2441 + yCoordinates += toString16(dy); 1.2442 + x += dx; 1.2443 + y += dy; 1.2444 + } else if (record.isVertical) { 1.2445 + flags += '\x11'; 1.2446 + var dy = -record.deltaY / resolution; 1.2447 + yCoordinates += toString16(dy); 1.2448 + y += dy; 1.2449 + } else { 1.2450 + flags += '!'; 1.2451 + var dx = record.deltaX / resolution; 1.2452 + xCoordinates += toString16(dx); 1.2453 + x += dx; 1.2454 + } 1.2455 + } else { 1.2456 + flags += '\0'; 1.2457 + var cx = record.controlDeltaX / resolution; 1.2458 + var cy = -record.controlDeltaY / resolution; 1.2459 + xCoordinates += toString16(cx); 1.2460 + yCoordinates += toString16(cy); 1.2461 + flags += '\x01'; 1.2462 + var dx = record.anchorDeltaX / resolution; 1.2463 + var dy = -record.anchorDeltaY / resolution; 1.2464 + xCoordinates += toString16(dx); 1.2465 + yCoordinates += toString16(dy); 1.2466 + ++endPoint; 1.2467 + x += cx + dx; 1.2468 + y += cy + dy; 1.2469 + } 1.2470 + if (x < xMin) 1.2471 + xMin = x; 1.2472 + if (x > xMax) 1.2473 + xMax = x; 1.2474 + if (y < yMin) 1.2475 + yMin = y; 1.2476 + if (y > yMax) 1.2477 + yMax = y; 1.2478 + ++endPoint; 1.2479 + } else { 1.2480 + if (record.eos) 1.2481 + break; 1.2482 + if (record.move) { 1.2483 + if (endPoint) { 1.2484 + ++numberOfContours; 1.2485 + endPtsOfContours += toString16(endPoint - 1); 1.2486 + } 1.2487 + flags += '\x01'; 1.2488 + var moveX = record.moveX / resolution; 1.2489 + var moveY = -record.moveY / resolution; 1.2490 + var dx = moveX - x; 1.2491 + var dy = moveY - y; 1.2492 + xCoordinates += toString16(dx); 1.2493 + yCoordinates += toString16(dy); 1.2494 + x = moveX; 1.2495 + y = moveY; 1.2496 + if (endPoint > maxPoints) 1.2497 + maxPoints = endPoint; 1.2498 + if (x < xMin) 1.2499 + xMin = x; 1.2500 + if (x > xMax) 1.2501 + xMax = x; 1.2502 + if (y < yMin) 1.2503 + yMin = y; 1.2504 + if (y > yMax) 1.2505 + yMax = y; 1.2506 + ++endPoint; 1.2507 + } 1.2508 + } 1.2509 + } 1.2510 + endPtsOfContours += toString16((endPoint || 1) - 1); 1.2511 + if (!j) { 1.2512 + xMin = xMax = yMin = yMax = 0; 1.2513 + flags += '1'; 1.2514 + } 1.2515 + var entry = toString16(numberOfContours) + toString16(xMin) + toString16(yMin) + toString16(xMax) + toString16(yMax) + endPtsOfContours + '\0\0' + flags + xCoordinates + yCoordinates; 1.2516 + ; 1.2517 + if (entry.length & 1) 1.2518 + entry += '\0'; 1.2519 + glyf += entry; 1.2520 + loca += toString16(offset / 2); 1.2521 + offset += entry.length; 1.2522 + xMins.push(xMin); 1.2523 + xMaxs.push(xMax); 1.2524 + yMins.push(yMin); 1.2525 + yMaxs.push(yMax); 1.2526 + if (numberOfContours > maxContours) 1.2527 + maxContours = numberOfContours; 1.2528 + if (endPoint > maxPoints) 1.2529 + maxPoints = endPoint; 1.2530 + } 1.2531 + loca += toString16(offset / 2); 1.2532 + tables['glyf'] = glyf; 1.2533 + tables['head'] = '\0\x01\0\0\0\x01\0\0\0\0\0\0_\x0f<\xf5\0\v\x04\0\0\0\0\0' + toString32(Date.now()) + '\0\0\0\0' + toString32(Date.now()) + toString16(min.apply(null, xMins)) + toString16(min.apply(null, yMins)) + toString16(max.apply(null, xMaxs)) + toString16(max.apply(null, yMaxs)) + toString16((tag.italic ? 2 : 0) | (tag.bold ? 1 : 0)) + '\0\b' + '\0\x02' + '\0\0' + '\0\0'; 1.2534 + ; 1.2535 + var advance = tag.advance; 1.2536 + tables['hhea'] = '\0\x01\0\0' + toString16(ascent) + toString16(descent) + toString16(leading) + toString16(advance ? max.apply(null, advance) : 1024) + '\0\0' + '\0\0' + '\x03\xb8' + '\0\x01' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + toString16(glyphCount + 1); 1.2537 + ; 1.2538 + var hmtx = '\0\0\0\0'; 1.2539 + for (var i = 0; i < glyphCount; ++i) 1.2540 + hmtx += toString16(advance ? advance[i] / resolution : 1024) + '\0\0'; 1.2541 + tables['hmtx'] = hmtx; 1.2542 + if (tag.kerning) { 1.2543 + var kerning = tag.kerning; 1.2544 + var nPairs = kerning.length; 1.2545 + var searchRange = maxPower2(nPairs) * 2; 1.2546 + var kern = '\0\0\0\x01\0\0' + toString16(14 + nPairs * 6) + '\0\x01' + toString16(nPairs) + toString16(searchRange) + toString16(logE(nPairs) / logE(2)) + toString16(2 * nPairs - searchRange); 1.2547 + ; 1.2548 + var i = 0; 1.2549 + var record; 1.2550 + while (record = kerning[i++]) { 1.2551 + kern += toString16(glyphIndex[record.code1]) + toString16(glyphIndex[record.code2]) + toString16(record.adjustment); 1.2552 + ; 1.2553 + } 1.2554 + tables['kern'] = kern; 1.2555 + } 1.2556 + tables['loca'] = loca; 1.2557 + tables['maxp'] = '\0\x01\0\0' + toString16(glyphCount + 1) + toString16(maxPoints) + toString16(maxContours) + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0' + '\0\0'; 1.2558 + ; 1.2559 + var uniqueId = 'swf-font-' + nextFontId++; 1.2560 + var fontName = tag.name || uniqueId; 1.2561 + var psName = fontName.replace(/ /g, ''); 1.2562 + var strings = [ 1.2563 + tag.copyright || 'Original licence', 1.2564 + fontName, 1.2565 + 'Unknown', 1.2566 + uniqueId, 1.2567 + fontName, 1.2568 + '1.0', 1.2569 + psName, 1.2570 + 'Unknown', 1.2571 + 'Unknown', 1.2572 + 'Unknown' 1.2573 + ]; 1.2574 + var count = strings.length; 1.2575 + var name = '\0\0' + toString16(count) + toString16(count * 12 + 6); 1.2576 + var offset = 0; 1.2577 + var i = 0; 1.2578 + var str; 1.2579 + while (str = strings[i++]) { 1.2580 + name += '\0\x01\0\0\0\0' + toString16(i - 1) + toString16(str.length) + toString16(offset); 1.2581 + offset += str.length; 1.2582 + } 1.2583 + tables['name'] = name + strings.join(''); 1.2584 + tables['post'] = '\0\x03\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'; 1.2585 + ; 1.2586 + var names = keys(tables); 1.2587 + var numTables = names.length; 1.2588 + var header = '\0\x01\0\0' + toString16(numTables) + '\0\x80' + '\0\x03' + '\0 '; 1.2589 + ; 1.2590 + var data = ''; 1.2591 + var offset = numTables * 16 + header.length; 1.2592 + var i = 0; 1.2593 + var name; 1.2594 + while (name = names[i++]) { 1.2595 + var table = tables[name]; 1.2596 + var length = table.length; 1.2597 + header += name + '\0\0\0\0' + toString32(offset) + toString32(length); 1.2598 + ; 1.2599 + while (length & 3) { 1.2600 + table += '\0'; 1.2601 + ++length; 1.2602 + } 1.2603 + data += table; 1.2604 + while (offset & 3) 1.2605 + ++offset; 1.2606 + offset += length; 1.2607 + } 1.2608 + var otf = header + data; 1.2609 + var unitPerEm = 1024; 1.2610 + var metrics = { 1.2611 + ascent: ascent / unitPerEm, 1.2612 + descent: -descent / unitPerEm, 1.2613 + leading: leading / unitPerEm 1.2614 + }; 1.2615 + return { 1.2616 + type: 'font', 1.2617 + id: tag.id, 1.2618 + name: fontName, 1.2619 + uniqueName: psName + uniqueId, 1.2620 + codes: codes, 1.2621 + metrics: metrics, 1.2622 + bold: tag.bold === 1, 1.2623 + italic: tag.italic === 1, 1.2624 + data: otf 1.2625 + }; 1.2626 +} 1.2627 +function getUint16(buff, pos) { 1.2628 + return buff[pos] << 8 | buff[pos + 1]; 1.2629 +} 1.2630 +function parseJpegChunks(imgDef, bytes) { 1.2631 + var i = 0; 1.2632 + var n = bytes.length; 1.2633 + var chunks = []; 1.2634 + var code; 1.2635 + do { 1.2636 + var begin = i; 1.2637 + while (i < n && bytes[i] !== 255) 1.2638 + ++i; 1.2639 + while (i < n && bytes[i] === 255) 1.2640 + ++i; 1.2641 + code = bytes[i++]; 1.2642 + if (code === 218) { 1.2643 + i = n; 1.2644 + } else if (code === 217) { 1.2645 + i += 2; 1.2646 + continue; 1.2647 + } else if (code < 208 || code > 216) { 1.2648 + var length = getUint16(bytes, i); 1.2649 + if (code >= 192 && code <= 195) { 1.2650 + imgDef.height = getUint16(bytes, i + 3); 1.2651 + imgDef.width = getUint16(bytes, i + 5); 1.2652 + } 1.2653 + i += length; 1.2654 + } 1.2655 + chunks.push(bytes.subarray(begin, i)); 1.2656 + } while (i < n); 1.2657 + return chunks; 1.2658 +} 1.2659 +function defineImage(tag, dictionary) { 1.2660 + var img = { 1.2661 + type: 'image', 1.2662 + id: tag.id, 1.2663 + mimeType: tag.mimeType 1.2664 + }; 1.2665 + var imgData = tag.imgData; 1.2666 + var chunks; 1.2667 + if (tag.mimeType === 'image/jpeg') { 1.2668 + chunks = parseJpegChunks(img, imgData); 1.2669 + var alphaData = tag.alphaData; 1.2670 + if (alphaData) { 1.2671 + img.mask = createInflatedStream(alphaData, img.width * img.height).bytes; 1.2672 + } 1.2673 + if (tag.incomplete) { 1.2674 + var tables = dictionary[0]; 1.2675 + var header = tables.data; 1.2676 + if (header && header.size) { 1.2677 + chunks[0] = chunks[0].subarray(2); 1.2678 + chunks.unshift(header.slice(0, header.size - 2)); 1.2679 + } 1.2680 + } 1.2681 + } else { 1.2682 + chunks = [ 1.2683 + imgData 1.2684 + ]; 1.2685 + } 1.2686 + img.data = new Blob(chunks, { 1.2687 + type: tag.mimeType 1.2688 + }); 1.2689 + return img; 1.2690 +} 1.2691 +function defineLabel(tag, dictionary) { 1.2692 + var records = tag.records; 1.2693 + var m = tag.matrix; 1.2694 + var cmds = [ 1.2695 + 'c.save()', 1.2696 + 'c.transform(' + [ 1.2697 + m.a, 1.2698 + m.b, 1.2699 + m.c, 1.2700 + m.d, 1.2701 + m.tx / 20, 1.2702 + m.ty / 20 1.2703 + ].join(',') + ')', 1.2704 + 'c.scale(0.05, 0.05)' 1.2705 + ]; 1.2706 + var dependencies = []; 1.2707 + var x = 0; 1.2708 + var y = 0; 1.2709 + var i = 0; 1.2710 + var record; 1.2711 + var codes; 1.2712 + while (record = records[i++]) { 1.2713 + if (record.eot) 1.2714 + break; 1.2715 + if (record.hasFont) { 1.2716 + var font = dictionary[record.fontId]; 1.2717 + codes = font.codes; 1.2718 + cmds.push('c.font="' + record.fontHeight + 'px \'' + font.uniqueName + '\'"'); 1.2719 + dependencies.push(font.id); 1.2720 + } 1.2721 + if (record.hasColor) { 1.2722 + cmds.push('ct.setFillStyle(c,"' + rgbaObjToStr(record.color) + '")'); 1.2723 + cmds.push('ct.setAlpha(c)'); 1.2724 + } else { 1.2725 + cmds.push('ct.setAlpha(c,true)'); 1.2726 + } 1.2727 + if (record.hasMoveX) 1.2728 + x = record.moveX; 1.2729 + if (record.hasMoveY) 1.2730 + y = record.moveY; 1.2731 + var entries = record.entries; 1.2732 + var j = 0; 1.2733 + var entry; 1.2734 + while (entry = entries[j++]) { 1.2735 + var code = codes[entry.glyphIndex]; 1.2736 + var text = code >= 32 && code != 34 && code != 92 ? fromCharCode(code) : '\\u' + (code + 65536).toString(16).substring(1); 1.2737 + cmds.push('c.fillText("' + text + '",' + x + ',' + y + ')'); 1.2738 + x += entry.advance; 1.2739 + } 1.2740 + } 1.2741 + cmds.push('c.restore()'); 1.2742 + var label = { 1.2743 + type: 'label', 1.2744 + id: tag.id, 1.2745 + bbox: tag.bbox, 1.2746 + data: cmds.join('\n') 1.2747 + }; 1.2748 + if (dependencies.length) 1.2749 + label.require = dependencies; 1.2750 + return label; 1.2751 +} 1.2752 +var GRAPHICS_FILL_CLIPPED_BITMAP = 65; 1.2753 +var GRAPHICS_FILL_FOCAL_RADIAL_GRADIENT = 19; 1.2754 +var GRAPHICS_FILL_LINEAR_GRADIENT = 16; 1.2755 +var GRAPHICS_FILL_NONSMOOTHED_CLIPPED_BITMAP = 67; 1.2756 +var GRAPHICS_FILL_NONSMOOTHED_REPEATING_BITMAP = 66; 1.2757 +var GRAPHICS_FILL_RADIAL_GRADIENT = 18; 1.2758 +var GRAPHICS_FILL_REPEATING_BITMAP = 64; 1.2759 +var GRAPHICS_FILL_SOLID = 0; 1.2760 +function applySegmentToStyles(segment, styles, linePaths, fillPaths, isMorph) { 1.2761 + if (!segment) { 1.2762 + return; 1.2763 + } 1.2764 + var commands = segment.commands; 1.2765 + var data = segment.data; 1.2766 + var morphData = segment.morphData; 1.2767 + if (morphData) { 1.2768 + } 1.2769 + var path; 1.2770 + var targetSegment; 1.2771 + var command; 1.2772 + var i; 1.2773 + if (styles.fill0) { 1.2774 + path = fillPaths[styles.fill0 - 1]; 1.2775 + if (!(styles.fill1 || styles.line)) { 1.2776 + targetSegment = path.head(); 1.2777 + targetSegment.commands = []; 1.2778 + targetSegment.data = []; 1.2779 + targetSegment.morphData = isMorph ? [] : null; 1.2780 + } else { 1.2781 + targetSegment = path.addSegment([], [], isMorph ? [] : null); 1.2782 + } 1.2783 + var targetCommands = targetSegment.commands; 1.2784 + var targetData = targetSegment.data; 1.2785 + var targetMorphData = targetSegment.morphData; 1.2786 + targetCommands.push(SHAPE_MOVE_TO); 1.2787 + var j = data.length - 2; 1.2788 + targetData.push(data[j], data[j + 1]); 1.2789 + if (isMorph) { 1.2790 + targetMorphData.push(morphData[j], morphData[j + 1]); 1.2791 + } 1.2792 + for (i = commands.length; i-- > 1; j -= 2) { 1.2793 + command = commands[i]; 1.2794 + targetCommands.push(command); 1.2795 + targetData.push(data[j - 2], data[j - 1]); 1.2796 + if (isMorph) { 1.2797 + targetMorphData.push(morphData[j - 2], morphData[j - 1]); 1.2798 + } 1.2799 + if (command === SHAPE_CURVE_TO) { 1.2800 + targetData.push(data[j - 4], data[j - 3]); 1.2801 + if (isMorph) { 1.2802 + targetMorphData.push(morphData[j - 4], morphData[j - 3]); 1.2803 + } 1.2804 + j -= 2; 1.2805 + } 1.2806 + } 1.2807 + if (isMorph) { 1.2808 + } 1.2809 + } 1.2810 + if (styles.line && styles.fill1) { 1.2811 + path = linePaths[styles.line - 1]; 1.2812 + path.addSegment(commands, data, morphData); 1.2813 + } 1.2814 +} 1.2815 +function convertRecordsToStyledPaths(records, fillPaths, linePaths, dictionary, dependencies, recordsMorph, transferables) { 1.2816 + var isMorph = recordsMorph !== null; 1.2817 + var styles = { 1.2818 + fill0: 0, 1.2819 + fill1: 0, 1.2820 + line: 0 1.2821 + }; 1.2822 + var segment = null; 1.2823 + var allPaths; 1.2824 + var defaultPath; 1.2825 + var numRecords = records.length - 1; 1.2826 + var x = 0; 1.2827 + var y = 0; 1.2828 + var morphX = 0; 1.2829 + var morphY = 0; 1.2830 + var path; 1.2831 + for (var i = 0, j = 0; i < numRecords; i++) { 1.2832 + var record = records[i]; 1.2833 + var morphRecord; 1.2834 + if (isMorph) { 1.2835 + morphRecord = recordsMorph[j++]; 1.2836 + } 1.2837 + if (record.type === 0) { 1.2838 + if (segment) { 1.2839 + applySegmentToStyles(segment, styles, linePaths, fillPaths, isMorph); 1.2840 + } 1.2841 + if (record.hasNewStyles) { 1.2842 + if (!allPaths) { 1.2843 + allPaths = []; 1.2844 + } 1.2845 + push.apply(allPaths, fillPaths); 1.2846 + fillPaths = createPathsList(record.fillStyles, false, dictionary, dependencies); 1.2847 + push.apply(allPaths, linePaths); 1.2848 + linePaths = createPathsList(record.lineStyles, true, dictionary, dependencies); 1.2849 + if (defaultPath) { 1.2850 + allPaths.push(defaultPath); 1.2851 + defaultPath = null; 1.2852 + } 1.2853 + styles = { 1.2854 + fill0: 0, 1.2855 + fill1: 0, 1.2856 + line: 0 1.2857 + }; 1.2858 + } 1.2859 + if (record.hasFillStyle0) { 1.2860 + styles.fill0 = record.fillStyle0; 1.2861 + } 1.2862 + if (record.hasFillStyle1) { 1.2863 + styles.fill1 = record.fillStyle1; 1.2864 + } 1.2865 + if (record.hasLineStyle) { 1.2866 + styles.line = record.lineStyle; 1.2867 + } 1.2868 + if (styles.fill1) { 1.2869 + path = fillPaths[styles.fill1 - 1]; 1.2870 + } else if (styles.line) { 1.2871 + path = linePaths[styles.line - 1]; 1.2872 + } else if (styles.fill0) { 1.2873 + path = fillPaths[styles.fill0 - 1]; 1.2874 + } 1.2875 + if (record.move) { 1.2876 + x = record.moveX | 0; 1.2877 + y = record.moveY | 0; 1.2878 + } 1.2879 + if (path) { 1.2880 + segment = path.addSegment([], [], isMorph ? [] : null); 1.2881 + segment.commands.push(SHAPE_MOVE_TO); 1.2882 + segment.data.push(x, y); 1.2883 + if (isMorph) { 1.2884 + if (morphRecord.type === 0) { 1.2885 + morphX = morphRecord.moveX | 0; 1.2886 + morphY = morphRecord.moveY | 0; 1.2887 + } else { 1.2888 + morphX = x; 1.2889 + morphY = y; 1.2890 + j--; 1.2891 + } 1.2892 + segment.morphData.push(morphX, morphY); 1.2893 + } 1.2894 + } 1.2895 + } else { 1.2896 + if (!segment) { 1.2897 + if (!defaultPath) { 1.2898 + var style = { 1.2899 + color: { 1.2900 + red: 0, 1.2901 + green: 0, 1.2902 + blue: 0, 1.2903 + alpha: 255 1.2904 + }, 1.2905 + width: 20 1.2906 + }; 1.2907 + defaultPath = new SegmentedPath(null, processStyle(style, true)); 1.2908 + } 1.2909 + segment = defaultPath.addSegment([], [], isMorph ? [] : null); 1.2910 + segment.commands.push(SHAPE_MOVE_TO); 1.2911 + segment.data.push(x, y); 1.2912 + if (isMorph) { 1.2913 + segment.morphData.push(morphX, morphY); 1.2914 + } 1.2915 + } 1.2916 + if (isMorph) { 1.2917 + while (morphRecord && morphRecord.type === 0) { 1.2918 + morphRecord = recordsMorph[j++]; 1.2919 + } 1.2920 + if (!morphRecord) { 1.2921 + morphRecord = record; 1.2922 + } 1.2923 + } 1.2924 + if (record.isStraight && (!isMorph || morphRecord.isStraight)) { 1.2925 + x += record.deltaX | 0; 1.2926 + y += record.deltaY | 0; 1.2927 + segment.commands.push(SHAPE_LINE_TO); 1.2928 + segment.data.push(x, y); 1.2929 + if (isMorph) { 1.2930 + morphX += morphRecord.deltaX | 0; 1.2931 + morphY += morphRecord.deltaY | 0; 1.2932 + segment.morphData.push(morphX, morphY); 1.2933 + } 1.2934 + } else { 1.2935 + var cx, cy; 1.2936 + var deltaX, deltaY; 1.2937 + if (!record.isStraight) { 1.2938 + cx = x + record.controlDeltaX | 0; 1.2939 + cy = y + record.controlDeltaY | 0; 1.2940 + x = cx + record.anchorDeltaX | 0; 1.2941 + y = cy + record.anchorDeltaY | 0; 1.2942 + } else { 1.2943 + deltaX = record.deltaX | 0; 1.2944 + deltaY = record.deltaY | 0; 1.2945 + cx = x + (deltaX >> 1); 1.2946 + cy = y + (deltaY >> 1); 1.2947 + x += deltaX; 1.2948 + y += deltaY; 1.2949 + } 1.2950 + segment.commands.push(SHAPE_CURVE_TO); 1.2951 + segment.data.push(cx, cy, x, y); 1.2952 + if (isMorph) { 1.2953 + if (!morphRecord.isStraight) { 1.2954 + cx = morphX + morphRecord.controlDeltaX | 0; 1.2955 + cy = morphY + morphRecord.controlDeltaY | 0; 1.2956 + morphX = cx + morphRecord.anchorDeltaX | 0; 1.2957 + morphY = cy + morphRecord.anchorDeltaY | 0; 1.2958 + } else { 1.2959 + deltaX = morphRecord.deltaX | 0; 1.2960 + deltaY = morphRecord.deltaY | 0; 1.2961 + cx = morphX + (deltaX >> 1); 1.2962 + cy = morphY + (deltaY >> 1); 1.2963 + morphX += deltaX; 1.2964 + morphY += deltaY; 1.2965 + } 1.2966 + segment.morphData.push(cx, cy, morphX, morphY); 1.2967 + } 1.2968 + } 1.2969 + } 1.2970 + } 1.2971 + applySegmentToStyles(segment, styles, linePaths, fillPaths, isMorph); 1.2972 + if (allPaths) { 1.2973 + push.apply(allPaths, fillPaths); 1.2974 + } else { 1.2975 + allPaths = fillPaths; 1.2976 + } 1.2977 + push.apply(allPaths, linePaths); 1.2978 + if (defaultPath) { 1.2979 + allPaths.push(defaultPath); 1.2980 + } 1.2981 + var removeCount = 0; 1.2982 + for (i = 0; i < allPaths.length; i++) { 1.2983 + path = allPaths[i]; 1.2984 + if (!path.head()) { 1.2985 + removeCount++; 1.2986 + continue; 1.2987 + } 1.2988 + allPaths[i - removeCount] = segmentedPathToShapePath(path, isMorph, transferables); 1.2989 + } 1.2990 + allPaths.length -= removeCount; 1.2991 + return allPaths; 1.2992 +} 1.2993 +function segmentedPathToShapePath(path, isMorph, transferables) { 1.2994 + var start = path.head(); 1.2995 + var end = start; 1.2996 + var finalRoot = null; 1.2997 + var finalHead = null; 1.2998 + var skippedMoves = 0; 1.2999 + var current = start.prev; 1.3000 + while (start) { 1.3001 + while (current) { 1.3002 + if (path.segmentsConnect(current, start)) { 1.3003 + if (current.next !== start) { 1.3004 + path.removeSegment(current); 1.3005 + path.insertSegment(current, start); 1.3006 + } 1.3007 + start = current; 1.3008 + current = start.prev; 1.3009 + skippedMoves++; 1.3010 + continue; 1.3011 + } 1.3012 + if (path.segmentsConnect(end, current)) { 1.3013 + path.removeSegment(current); 1.3014 + end.next = current; 1.3015 + current = current.prev; 1.3016 + end.next.prev = end; 1.3017 + end.next.next = null; 1.3018 + end = end.next; 1.3019 + skippedMoves++; 1.3020 + continue; 1.3021 + } 1.3022 + current = current.prev; 1.3023 + } 1.3024 + current = start.prev; 1.3025 + if (!finalRoot) { 1.3026 + finalRoot = start; 1.3027 + finalHead = end; 1.3028 + } else { 1.3029 + finalHead.next = start; 1.3030 + start.prev = finalHead; 1.3031 + finalHead = end; 1.3032 + finalHead.next = null; 1.3033 + } 1.3034 + if (!current) { 1.3035 + break; 1.3036 + } 1.3037 + start = end = current; 1.3038 + current = start.prev; 1.3039 + } 1.3040 + var totalCommandsLength = -skippedMoves; 1.3041 + var totalDataLength = -skippedMoves << 1; 1.3042 + current = finalRoot; 1.3043 + while (current) { 1.3044 + totalCommandsLength += current.commands.length; 1.3045 + totalDataLength += current.data.length; 1.3046 + current = current.next; 1.3047 + } 1.3048 + var shape = new ShapePath(path.fillStyle, path.lineStyle, totalCommandsLength, totalDataLength, isMorph, transferables); 1.3049 + var allCommands = shape.commands; 1.3050 + var allData = shape.data; 1.3051 + var allMorphData = shape.morphData; 1.3052 + var commandsIndex = 0; 1.3053 + var dataIndex = 0; 1.3054 + current = finalRoot; 1.3055 + while (current) { 1.3056 + var commands = current.commands; 1.3057 + var data = current.data; 1.3058 + var morphData = current.morphData; 1.3059 + var offset = +(data[0] === allData[dataIndex - 2] && data[1] === allData[dataIndex - 1]); 1.3060 + for (var i = offset; i < commands.length; i++, commandsIndex++) { 1.3061 + allCommands[commandsIndex] = commands[i]; 1.3062 + } 1.3063 + for (i = offset << 1; i < data.length; i++, dataIndex++) { 1.3064 + allData[dataIndex] = data[i]; 1.3065 + if (isMorph) { 1.3066 + allMorphData[dataIndex] = morphData[i]; 1.3067 + } 1.3068 + } 1.3069 + current = current.next; 1.3070 + } 1.3071 + return shape; 1.3072 +} 1.3073 +var CAPS_STYLE_TYPES = [ 1.3074 + 'round', 1.3075 + 'none', 1.3076 + 'square' 1.3077 + ]; 1.3078 +var JOIN_STYLE_TYPES = [ 1.3079 + 'round', 1.3080 + 'bevel', 1.3081 + 'miter' 1.3082 + ]; 1.3083 +function processStyle(style, isLineStyle, dictionary, dependencies) { 1.3084 + if (isLineStyle) { 1.3085 + style.lineCap = CAPS_STYLE_TYPES[style.endCapStyle | 0]; 1.3086 + style.lineJoin = JOIN_STYLE_TYPES[style.joinStyle | 0]; 1.3087 + style.miterLimit = (style.miterLimitFactor || 1.5) * 2; 1.3088 + if (!style.color && style.hasFill) { 1.3089 + var fillStyle = processStyle(style.fillStyle, false, dictionary, dependencies); 1.3090 + style.style = fillStyle.style; 1.3091 + style.type = fillStyle.type; 1.3092 + style.transform = fillStyle.transform; 1.3093 + style.records = fillStyle.records; 1.3094 + style.focalPoint = fillStyle.focalPoint; 1.3095 + style.bitmapId = fillStyle.bitmapId; 1.3096 + style.repeat = fillStyle.repeat; 1.3097 + style.fillStyle = null; 1.3098 + return style; 1.3099 + } 1.3100 + } 1.3101 + var color; 1.3102 + if (style.type === undefined || style.type === GRAPHICS_FILL_SOLID) { 1.3103 + color = style.color; 1.3104 + style.style = 'rgba(' + color.red + ',' + color.green + ',' + color.blue + ',' + color.alpha / 255 + ')'; 1.3105 + style.color = null; 1.3106 + return style; 1.3107 + } 1.3108 + var scale; 1.3109 + switch (style.type) { 1.3110 + case GRAPHICS_FILL_LINEAR_GRADIENT: 1.3111 + case GRAPHICS_FILL_RADIAL_GRADIENT: 1.3112 + case GRAPHICS_FILL_FOCAL_RADIAL_GRADIENT: 1.3113 + scale = 819.2; 1.3114 + break; 1.3115 + case GRAPHICS_FILL_REPEATING_BITMAP: 1.3116 + case GRAPHICS_FILL_CLIPPED_BITMAP: 1.3117 + case GRAPHICS_FILL_NONSMOOTHED_REPEATING_BITMAP: 1.3118 + case GRAPHICS_FILL_NONSMOOTHED_CLIPPED_BITMAP: 1.3119 + if (dictionary[style.bitmapId]) { 1.3120 + dependencies.push(dictionary[style.bitmapId].id); 1.3121 + scale = 0.05; 1.3122 + } 1.3123 + break; 1.3124 + default: 1.3125 + fail('invalid fill style', 'shape'); 1.3126 + } 1.3127 + if (!style.matrix) { 1.3128 + return style; 1.3129 + } 1.3130 + var matrix = style.matrix; 1.3131 + style.transform = { 1.3132 + a: matrix.a * scale, 1.3133 + b: matrix.b * scale, 1.3134 + c: matrix.c * scale, 1.3135 + d: matrix.d * scale, 1.3136 + e: matrix.tx, 1.3137 + f: matrix.ty 1.3138 + }; 1.3139 + style.matrix = null; 1.3140 + return style; 1.3141 +} 1.3142 +function createPathsList(styles, isLineStyle, dictionary, dependencies) { 1.3143 + var paths = []; 1.3144 + for (var i = 0; i < styles.length; i++) { 1.3145 + var style = processStyle(styles[i], isLineStyle, dictionary, dependencies); 1.3146 + if (!isLineStyle) { 1.3147 + paths[i] = new SegmentedPath(style, null); 1.3148 + } else { 1.3149 + paths[i] = new SegmentedPath(null, style); 1.3150 + } 1.3151 + } 1.3152 + return paths; 1.3153 +} 1.3154 +function defineShape(tag, dictionary) { 1.3155 + var dependencies = []; 1.3156 + var transferables = []; 1.3157 + var fillPaths = createPathsList(tag.fillStyles, false, dictionary, dependencies); 1.3158 + var linePaths = createPathsList(tag.lineStyles, true, dictionary, dependencies); 1.3159 + var paths = convertRecordsToStyledPaths(tag.records, fillPaths, linePaths, dictionary, dependencies, tag.recordsMorph || null, transferables); 1.3160 + if (tag.bboxMorph) { 1.3161 + var mbox = tag.bboxMorph; 1.3162 + extendBoundsByPoint(tag.bbox, mbox.xMin, mbox.yMin); 1.3163 + extendBoundsByPoint(tag.bbox, mbox.xMax, mbox.yMax); 1.3164 + mbox = tag.strokeBboxMorph; 1.3165 + if (mbox) { 1.3166 + extendBoundsByPoint(tag.strokeBbox, mbox.xMin, mbox.yMin); 1.3167 + extendBoundsByPoint(tag.strokeBbox, mbox.xMax, mbox.yMax); 1.3168 + } 1.3169 + } 1.3170 + return { 1.3171 + type: 'shape', 1.3172 + id: tag.id, 1.3173 + strokeBbox: tag.strokeBbox, 1.3174 + strokeBboxMorph: tag.strokeBboxMorph, 1.3175 + bbox: tag.bbox, 1.3176 + bboxMorph: tag.bboxMorph, 1.3177 + isMorph: tag.isMorph, 1.3178 + paths: paths, 1.3179 + require: dependencies.length ? dependencies : null, 1.3180 + transferables: transferables 1.3181 + }; 1.3182 +} 1.3183 +function logShape(paths, bbox) { 1.3184 + var output = '{"bounds":' + JSON.stringify(bbox) + ',"paths":[' + paths.map(function (path) { 1.3185 + return path.serialize(); 1.3186 + }).join() + ']}'; 1.3187 + console.log(output); 1.3188 +} 1.3189 +function SegmentedPath(fillStyle, lineStyle) { 1.3190 + this.fillStyle = fillStyle; 1.3191 + this.lineStyle = lineStyle; 1.3192 + this._head = null; 1.3193 +} 1.3194 +SegmentedPath.prototype = { 1.3195 + addSegment: function (commands, data, morphData) { 1.3196 + var segment = { 1.3197 + commands: commands, 1.3198 + data: data, 1.3199 + morphData: morphData, 1.3200 + prev: this._head, 1.3201 + next: null 1.3202 + }; 1.3203 + if (this._head) { 1.3204 + this._head.next = segment; 1.3205 + } 1.3206 + this._head = segment; 1.3207 + return segment; 1.3208 + }, 1.3209 + removeSegment: function (segment) { 1.3210 + if (segment.prev) { 1.3211 + segment.prev.next = segment.next; 1.3212 + } 1.3213 + if (segment.next) { 1.3214 + segment.next.prev = segment.prev; 1.3215 + } 1.3216 + }, 1.3217 + insertSegment: function (segment, next) { 1.3218 + var prev = next.prev; 1.3219 + segment.prev = prev; 1.3220 + segment.next = next; 1.3221 + if (prev) { 1.3222 + prev.next = segment; 1.3223 + } 1.3224 + next.prev = segment; 1.3225 + }, 1.3226 + head: function () { 1.3227 + return this._head; 1.3228 + }, 1.3229 + segmentsConnect: function (first, second) { 1.3230 + var firstLength = first.data.length; 1.3231 + return first.data[firstLength - 2] === second.data[0] && first.data[firstLength - 1] === second.data[1]; 1.3232 + } 1.3233 +}; 1.3234 +var SHAPE_MOVE_TO = 1; 1.3235 +var SHAPE_LINE_TO = 2; 1.3236 +var SHAPE_CURVE_TO = 3; 1.3237 +var SHAPE_WIDE_MOVE_TO = 4; 1.3238 +var SHAPE_WIDE_LINE_TO = 5; 1.3239 +var SHAPE_CUBIC_CURVE_TO = 6; 1.3240 +var SHAPE_CIRCLE = 7; 1.3241 +var SHAPE_ELLIPSE = 8; 1.3242 +function ShapePath(fillStyle, lineStyle, commandsCount, dataLength, isMorph, transferables) { 1.3243 + this.fillStyle = fillStyle; 1.3244 + this.lineStyle = lineStyle; 1.3245 + if (commandsCount) { 1.3246 + this.commands = new Uint8Array(commandsCount); 1.3247 + this.data = new Int32Array(dataLength); 1.3248 + this.morphData = isMorph ? new Int32Array(dataLength) : null; 1.3249 + } else { 1.3250 + this.commands = []; 1.3251 + this.data = []; 1.3252 + } 1.3253 + this.bounds = null; 1.3254 + this.strokeBounds = null; 1.3255 + this.isMorph = !(!isMorph); 1.3256 + this.fullyInitialized = false; 1.3257 + if (inWorker) { 1.3258 + this.buffers = [ 1.3259 + this.commands.buffer, 1.3260 + this.data.buffer 1.3261 + ]; 1.3262 + transferables.push(this.commands.buffer, this.data.buffer); 1.3263 + if (isMorph) { 1.3264 + this.buffers.push(this.morphData.buffer); 1.3265 + transferables.push(this.morphData.buffer); 1.3266 + } 1.3267 + } else { 1.3268 + this.buffers = null; 1.3269 + } 1.3270 +} 1.3271 +ShapePath.prototype = { 1.3272 + get isEmpty() { 1.3273 + return this.commands.length === 0; 1.3274 + }, 1.3275 + moveTo: function (x, y) { 1.3276 + if (this.commands[this.commands.length - 1] === SHAPE_MOVE_TO) { 1.3277 + this.data[this.data.length - 2] = x; 1.3278 + this.data[this.data.length - 1] = y; 1.3279 + return; 1.3280 + } 1.3281 + this.commands.push(SHAPE_MOVE_TO); 1.3282 + this.data.push(x, y); 1.3283 + }, 1.3284 + lineTo: function (x, y) { 1.3285 + this.commands.push(SHAPE_LINE_TO); 1.3286 + this.data.push(x, y); 1.3287 + }, 1.3288 + curveTo: function (controlX, controlY, anchorX, anchorY) { 1.3289 + this.commands.push(SHAPE_CURVE_TO); 1.3290 + this.data.push(controlX, controlY, anchorX, anchorY); 1.3291 + }, 1.3292 + cubicCurveTo: function (control1X, control1Y, control2X, control2Y, anchorX, anchorY) { 1.3293 + this.commands.push(SHAPE_CUBIC_CURVE_TO); 1.3294 + this.data.push(control1X, control1Y, control2X, control2Y, anchorX, anchorY); 1.3295 + }, 1.3296 + rect: function (x, y, w, h) { 1.3297 + var x2 = x + w; 1.3298 + var y2 = y + h; 1.3299 + this.commands.push(SHAPE_MOVE_TO, SHAPE_LINE_TO, SHAPE_LINE_TO, SHAPE_LINE_TO, SHAPE_LINE_TO); 1.3300 + this.data.push(x, y, x2, y, x2, y2, x, y2, x, y); 1.3301 + }, 1.3302 + circle: function (x, y, radius) { 1.3303 + this.commands.push(SHAPE_CIRCLE); 1.3304 + this.data.push(x, y, radius); 1.3305 + }, 1.3306 + ellipse: function (x, y, radiusX, radiusY) { 1.3307 + this.commands.push(SHAPE_ELLIPSE); 1.3308 + this.data.push(x, y, radiusX, radiusY); 1.3309 + }, 1.3310 + draw: function (ctx, clip, ratio, colorTransform) { 1.3311 + if (clip && !this.fillStyle) { 1.3312 + return; 1.3313 + } 1.3314 + ctx.beginPath(); 1.3315 + var commands = this.commands; 1.3316 + var data = this.data; 1.3317 + var morphData = this.morphData; 1.3318 + var formOpen = false; 1.3319 + var formOpenX = 0; 1.3320 + var formOpenY = 0; 1.3321 + if (!this.isMorph) { 1.3322 + for (var j = 0, k = 0; j < commands.length; j++) { 1.3323 + switch (commands[j]) { 1.3324 + case SHAPE_MOVE_TO: 1.3325 + formOpen = true; 1.3326 + formOpenX = data[k++] / 20; 1.3327 + formOpenY = data[k++] / 20; 1.3328 + ctx.moveTo(formOpenX, formOpenY); 1.3329 + break; 1.3330 + case SHAPE_WIDE_MOVE_TO: 1.3331 + ctx.moveTo(data[k++] / 20, data[k++] / 20); 1.3332 + k += 2; 1.3333 + break; 1.3334 + case SHAPE_LINE_TO: 1.3335 + ctx.lineTo(data[k++] / 20, data[k++] / 20); 1.3336 + break; 1.3337 + case SHAPE_WIDE_LINE_TO: 1.3338 + ctx.lineTo(data[k++] / 20, data[k++] / 20); 1.3339 + k += 2; 1.3340 + break; 1.3341 + case SHAPE_CURVE_TO: 1.3342 + ctx.quadraticCurveTo(data[k++] / 20, data[k++] / 20, data[k++] / 20, data[k++] / 20); 1.3343 + break; 1.3344 + case SHAPE_CUBIC_CURVE_TO: 1.3345 + ctx.bezierCurveTo(data[k++] / 20, data[k++] / 20, data[k++] / 20, data[k++] / 20, data[k++] / 20, data[k++] / 20); 1.3346 + break; 1.3347 + case SHAPE_CIRCLE: 1.3348 + if (formOpen) { 1.3349 + ctx.lineTo(formOpenX, formOpenY); 1.3350 + formOpen = false; 1.3351 + } 1.3352 + ctx.moveTo((data[k] + data[k + 2]) / 20, data[k + 1] / 20); 1.3353 + ctx.arc(data[k++] / 20, data[k++] / 20, data[k++] / 20, 0, Math.PI * 2, false); 1.3354 + break; 1.3355 + case SHAPE_ELLIPSE: 1.3356 + if (formOpen) { 1.3357 + ctx.lineTo(formOpenX, formOpenY); 1.3358 + formOpen = false; 1.3359 + } 1.3360 + var x = data[k++]; 1.3361 + var y = data[k++]; 1.3362 + var rX = data[k++]; 1.3363 + var rY = data[k++]; 1.3364 + var radius; 1.3365 + if (rX !== rY) { 1.3366 + ctx.save(); 1.3367 + var ellipseScale; 1.3368 + if (rX > rY) { 1.3369 + ellipseScale = rX / rY; 1.3370 + radius = rY; 1.3371 + x /= ellipseScale; 1.3372 + ctx.scale(ellipseScale, 1); 1.3373 + } else { 1.3374 + ellipseScale = rY / rX; 1.3375 + radius = rX; 1.3376 + y /= ellipseScale; 1.3377 + ctx.scale(1, ellipseScale); 1.3378 + } 1.3379 + } 1.3380 + ctx.moveTo((x + radius) / 20, y / 20); 1.3381 + ctx.arc(x / 20, y / 20, radius / 20, 0, Math.PI * 2, false); 1.3382 + if (rX !== rY) { 1.3383 + ctx.restore(); 1.3384 + } 1.3385 + break; 1.3386 + default: 1.3387 + if (commands[j] === 0 && j === commands.length - 1) { 1.3388 + break; 1.3389 + } 1.3390 + console.warn('Unknown drawing command encountered: ' + commands[j]); 1.3391 + } 1.3392 + } 1.3393 + } else { 1.3394 + for (var j = 0, k = 0; j < commands.length; j++) { 1.3395 + switch (commands[j]) { 1.3396 + case SHAPE_MOVE_TO: 1.3397 + ctx.moveTo(morph(data[k] / 20, morphData[k++] / 20, ratio), morph(data[k] / 20, morphData[k++] / 20, ratio)); 1.3398 + break; 1.3399 + case SHAPE_LINE_TO: 1.3400 + ctx.lineTo(morph(data[k] / 20, morphData[k++] / 20, ratio), morph(data[k] / 20, morphData[k++] / 20, ratio)); 1.3401 + break; 1.3402 + case SHAPE_CURVE_TO: 1.3403 + ctx.quadraticCurveTo(morph(data[k] / 20, morphData[k++] / 20, ratio), morph(data[k] / 20, morphData[k++] / 20, ratio), morph(data[k] / 20, morphData[k++] / 20, ratio), morph(data[k] / 20, morphData[k++] / 20, ratio)); 1.3404 + break; 1.3405 + default: 1.3406 + console.warn('Drawing command not supported for morph shapes: ' + commands[j]); 1.3407 + } 1.3408 + } 1.3409 + } 1.3410 + if (!clip) { 1.3411 + var fillStyle = this.fillStyle; 1.3412 + if (fillStyle) { 1.3413 + colorTransform.setFillStyle(ctx, fillStyle.style); 1.3414 + ctx.imageSmoothingEnabled = ctx.mozImageSmoothingEnabled = fillStyle.smooth; 1.3415 + var m = fillStyle.transform; 1.3416 + ctx.save(); 1.3417 + colorTransform.setAlpha(ctx); 1.3418 + if (m) { 1.3419 + ctx.transform(m.a, m.b, m.c, m.d, m.e / 20, m.f / 20); 1.3420 + } 1.3421 + ctx.fill(); 1.3422 + ctx.restore(); 1.3423 + } 1.3424 + var lineStyle = this.lineStyle; 1.3425 + if (lineStyle) { 1.3426 + colorTransform.setStrokeStyle(ctx, lineStyle.style); 1.3427 + ctx.save(); 1.3428 + colorTransform.setAlpha(ctx); 1.3429 + ctx.lineWidth = Math.max(lineStyle.width / 20, 1); 1.3430 + ctx.lineCap = lineStyle.lineCap; 1.3431 + ctx.lineJoin = lineStyle.lineJoin; 1.3432 + ctx.miterLimit = lineStyle.miterLimit; 1.3433 + ctx.stroke(); 1.3434 + ctx.restore(); 1.3435 + } 1.3436 + } else { 1.3437 + ctx.fill(); 1.3438 + } 1.3439 + ctx.closePath(); 1.3440 + }, 1.3441 + isPointInPath: function (x, y) { 1.3442 + if (!(this.fillStyle || this.lineStyle)) { 1.3443 + return false; 1.3444 + } 1.3445 + var bounds = this.strokeBounds || this.bounds || this._calculateBounds(); 1.3446 + if (x < bounds.xMin || x > bounds.xMax || y < bounds.yMin || y > bounds.yMax) { 1.3447 + return false; 1.3448 + } 1.3449 + if (this.fillStyle && this.isPointInFill(x, y)) { 1.3450 + return true; 1.3451 + } 1.3452 + return this.lineStyle && this.lineStyle.width !== undefined && this.isPointInStroke(x, y); 1.3453 + }, 1.3454 + isPointInFill: function (x, y) { 1.3455 + var commands = this.commands; 1.3456 + var data = this.data; 1.3457 + var length = commands.length; 1.3458 + var inside = false; 1.3459 + var fromX = 0; 1.3460 + var fromY = 0; 1.3461 + var toX = 0; 1.3462 + var toY = 0; 1.3463 + var localX; 1.3464 + var localY; 1.3465 + var cpX; 1.3466 + var cpY; 1.3467 + var rX; 1.3468 + var rY; 1.3469 + var formOpen = false; 1.3470 + var formOpenX = 0; 1.3471 + var formOpenY = 0; 1.3472 + for (var commandIndex = 0, dataIndex = 0; commandIndex < length; commandIndex++) { 1.3473 + switch (commands[commandIndex]) { 1.3474 + case SHAPE_WIDE_MOVE_TO: 1.3475 + dataIndex += 2; 1.3476 + case SHAPE_MOVE_TO: 1.3477 + toX = data[dataIndex++]; 1.3478 + toY = data[dataIndex++]; 1.3479 + if (formOpen && intersectsLine(x, y, fromX, fromY, formOpenX, formOpenY)) { 1.3480 + inside = !inside; 1.3481 + } 1.3482 + formOpen = true; 1.3483 + formOpenX = toX; 1.3484 + formOpenY = toY; 1.3485 + break; 1.3486 + case SHAPE_WIDE_LINE_TO: 1.3487 + dataIndex += 2; 1.3488 + case SHAPE_LINE_TO: 1.3489 + toX = data[dataIndex++]; 1.3490 + toY = data[dataIndex++]; 1.3491 + if (intersectsLine(x, y, fromX, fromY, toX, toY)) { 1.3492 + inside = !inside; 1.3493 + } 1.3494 + break; 1.3495 + case SHAPE_CURVE_TO: 1.3496 + cpX = data[dataIndex++]; 1.3497 + cpY = data[dataIndex++]; 1.3498 + toX = data[dataIndex++]; 1.3499 + toY = data[dataIndex++]; 1.3500 + if (cpY > y === fromY > y && toY > y === fromY > y) { 1.3501 + break; 1.3502 + } 1.3503 + if (fromX >= x && cpX >= x && toX >= x) { 1.3504 + inside = !inside; 1.3505 + break; 1.3506 + } 1.3507 + var a = fromY - 2 * cpY + toY; 1.3508 + var c = fromY - y; 1.3509 + var b = 2 * (cpY - fromY); 1.3510 + var d = b * b - 4 * a * c; 1.3511 + if (d < 0) { 1.3512 + break; 1.3513 + } 1.3514 + d = Math.sqrt(d); 1.3515 + a = 1 / (a + a); 1.3516 + var t1 = (d - b) * a; 1.3517 + var t2 = (-b - d) * a; 1.3518 + if (t1 >= 0 && t1 <= 1 && quadraticBezier(fromX, cpX, toX, t1) > x) { 1.3519 + inside = !inside; 1.3520 + } 1.3521 + if (t2 >= 0 && t2 <= 1 && quadraticBezier(fromX, cpX, toX, t2) > x) { 1.3522 + inside = !inside; 1.3523 + } 1.3524 + break; 1.3525 + case SHAPE_CUBIC_CURVE_TO: 1.3526 + cpX = data[dataIndex++]; 1.3527 + cpY = data[dataIndex++]; 1.3528 + var cp2X = data[dataIndex++]; 1.3529 + var cp2Y = data[dataIndex++]; 1.3530 + toX = data[dataIndex++]; 1.3531 + toY = data[dataIndex++]; 1.3532 + if (cpY > y === fromY > y && cp2Y > y === fromY > y && toY > y === fromY > y) { 1.3533 + break; 1.3534 + } 1.3535 + if (fromX >= x && cpX >= x && cp2X >= x && toX >= x) { 1.3536 + inside = !inside; 1.3537 + break; 1.3538 + } 1.3539 + var roots = cubicXAtY(fromX, fromY, cpX, cpY, cp2X, cp2Y, toX, toY, y); 1.3540 + for (var i = roots.length; i--;) { 1.3541 + if (roots[i] >= x) { 1.3542 + inside = !inside; 1.3543 + } 1.3544 + } 1.3545 + break; 1.3546 + case SHAPE_CIRCLE: 1.3547 + toX = data[dataIndex++]; 1.3548 + toY = data[dataIndex++]; 1.3549 + var r = data[dataIndex++]; 1.3550 + localX = x - toX; 1.3551 + localY = y - toY; 1.3552 + if (localX * localX + localY * localY < r * r) { 1.3553 + inside = !inside; 1.3554 + } 1.3555 + toX += r; 1.3556 + break; 1.3557 + case SHAPE_ELLIPSE: 1.3558 + cpX = data[dataIndex++]; 1.3559 + cpY = data[dataIndex++]; 1.3560 + rX = data[dataIndex++]; 1.3561 + rY = data[dataIndex++]; 1.3562 + localX = x - cpX; 1.3563 + localY = y - cpY; 1.3564 + if (localX * localX / (rX * rX) + localY * localY / (rY * rY) <= 1) { 1.3565 + inside = !inside; 1.3566 + } 1.3567 + toX = cpX + rX; 1.3568 + toY = cpY; 1.3569 + break; 1.3570 + default: 1.3571 + if (!inWorker) { 1.3572 + console.warn('Drawing command not handled in isPointInPath: ' + commands[commandIndex]); 1.3573 + } 1.3574 + } 1.3575 + fromX = toX; 1.3576 + fromY = toY; 1.3577 + } 1.3578 + if (formOpen && intersectsLine(x, y, fromX, fromY, formOpenX, formOpenY)) { 1.3579 + inside = !inside; 1.3580 + } 1.3581 + return inside; 1.3582 + }, 1.3583 + isPointInStroke: function (x, y) { 1.3584 + var commands = this.commands; 1.3585 + var data = this.data; 1.3586 + var length = commands.length; 1.3587 + var width = this.lineStyle.width; 1.3588 + var halfWidth = width / 2; 1.3589 + var halfWidthSq = halfWidth * halfWidth; 1.3590 + var minX = x - halfWidth; 1.3591 + var maxX = x + halfWidth; 1.3592 + var minY = y - halfWidth; 1.3593 + var maxY = y + halfWidth; 1.3594 + var fromX = 0; 1.3595 + var fromY = 0; 1.3596 + var toX = 0; 1.3597 + var toY = 0; 1.3598 + var localX; 1.3599 + var localY; 1.3600 + var cpX; 1.3601 + var cpY; 1.3602 + var rX; 1.3603 + var rY; 1.3604 + var curveX; 1.3605 + var curveY; 1.3606 + var t; 1.3607 + for (var commandIndex = 0, dataIndex = 0; commandIndex < length; commandIndex++) { 1.3608 + switch (commands[commandIndex]) { 1.3609 + case SHAPE_WIDE_MOVE_TO: 1.3610 + dataIndex += 2; 1.3611 + case SHAPE_MOVE_TO: 1.3612 + toX = data[dataIndex++]; 1.3613 + toY = data[dataIndex++]; 1.3614 + break; 1.3615 + case SHAPE_WIDE_LINE_TO: 1.3616 + dataIndex += 2; 1.3617 + case SHAPE_LINE_TO: 1.3618 + toX = data[dataIndex++]; 1.3619 + toY = data[dataIndex++]; 1.3620 + if (fromX === toX && fromY === toY) { 1.3621 + break; 1.3622 + } 1.3623 + if (maxX < fromX && maxX < toX || minX > fromX && minX > toX || maxY < fromY && maxY < toY || minY > fromY && minY > toY) { 1.3624 + break; 1.3625 + } 1.3626 + if (toX === fromX || toY === fromY) { 1.3627 + return true; 1.3628 + } 1.3629 + t = ((x - fromX) * (toX - fromX) + (y - fromY) * (toY - fromY)) / distanceSq(fromX, fromY, toX, toY); 1.3630 + if (t < 0) { 1.3631 + if (distanceSq(x, y, fromX, fromY) <= halfWidthSq) { 1.3632 + return true; 1.3633 + } 1.3634 + break; 1.3635 + } 1.3636 + if (t > 1) { 1.3637 + if (distanceSq(x, y, toX, toY) <= halfWidthSq) { 1.3638 + return true; 1.3639 + } 1.3640 + break; 1.3641 + } 1.3642 + if (distanceSq(x, y, fromX + t * (toX - fromX), fromY + t * (toY - fromY)) <= halfWidthSq) { 1.3643 + return true; 1.3644 + } 1.3645 + break; 1.3646 + case SHAPE_CURVE_TO: 1.3647 + cpX = data[dataIndex++]; 1.3648 + cpY = data[dataIndex++]; 1.3649 + toX = data[dataIndex++]; 1.3650 + toY = data[dataIndex++]; 1.3651 + var extremeX = quadraticBezierExtreme(fromX, cpX, toX); 1.3652 + if (maxX < fromX && maxX < extremeX && maxX < toX || minX > fromX && minX > extremeX && minX > toX) { 1.3653 + break; 1.3654 + } 1.3655 + var extremeY = quadraticBezierExtreme(fromY, cpY, toY); 1.3656 + if (maxY < fromY && maxY < extremeY && maxY < toY || minY > fromY && minY > extremeY && minY > toY) { 1.3657 + break; 1.3658 + } 1.3659 + for (t = 0; t < 1; t += 0.02) { 1.3660 + curveX = quadraticBezier(fromX, cpX, toX, t); 1.3661 + if (curveX < minX || curveX > maxX) { 1.3662 + continue; 1.3663 + } 1.3664 + curveY = quadraticBezier(fromY, cpY, toY, t); 1.3665 + if (curveY < minY || curveY > maxY) { 1.3666 + continue; 1.3667 + } 1.3668 + if ((x - curveX) * (x - curveX) + (y - curveY) * (y - curveY) < halfWidthSq) { 1.3669 + return true; 1.3670 + } 1.3671 + } 1.3672 + break; 1.3673 + case SHAPE_CUBIC_CURVE_TO: 1.3674 + cpX = data[dataIndex++]; 1.3675 + cpY = data[dataIndex++]; 1.3676 + var cp2X = data[dataIndex++]; 1.3677 + var cp2Y = data[dataIndex++]; 1.3678 + toX = data[dataIndex++]; 1.3679 + toY = data[dataIndex++]; 1.3680 + var extremesX = cubicBezierExtremes(fromX, cpX, cp2X, toX); 1.3681 + while (extremesX.length < 2) { 1.3682 + extremesX.push(toX); 1.3683 + } 1.3684 + if (maxX < fromX && maxX < toX && maxX < extremesX[0] && maxX < extremesX[1] || minX > fromX && minX > toX && minX > extremesX[0] && minX > extremesX[1]) { 1.3685 + break; 1.3686 + } 1.3687 + var extremesY = cubicBezierExtremes(fromY, cpY, cp2Y, toY); 1.3688 + while (extremesY.length < 2) { 1.3689 + extremesY.push(toY); 1.3690 + } 1.3691 + if (maxY < fromY && maxY < toY && maxY < extremesY[0] && maxY < extremesY[1] || minY > fromY && minY > toY && minY > extremesY[0] && minY > extremesY[1]) { 1.3692 + break; 1.3693 + } 1.3694 + for (t = 0; t < 1; t += 0.02) { 1.3695 + curveX = cubicBezier(fromX, cpX, cp2X, toX, t); 1.3696 + if (curveX < minX || curveX > maxX) { 1.3697 + continue; 1.3698 + } 1.3699 + curveY = cubicBezier(fromY, cpY, cp2Y, toY, t); 1.3700 + if (curveY < minY || curveY > maxY) { 1.3701 + continue; 1.3702 + } 1.3703 + if ((x - curveX) * (x - curveX) + (y - curveY) * (y - curveY) < halfWidthSq) { 1.3704 + return true; 1.3705 + } 1.3706 + } 1.3707 + break; 1.3708 + case SHAPE_CIRCLE: 1.3709 + cpX = data[dataIndex++]; 1.3710 + cpY = data[dataIndex++]; 1.3711 + var r = data[dataIndex++]; 1.3712 + toX = cpX + r; 1.3713 + toY = cpY; 1.3714 + if (maxX < cpX - r || minX > cpX + r || maxY < cpY - r || minY > cpY + r) { 1.3715 + break; 1.3716 + } 1.3717 + localX = x - cpX; 1.3718 + localY = y - cpY; 1.3719 + var rMin = r - halfWidth; 1.3720 + var rMax = r + halfWidth; 1.3721 + var distSq = localX * localX + localY * localY; 1.3722 + if (distSq >= rMin * rMin && distSq <= rMax * rMax) { 1.3723 + return true; 1.3724 + } 1.3725 + break; 1.3726 + case SHAPE_ELLIPSE: 1.3727 + cpX = data[dataIndex++]; 1.3728 + cpY = data[dataIndex++]; 1.3729 + rX = data[dataIndex++]; 1.3730 + rY = data[dataIndex++]; 1.3731 + toX = cpX + rX; 1.3732 + toY = cpY; 1.3733 + localX = Math.abs(x - cpX); 1.3734 + localY = Math.abs(y - cpY); 1.3735 + localX -= halfWidth; 1.3736 + localY -= halfWidth; 1.3737 + if (localX * localX / (rX * rX) + localY * localY / (rY * rY) > 1) { 1.3738 + break; 1.3739 + } 1.3740 + localX += width; 1.3741 + localY += width; 1.3742 + if (localX * localX / (rX * rX) + localY * localY / (rY * rY) > 1) { 1.3743 + return true; 1.3744 + } 1.3745 + break; 1.3746 + default: 1.3747 + if (!inWorker) { 1.3748 + console.warn('Drawing command not handled in isPointInPath: ' + commands[commandIndex]); 1.3749 + } 1.3750 + } 1.3751 + fromX = toX; 1.3752 + fromY = toY; 1.3753 + } 1.3754 + return false; 1.3755 + }, 1.3756 + getBounds: function (includeStroke) { 1.3757 + var bounds = includeStroke ? this.strokeBounds : this.bounds; 1.3758 + if (!bounds) { 1.3759 + this._calculateBounds(); 1.3760 + bounds = includeStroke ? this.strokeBounds : this.bounds; 1.3761 + } 1.3762 + return bounds; 1.3763 + }, 1.3764 + _calculateBounds: function () { 1.3765 + var commands = this.commands; 1.3766 + var data = this.data; 1.3767 + var length = commands.length; 1.3768 + var bounds; 1.3769 + if (commands[0] === SHAPE_MOVE_TO || commands[0] > SHAPE_CUBIC_CURVE_TO) { 1.3770 + bounds = { 1.3771 + xMin: data[0], 1.3772 + yMin: data[1] 1.3773 + }; 1.3774 + } else { 1.3775 + bounds = { 1.3776 + xMin: 0, 1.3777 + yMin: 0 1.3778 + }; 1.3779 + } 1.3780 + bounds.xMax = bounds.xMin; 1.3781 + bounds.yMax = bounds.yMin; 1.3782 + var fromX = bounds.xMin; 1.3783 + var fromY = bounds.yMin; 1.3784 + for (var commandIndex = 0, dataIndex = 0; commandIndex < length; commandIndex++) { 1.3785 + var toX; 1.3786 + var toY; 1.3787 + var cpX; 1.3788 + var cpY; 1.3789 + switch (commands[commandIndex]) { 1.3790 + case SHAPE_WIDE_MOVE_TO: 1.3791 + dataIndex += 2; 1.3792 + case SHAPE_MOVE_TO: 1.3793 + toX = data[dataIndex++]; 1.3794 + toY = data[dataIndex++]; 1.3795 + extendBoundsByPoint(bounds, toX, toY); 1.3796 + break; 1.3797 + case SHAPE_WIDE_LINE_TO: 1.3798 + dataIndex += 2; 1.3799 + case SHAPE_LINE_TO: 1.3800 + toX = data[dataIndex++]; 1.3801 + toY = data[dataIndex++]; 1.3802 + extendBoundsByPoint(bounds, toX, toY); 1.3803 + break; 1.3804 + case SHAPE_CURVE_TO: 1.3805 + cpX = data[dataIndex++]; 1.3806 + cpY = data[dataIndex++]; 1.3807 + toX = data[dataIndex++]; 1.3808 + toY = data[dataIndex++]; 1.3809 + extendBoundsByPoint(bounds, toX, toY); 1.3810 + if (cpX < fromX || cpX > toX) { 1.3811 + extendBoundsByX(bounds, quadraticBezierExtreme(fromX, cpX, toX)); 1.3812 + } 1.3813 + if (cpY < fromY || cpY > toY) { 1.3814 + extendBoundsByY(bounds, quadraticBezierExtreme(fromY, cpY, toY)); 1.3815 + } 1.3816 + break; 1.3817 + case SHAPE_CUBIC_CURVE_TO: 1.3818 + cpX = data[dataIndex++]; 1.3819 + cpY = data[dataIndex++]; 1.3820 + var cp2X = data[dataIndex++]; 1.3821 + var cp2Y = data[dataIndex++]; 1.3822 + toX = data[dataIndex++]; 1.3823 + toY = data[dataIndex++]; 1.3824 + extendBoundsByPoint(bounds, toX, toY); 1.3825 + var extremes; 1.3826 + var i; 1.3827 + if (cpX < fromX || cp2X < fromX || cpX > toX || cp2X > toX) { 1.3828 + extremes = cubicBezierExtremes(fromX, cpX, cp2X, toX); 1.3829 + for (i = extremes.length; i--;) { 1.3830 + extendBoundsByX(bounds, extremes[i]); 1.3831 + } 1.3832 + } 1.3833 + if (cpY < fromY || cp2Y < fromY || cpY > toY || cp2Y > toY) { 1.3834 + extremes = cubicBezierExtremes(fromY, cpY, cp2Y, toY); 1.3835 + for (i = extremes.length; i--;) { 1.3836 + extendBoundsByY(bounds, extremes[i]); 1.3837 + } 1.3838 + } 1.3839 + break; 1.3840 + case SHAPE_CIRCLE: 1.3841 + toX = data[dataIndex++]; 1.3842 + toY = data[dataIndex++]; 1.3843 + var radius = data[dataIndex++]; 1.3844 + extendBoundsByPoint(bounds, toX - radius, toY - radius); 1.3845 + extendBoundsByPoint(bounds, toX + radius, toY + radius); 1.3846 + toX += radius; 1.3847 + break; 1.3848 + case SHAPE_ELLIPSE: 1.3849 + toX = data[dataIndex++]; 1.3850 + toY = data[dataIndex++]; 1.3851 + var radiusX = data[dataIndex++]; 1.3852 + var radiusY = data[dataIndex++]; 1.3853 + extendBoundsByPoint(bounds, toX - radiusX, toY - radiusY); 1.3854 + extendBoundsByPoint(bounds, toX + radiusX, toY + radiusY); 1.3855 + toX += radiusX; 1.3856 + break; 1.3857 + default: 1.3858 + if (!inWorker) { 1.3859 + console.warn('Drawing command not handled in bounds calculation: ' + commands[commandIndex]); 1.3860 + } 1.3861 + } 1.3862 + fromX = toX; 1.3863 + fromY = toY; 1.3864 + } 1.3865 + this.bounds = bounds; 1.3866 + if (this.lineStyle) { 1.3867 + var halfLineWidth = this.lineStyle.width / 2; 1.3868 + this.strokeBounds = { 1.3869 + xMin: bounds.xMin - halfLineWidth, 1.3870 + yMin: bounds.yMin - halfLineWidth, 1.3871 + xMax: bounds.xMax + halfLineWidth, 1.3872 + yMax: bounds.yMax + halfLineWidth 1.3873 + }; 1.3874 + return this.strokeBounds; 1.3875 + } else { 1.3876 + this.strokeBounds = bounds; 1.3877 + } 1.3878 + return bounds; 1.3879 + }, 1.3880 + serialize: function () { 1.3881 + var output = '{'; 1.3882 + if (this.fillStyle) { 1.3883 + output += '"fill":' + JSON.stringify(this.fillStyle) + ','; 1.3884 + } 1.3885 + if (this.lineStyle) { 1.3886 + output += '"stroke":' + JSON.stringify(this.lineStyle) + ','; 1.3887 + } 1.3888 + output += '"commands":[' + Array.apply([], this.commands).join() + '],'; 1.3889 + output += '"data":[' + Array.apply([], this.data).join() + ']'; 1.3890 + return output + '}'; 1.3891 + } 1.3892 +}; 1.3893 +ShapePath.fromPlainObject = function (obj) { 1.3894 + var path = new ShapePath(obj.fill || null, obj.stroke || null); 1.3895 + path.commands = new Uint8Array(obj.commands); 1.3896 + path.data = new Int32Array(obj.data); 1.3897 + if (!inWorker) { 1.3898 + finishShapePath(path); 1.3899 + } 1.3900 + return path; 1.3901 +}; 1.3902 +function distanceSq(x1, y1, x2, y2) { 1.3903 + var dX = x2 - x1; 1.3904 + var dY = y2 - y1; 1.3905 + return dX * dX + dY * dY; 1.3906 +} 1.3907 +function intersectsLine(x, y, x1, y1, x2, y2) { 1.3908 + return y2 > y !== y1 > y && x < (x1 - x2) * (y - y2) / (y1 - y2) + x2; 1.3909 +} 1.3910 +function quadraticBezier(from, cp, to, t) { 1.3911 + var inverseT = 1 - t; 1.3912 + return from * inverseT * inverseT + 2 * cp * inverseT * t + to * t * t; 1.3913 +} 1.3914 +function quadraticBezierExtreme(from, cp, to) { 1.3915 + var t = (from - cp) / (from - 2 * cp + to); 1.3916 + if (t < 0) { 1.3917 + return from; 1.3918 + } 1.3919 + if (t > 1) { 1.3920 + return to; 1.3921 + } 1.3922 + return quadraticBezier(from, cp, to, t); 1.3923 +} 1.3924 +function cubicBezier(from, cp, cp2, to, t) { 1.3925 + var tSq = t * t; 1.3926 + var inverseT = 1 - t; 1.3927 + var inverseTSq = inverseT * inverseT; 1.3928 + return from * inverseT * inverseTSq + 3 * cp * t * inverseTSq + 3 * cp2 * inverseT * tSq + to * t * tSq; 1.3929 +} 1.3930 +function cubicBezierExtremes(from, cp, cp2, to) { 1.3931 + var d1 = cp - from; 1.3932 + var d2 = cp2 - cp; 1.3933 + d2 *= 2; 1.3934 + var d3 = to - cp2; 1.3935 + if (d1 + d3 === d2) { 1.3936 + d3 *= 1.0001; 1.3937 + } 1.3938 + var fHead = 2 * d1 - d2; 1.3939 + var part1 = d2 - 2 * d1; 1.3940 + var fCenter = Math.sqrt(part1 * part1 - 4 * d1 * (d1 - d2 + d3)); 1.3941 + var fTail = 2 * (d1 - d2 + d3); 1.3942 + var t1 = (fHead + fCenter) / fTail; 1.3943 + var t2 = (fHead - fCenter) / fTail; 1.3944 + var result = []; 1.3945 + if (t1 >= 0 && t1 <= 1) { 1.3946 + result.push(cubicBezier(from, cp, cp2, to, t1)); 1.3947 + } 1.3948 + if (t2 >= 0 && t2 <= 1) { 1.3949 + result.push(cubicBezier(from, cp, cp2, to, t2)); 1.3950 + } 1.3951 + return result; 1.3952 +} 1.3953 +function cubicXAtY(x0, y0, cx, cy, cx1, cy1, x1, y1, y) { 1.3954 + var dX = 3 * (cx - x0); 1.3955 + var dY = 3 * (cy - y0); 1.3956 + var bX = 3 * (cx1 - cx) - dX; 1.3957 + var bY = 3 * (cy1 - cy) - dY; 1.3958 + var c3X = x1 - x0 - dX - bX; 1.3959 + var c3Y = y1 - y0 - dY - bY; 1.3960 + function f(t) { 1.3961 + return t * (dY + t * (bY + t * c3Y)) + y0 - y; 1.3962 + } 1.3963 + function pointAt(t) { 1.3964 + if (t < 0) { 1.3965 + t = 0; 1.3966 + } else if (t > 1) { 1.3967 + t = 1; 1.3968 + } 1.3969 + return x0 + t * (dX + t * (bX + t * c3X)); 1.3970 + } 1.3971 + function bisectCubicBezierRange(f, l, r, limit) { 1.3972 + if (Math.abs(r - l) <= limit) { 1.3973 + return; 1.3974 + } 1.3975 + var middle = 0.5 * (l + r); 1.3976 + if (f(l) * f(r) <= 0) { 1.3977 + left = l; 1.3978 + right = r; 1.3979 + return; 1.3980 + } 1.3981 + bisectCubicBezierRange(f, l, middle, limit); 1.3982 + bisectCubicBezierRange(f, middle, r, limit); 1.3983 + } 1.3984 + var left = 0; 1.3985 + var right = 1; 1.3986 + bisectCubicBezierRange(f, 0, 1, 0.05); 1.3987 + var t0 = findRoot(left, right, f, 50, 0.000001); 1.3988 + var evalResult = Math.abs(f(t0)); 1.3989 + if (evalResult > 0.00001) { 1.3990 + return []; 1.3991 + } 1.3992 + var result = []; 1.3993 + if (t0 <= 1) { 1.3994 + result.push(pointAt(t0)); 1.3995 + } 1.3996 + var a = c3Y; 1.3997 + var b = t0 * a + bY; 1.3998 + var c = t0 * b + dY; 1.3999 + var d = b * b - 4 * a * c; 1.4000 + if (d < 0) { 1.4001 + return result; 1.4002 + } 1.4003 + d = Math.sqrt(d); 1.4004 + a = 1 / (a + a); 1.4005 + var t1 = (d - b) * a; 1.4006 + var t2 = (-b - d) * a; 1.4007 + if (t1 >= 0 && t1 <= 1) { 1.4008 + result.push(pointAt(t1)); 1.4009 + } 1.4010 + if (t2 >= 0 && t2 <= 1) { 1.4011 + result.push(pointAt(t2)); 1.4012 + } 1.4013 + return result; 1.4014 +} 1.4015 +function findRoot(x0, x2, f, maxIterations, epsilon) { 1.4016 + var x1; 1.4017 + var y0; 1.4018 + var y1; 1.4019 + var y2; 1.4020 + var b; 1.4021 + var c; 1.4022 + var y10; 1.4023 + var y20; 1.4024 + var y21; 1.4025 + var xm; 1.4026 + var ym; 1.4027 + var temp; 1.4028 + var xmlast = x0; 1.4029 + y0 = f(x0); 1.4030 + if (y0 === 0) { 1.4031 + return x0; 1.4032 + } 1.4033 + y2 = f(x2); 1.4034 + if (y2 === 0) { 1.4035 + return x2; 1.4036 + } 1.4037 + if (y2 * y0 > 0) { 1.4038 + return x0; 1.4039 + } 1.4040 + var __iter = 0; 1.4041 + for (var i = 0; i < maxIterations; ++i) { 1.4042 + __iter++; 1.4043 + x1 = 0.5 * (x2 + x0); 1.4044 + y1 = f(x1); 1.4045 + if (y1 === 0) { 1.4046 + return x1; 1.4047 + } 1.4048 + if (Math.abs(x1 - x0) < epsilon) { 1.4049 + return x1; 1.4050 + } 1.4051 + if (y1 * y0 > 0) { 1.4052 + temp = x0; 1.4053 + x0 = x2; 1.4054 + x2 = temp; 1.4055 + temp = y0; 1.4056 + y0 = y2; 1.4057 + y2 = temp; 1.4058 + } 1.4059 + y10 = y1 - y0; 1.4060 + y21 = y2 - y1; 1.4061 + y20 = y2 - y0; 1.4062 + if (y2 * y20 < 2 * y1 * y10) { 1.4063 + x2 = x1; 1.4064 + y2 = y1; 1.4065 + } else { 1.4066 + b = (x1 - x0) / y10; 1.4067 + c = (y10 - y21) / (y21 * y20); 1.4068 + xm = x0 - b * y0 * (1 - c * y1); 1.4069 + ym = f(xm); 1.4070 + if (ym === 0) { 1.4071 + return xm; 1.4072 + } 1.4073 + if (Math.abs(xm - xmlast) < epsilon) { 1.4074 + return xm; 1.4075 + } 1.4076 + xmlast = xm; 1.4077 + if (ym * y0 < 0) { 1.4078 + x2 = xm; 1.4079 + y2 = ym; 1.4080 + } else { 1.4081 + x0 = xm; 1.4082 + y0 = ym; 1.4083 + x2 = x1; 1.4084 + y2 = y1; 1.4085 + } 1.4086 + } 1.4087 + } 1.4088 + return x1; 1.4089 +} 1.4090 +function extendBoundsByPoint(bounds, x, y) { 1.4091 + if (x < bounds.xMin) { 1.4092 + bounds.xMin = x; 1.4093 + } else if (x > bounds.xMax) { 1.4094 + bounds.xMax = x; 1.4095 + } 1.4096 + if (y < bounds.yMin) { 1.4097 + bounds.yMin = y; 1.4098 + } else if (y > bounds.yMax) { 1.4099 + bounds.yMax = y; 1.4100 + } 1.4101 +} 1.4102 +function extendBoundsByX(bounds, x) { 1.4103 + if (x < bounds.xMin) { 1.4104 + bounds.xMin = x; 1.4105 + } else if (x > bounds.xMax) { 1.4106 + bounds.xMax = x; 1.4107 + } 1.4108 +} 1.4109 +function extendBoundsByY(bounds, y) { 1.4110 + if (y < bounds.yMin) { 1.4111 + bounds.yMin = y; 1.4112 + } else if (y > bounds.yMax) { 1.4113 + bounds.yMax = y; 1.4114 + } 1.4115 +} 1.4116 +function morph(start, end, ratio) { 1.4117 + return start + (end - start) * ratio; 1.4118 +} 1.4119 +function finishShapePath(path, dictionaryResolved) { 1.4120 + if (path.fullyInitialized) { 1.4121 + return path; 1.4122 + } 1.4123 + if (!(path instanceof ShapePath)) { 1.4124 + var untypedPath = path; 1.4125 + path = new ShapePath(path.fillStyle, path.lineStyle, 0, 0, path.isMorph); 1.4126 + path.commands = new Uint8Array(untypedPath.buffers[0]); 1.4127 + path.data = new Int32Array(untypedPath.buffers[1]); 1.4128 + if (untypedPath.isMorph) { 1.4129 + path.morphData = new Int32Array(untypedPath.buffers[2]); 1.4130 + } 1.4131 + path.buffers = null; 1.4132 + } 1.4133 + path.fillStyle && initStyle(path.fillStyle, dictionaryResolved); 1.4134 + path.lineStyle && initStyle(path.lineStyle, dictionaryResolved); 1.4135 + path.fullyInitialized = true; 1.4136 + return path; 1.4137 +} 1.4138 +var inWorker = typeof window === 'undefined'; 1.4139 +var factoryCtx = !inWorker ? document.createElement('canvas').getContext('2d') : null; 1.4140 +function buildLinearGradientFactory(colorStops) { 1.4141 + var defaultGradient = factoryCtx.createLinearGradient(-1, 0, 1, 0); 1.4142 + for (var i = 0; i < colorStops.length; i++) { 1.4143 + defaultGradient.addColorStop(colorStops[i].ratio, colorStops[i].color); 1.4144 + } 1.4145 + var fn = function createLinearGradient(ctx, colorTransform) { 1.4146 + var gradient = ctx.createLinearGradient(-1, 0, 1, 0); 1.4147 + for (var i = 0; i < colorStops.length; i++) { 1.4148 + colorTransform.addGradientColorStop(gradient, colorStops[i].ratio, colorStops[i].color); 1.4149 + } 1.4150 + return gradient; 1.4151 + }; 1.4152 + fn.defaultFillStyle = defaultGradient; 1.4153 + return fn; 1.4154 +} 1.4155 +function buildRadialGradientFactory(focalPoint, colorStops) { 1.4156 + var defaultGradient = factoryCtx.createRadialGradient(focalPoint, 0, 0, 0, 0, 1); 1.4157 + for (var i = 0; i < colorStops.length; i++) { 1.4158 + defaultGradient.addColorStop(colorStops[i].ratio, colorStops[i].color); 1.4159 + } 1.4160 + var fn = function createRadialGradient(ctx, colorTransform) { 1.4161 + var gradient = ctx.createRadialGradient(focalPoint, 0, 0, 0, 0, 1); 1.4162 + for (var i = 0; i < colorStops.length; i++) { 1.4163 + colorTransform.addGradientColorStop(gradient, colorStops[i].ratio, colorStops[i].color); 1.4164 + } 1.4165 + return gradient; 1.4166 + }; 1.4167 + fn.defaultFillStyle = defaultGradient; 1.4168 + return fn; 1.4169 +} 1.4170 +function buildBitmapPatternFactory(img, repeat) { 1.4171 + var defaultPattern = factoryCtx.createPattern(img, repeat); 1.4172 + var cachedTransform, cachedTransformKey; 1.4173 + var fn = function createBitmapPattern(ctx, colorTransform) { 1.4174 + if (!colorTransform.mode) { 1.4175 + return defaultPattern; 1.4176 + } 1.4177 + var key = colorTransform.getTransformFingerprint(); 1.4178 + if (key === cachedTransformKey) { 1.4179 + return cachedTransform; 1.4180 + } 1.4181 + var canvas = document.createElement('canvas'); 1.4182 + canvas.width = img.width; 1.4183 + canvas.height = img.height; 1.4184 + var ctx = canvas.getContext('2d'); 1.4185 + colorTransform.setAlpha(ctx, true); 1.4186 + ctx.drawImage(img, 0, 0); 1.4187 + cachedTransform = ctx.createPattern(canvas, repeat); 1.4188 + cachedTransformKey = key; 1.4189 + return cachedTransform; 1.4190 + }; 1.4191 + fn.defaultFillStyle = defaultPattern; 1.4192 + return fn; 1.4193 +} 1.4194 +function initStyle(style, dictionaryResolved) { 1.4195 + if (style.type === undefined) { 1.4196 + return; 1.4197 + } 1.4198 + switch (style.type) { 1.4199 + case GRAPHICS_FILL_SOLID: 1.4200 + break; 1.4201 + case GRAPHICS_FILL_LINEAR_GRADIENT: 1.4202 + case GRAPHICS_FILL_RADIAL_GRADIENT: 1.4203 + case GRAPHICS_FILL_FOCAL_RADIAL_GRADIENT: 1.4204 + var records = style.records, colorStops = []; 1.4205 + for (var j = 0, n = records.length; j < n; j++) { 1.4206 + var record = records[j]; 1.4207 + var colorStr = rgbaObjToStr(record.color); 1.4208 + colorStops.push({ 1.4209 + ratio: record.ratio / 255, 1.4210 + color: colorStr 1.4211 + }); 1.4212 + } 1.4213 + var gradientConstructor; 1.4214 + var isLinear = style.type === GRAPHICS_FILL_LINEAR_GRADIENT; 1.4215 + if (isLinear) { 1.4216 + gradientConstructor = buildLinearGradientFactory(colorStops); 1.4217 + } else { 1.4218 + gradientConstructor = buildRadialGradientFactory((style.focalPoint | 0) / 20, colorStops); 1.4219 + } 1.4220 + style.style = gradientConstructor; 1.4221 + break; 1.4222 + case GRAPHICS_FILL_REPEATING_BITMAP: 1.4223 + case GRAPHICS_FILL_CLIPPED_BITMAP: 1.4224 + case GRAPHICS_FILL_NONSMOOTHED_REPEATING_BITMAP: 1.4225 + case GRAPHICS_FILL_NONSMOOTHED_CLIPPED_BITMAP: 1.4226 + var bitmap = dictionaryResolved[style.bitmapId]; 1.4227 + var repeat = style.type === GRAPHICS_FILL_REPEATING_BITMAP || style.type === GRAPHICS_FILL_NONSMOOTHED_REPEATING_BITMAP; 1.4228 + style.style = buildBitmapPatternFactory(bitmap.props.img, repeat ? 'repeat' : 'no-repeat'); 1.4229 + break; 1.4230 + default: 1.4231 + fail('invalid fill style', 'shape'); 1.4232 + } 1.4233 +} 1.4234 +var SOUND_SIZE_8_BIT = 0; 1.4235 +var SOUND_SIZE_16_BIT = 1; 1.4236 +var SOUND_TYPE_MONO = 0; 1.4237 +var SOUND_TYPE_STEREO = 1; 1.4238 +var SOUND_FORMAT_PCM_BE = 0; 1.4239 +var SOUND_FORMAT_ADPCM = 1; 1.4240 +var SOUND_FORMAT_MP3 = 2; 1.4241 +var SOUND_FORMAT_PCM_LE = 3; 1.4242 +var SOUND_FORMAT_NELLYMOSER_16 = 4; 1.4243 +var SOUND_FORMAT_NELLYMOSER_8 = 5; 1.4244 +var SOUND_FORMAT_NELLYMOSER = 6; 1.4245 +var SOUND_FORMAT_SPEEX = 11; 1.4246 +var SOUND_RATES = [ 1.4247 + 5512, 1.4248 + 11250, 1.4249 + 22500, 1.4250 + 44100 1.4251 + ]; 1.4252 +var WaveHeader = new Uint8Array([ 1.4253 + 82, 1.4254 + 73, 1.4255 + 70, 1.4256 + 70, 1.4257 + 0, 1.4258 + 0, 1.4259 + 0, 1.4260 + 0, 1.4261 + 87, 1.4262 + 65, 1.4263 + 86, 1.4264 + 69, 1.4265 + 102, 1.4266 + 109, 1.4267 + 116, 1.4268 + 32, 1.4269 + 16, 1.4270 + 0, 1.4271 + 0, 1.4272 + 0, 1.4273 + 1, 1.4274 + 0, 1.4275 + 2, 1.4276 + 0, 1.4277 + 68, 1.4278 + 172, 1.4279 + 0, 1.4280 + 0, 1.4281 + 16, 1.4282 + 177, 1.4283 + 2, 1.4284 + 0, 1.4285 + 4, 1.4286 + 0, 1.4287 + 16, 1.4288 + 0, 1.4289 + 100, 1.4290 + 97, 1.4291 + 116, 1.4292 + 97, 1.4293 + 0, 1.4294 + 0, 1.4295 + 0, 1.4296 + 0 1.4297 + ]); 1.4298 +function packageWave(data, sampleRate, channels, size, swapBytes) { 1.4299 + var sizeInBytes = size >> 3; 1.4300 + var sizePerSecond = channels * sampleRate * sizeInBytes; 1.4301 + var sizePerSample = channels * sizeInBytes; 1.4302 + var dataLength = data.length + (data.length & 1); 1.4303 + var buffer = new ArrayBuffer(WaveHeader.length + dataLength); 1.4304 + var bytes = new Uint8Array(buffer); 1.4305 + bytes.set(WaveHeader); 1.4306 + if (swapBytes) { 1.4307 + for (var i = 0, j = WaveHeader.length; i < data.length; i += 2, j += 2) { 1.4308 + bytes[j] = data[i + 1]; 1.4309 + bytes[j + 1] = data[i]; 1.4310 + } 1.4311 + } else { 1.4312 + bytes.set(data, WaveHeader.length); 1.4313 + } 1.4314 + var view = new DataView(buffer); 1.4315 + view.setUint32(4, dataLength + 36, true); 1.4316 + view.setUint16(22, channels, true); 1.4317 + view.setUint32(24, sampleRate, true); 1.4318 + view.setUint32(28, sizePerSecond, true); 1.4319 + view.setUint16(32, sizePerSample, true); 1.4320 + view.setUint16(34, size, true); 1.4321 + view.setUint32(40, dataLength, true); 1.4322 + return { 1.4323 + data: bytes, 1.4324 + mimeType: 'audio/wav' 1.4325 + }; 1.4326 +} 1.4327 +function defineSound(tag, dictionary) { 1.4328 + var channels = tag.soundType == SOUND_TYPE_STEREO ? 2 : 1; 1.4329 + var samplesCount = tag.samplesCount; 1.4330 + var sampleRate = SOUND_RATES[tag.soundRate]; 1.4331 + var data = tag.soundData; 1.4332 + var pcm, packaged; 1.4333 + switch (tag.soundFormat) { 1.4334 + case SOUND_FORMAT_PCM_BE: 1.4335 + pcm = new Float32Array(samplesCount * channels); 1.4336 + if (tag.soundSize == SOUND_SIZE_16_BIT) { 1.4337 + for (var i = 0, j = 0; i < pcm.length; i++, j += 2) 1.4338 + pcm[i] = (data[j] << 24 | data[j + 1] << 16) / 2147483648; 1.4339 + packaged = packageWave(data, sampleRate, channels, 16, true); 1.4340 + } else { 1.4341 + for (var i = 0; i < pcm.length; i++) 1.4342 + pcm[i] = (data[i] - 128) / 128; 1.4343 + packaged = packageWave(data, sampleRate, channels, 8, false); 1.4344 + } 1.4345 + break; 1.4346 + case SOUND_FORMAT_PCM_LE: 1.4347 + pcm = new Float32Array(samplesCount * channels); 1.4348 + if (tag.soundSize == SOUND_SIZE_16_BIT) { 1.4349 + for (var i = 0, j = 0; i < pcm.length; i++, j += 2) 1.4350 + pcm[i] = (data[j + 1] << 24 | data[j] << 16) / 2147483648; 1.4351 + packaged = packageWave(data, sampleRate, channels, 16, false); 1.4352 + } else { 1.4353 + for (var i = 0; i < pcm.length; i++) 1.4354 + pcm[i] = (data[i] - 128) / 128; 1.4355 + packaged = packageWave(data, sampleRate, channels, 8, false); 1.4356 + } 1.4357 + break; 1.4358 + case SOUND_FORMAT_MP3: 1.4359 + packaged = { 1.4360 + data: new Uint8Array(data.subarray(2)), 1.4361 + mimeType: 'audio/mpeg' 1.4362 + }; 1.4363 + break; 1.4364 + case SOUND_FORMAT_ADPCM: 1.4365 + var pcm16 = new Int16Array(samplesCount * channels); 1.4366 + decodeACPCMSoundData(data, pcm16, channels); 1.4367 + pcm = new Float32Array(samplesCount * channels); 1.4368 + for (var i = 0; i < pcm.length; i++) 1.4369 + pcm[i] = pcm16[i] / 32768; 1.4370 + packaged = packageWave(new Uint8Array(pcm16.buffer), sampleRate, channels, 16, !new Uint8Array(new Uint16Array([ 1.4371 + 1 1.4372 + ]).buffer)[0]); 1.4373 + break; 1.4374 + default: 1.4375 + throw new Error('Unsupported audio format: ' + tag.soundFormat); 1.4376 + } 1.4377 + var sound = { 1.4378 + type: 'sound', 1.4379 + id: tag.id, 1.4380 + sampleRate: sampleRate, 1.4381 + channels: channels, 1.4382 + pcm: pcm 1.4383 + }; 1.4384 + if (packaged) 1.4385 + sound.packaged = packaged; 1.4386 + return sound; 1.4387 +} 1.4388 +var ACPCMIndexTables = [ 1.4389 + [ 1.4390 + -1, 1.4391 + 2 1.4392 + ], 1.4393 + [ 1.4394 + -1, 1.4395 + -1, 1.4396 + 2, 1.4397 + 4 1.4398 + ], 1.4399 + [ 1.4400 + -1, 1.4401 + -1, 1.4402 + -1, 1.4403 + -1, 1.4404 + 2, 1.4405 + 4, 1.4406 + 6, 1.4407 + 8 1.4408 + ], 1.4409 + [ 1.4410 + -1, 1.4411 + -1, 1.4412 + -1, 1.4413 + -1, 1.4414 + -1, 1.4415 + -1, 1.4416 + -1, 1.4417 + -1, 1.4418 + 1, 1.4419 + 2, 1.4420 + 4, 1.4421 + 6, 1.4422 + 8, 1.4423 + 10, 1.4424 + 13, 1.4425 + 16 1.4426 + ] 1.4427 + ]; 1.4428 +var ACPCMStepSizeTable = [ 1.4429 + 7, 1.4430 + 8, 1.4431 + 9, 1.4432 + 10, 1.4433 + 11, 1.4434 + 12, 1.4435 + 13, 1.4436 + 14, 1.4437 + 16, 1.4438 + 17, 1.4439 + 19, 1.4440 + 21, 1.4441 + 23, 1.4442 + 25, 1.4443 + 28, 1.4444 + 31, 1.4445 + 34, 1.4446 + 37, 1.4447 + 41, 1.4448 + 45, 1.4449 + 50, 1.4450 + 55, 1.4451 + 60, 1.4452 + 66, 1.4453 + 73, 1.4454 + 80, 1.4455 + 88, 1.4456 + 97, 1.4457 + 107, 1.4458 + 118, 1.4459 + 130, 1.4460 + 143, 1.4461 + 157, 1.4462 + 173, 1.4463 + 190, 1.4464 + 209, 1.4465 + 230, 1.4466 + 253, 1.4467 + 279, 1.4468 + 307, 1.4469 + 337, 1.4470 + 371, 1.4471 + 408, 1.4472 + 449, 1.4473 + 494, 1.4474 + 544, 1.4475 + 598, 1.4476 + 658, 1.4477 + 724, 1.4478 + 796, 1.4479 + 876, 1.4480 + 963, 1.4481 + 1060, 1.4482 + 1166, 1.4483 + 1282, 1.4484 + 1411, 1.4485 + 1552, 1.4486 + 1707, 1.4487 + 1878, 1.4488 + 2066, 1.4489 + 2272, 1.4490 + 2499, 1.4491 + 2749, 1.4492 + 3024, 1.4493 + 3327, 1.4494 + 3660, 1.4495 + 4026, 1.4496 + 4428, 1.4497 + 4871, 1.4498 + 5358, 1.4499 + 5894, 1.4500 + 6484, 1.4501 + 7132, 1.4502 + 7845, 1.4503 + 8630, 1.4504 + 9493, 1.4505 + 10442, 1.4506 + 11487, 1.4507 + 12635, 1.4508 + 13899, 1.4509 + 15289, 1.4510 + 16818, 1.4511 + 18500, 1.4512 + 20350, 1.4513 + 22385, 1.4514 + 24623, 1.4515 + 27086, 1.4516 + 29794, 1.4517 + 32767 1.4518 + ]; 1.4519 +function decodeACPCMSoundData(data, pcm16, channels) { 1.4520 + function readBits(n, signed) { 1.4521 + while (dataBufferLength < n) { 1.4522 + dataBuffer = dataBuffer << 8 | data[dataPosition++]; 1.4523 + dataBufferLength += 8; 1.4524 + } 1.4525 + dataBufferLength -= n; 1.4526 + return dataBuffer >>> dataBufferLength & (1 << n) - 1; 1.4527 + } 1.4528 + var dataPosition = 0; 1.4529 + var dataBuffer = 0; 1.4530 + var dataBufferLength = 0; 1.4531 + var pcmPosition = 0; 1.4532 + var codeSize = readBits(2); 1.4533 + var indexTable = ACPCMIndexTables[codeSize]; 1.4534 + while (pcmPosition < pcm16.length) { 1.4535 + var x = pcm16[pcmPosition++] = readBits(16) << 16 >> 16, x2; 1.4536 + var stepIndex = readBits(6), stepIndex2; 1.4537 + if (channels > 1) { 1.4538 + x2 = pcm16[pcmPosition++] = readBits(16) << 16 >> 16; 1.4539 + stepIndex2 = readBits(6); 1.4540 + } 1.4541 + var signMask = 1 << codeSize + 1; 1.4542 + for (var i = 0; i < 4095; i++) { 1.4543 + var nibble = readBits(codeSize + 2); 1.4544 + var step = ACPCMStepSizeTable[stepIndex]; 1.4545 + var sum = 0; 1.4546 + for (var currentBit = signMask >> 1; currentBit; currentBit >>= 1, step >>= 1) { 1.4547 + if (nibble & currentBit) 1.4548 + sum += step; 1.4549 + } 1.4550 + x += (nibble & signMask ? -1 : 1) * (sum + step); 1.4551 + pcm16[pcmPosition++] = x = x < -32768 ? -32768 : x > 32767 ? 32767 : x; 1.4552 + stepIndex += indexTable[nibble & ~signMask]; 1.4553 + stepIndex = stepIndex < 0 ? 0 : stepIndex > 88 ? 88 : stepIndex; 1.4554 + if (channels > 1) { 1.4555 + nibble = readBits(codeSize + 2); 1.4556 + step = ACPCMStepSizeTable[stepIndex2]; 1.4557 + sum = 0; 1.4558 + for (var currentBit = signMask >> 1; currentBit; currentBit >>= 1, step >>= 1) { 1.4559 + if (nibble & currentBit) 1.4560 + sum += step; 1.4561 + } 1.4562 + x2 += (nibble & signMask ? -1 : 1) * (sum + step); 1.4563 + pcm16[pcmPosition++] = x2 = x2 < -32768 ? -32768 : x2 > 32767 ? 32767 : x2; 1.4564 + stepIndex2 += indexTable[nibble & ~signMask]; 1.4565 + stepIndex2 = stepIndex2 < 0 ? 0 : stepIndex2 > 88 ? 88 : stepIndex2; 1.4566 + } 1.4567 + } 1.4568 + } 1.4569 +} 1.4570 +var nextSoundStreamId = 0; 1.4571 +function SwfSoundStream(samplesCount, sampleRate, channels) { 1.4572 + this.streamId = nextSoundStreamId++; 1.4573 + this.samplesCount = samplesCount; 1.4574 + this.sampleRate = sampleRate; 1.4575 + this.channels = channels; 1.4576 + this.format = null; 1.4577 + this.currentSample = 0; 1.4578 +} 1.4579 +SwfSoundStream.prototype = { 1.4580 + get info() { 1.4581 + return { 1.4582 + samplesCount: this.samplesCount, 1.4583 + sampleRate: this.sampleRate, 1.4584 + channels: this.channels, 1.4585 + format: this.format, 1.4586 + streamId: this.streamId 1.4587 + }; 1.4588 + }, 1.4589 + decode: function (data) { 1.4590 + throw new Error('SwfSoundStream.decode: not implemented'); 1.4591 + } 1.4592 +}; 1.4593 +function SwfSoundStream_decode_PCM(data) { 1.4594 + var pcm = new Float32Array(data.length); 1.4595 + for (var i = 0; i < pcm.length; i++) 1.4596 + pcm[i] = (data[i] - 128) / 128; 1.4597 + this.currentSample += pcm.length / this.channels; 1.4598 + return { 1.4599 + streamId: this.streamId, 1.4600 + samplesCount: pcm.length / this.channels, 1.4601 + pcm: pcm 1.4602 + }; 1.4603 +} 1.4604 +function SwfSoundStream_decode_PCM_be(data) { 1.4605 + var pcm = new Float32Array(data.length / 2); 1.4606 + for (var i = 0, j = 0; i < pcm.length; i++, j += 2) 1.4607 + pcm[i] = (data[j] << 24 | data[j + 1] << 16) / 2147483648; 1.4608 + this.currentSample += pcm.length / this.channels; 1.4609 + return { 1.4610 + streamId: this.streamId, 1.4611 + samplesCount: pcm.length / this.channels, 1.4612 + pcm: pcm 1.4613 + }; 1.4614 +} 1.4615 +function SwfSoundStream_decode_PCM_le(data) { 1.4616 + var pcm = new Float32Array(data.length / 2); 1.4617 + for (var i = 0, j = 0; i < pcm.length; i++, j += 2) 1.4618 + pcm[i] = (data[j + 1] << 24 | data[j] << 16) / 2147483648; 1.4619 + this.currentSample += pcm.length / this.channels; 1.4620 + return { 1.4621 + streamId: this.streamId, 1.4622 + samplesCount: pcm.length / this.channels, 1.4623 + pcm: pcm 1.4624 + }; 1.4625 +} 1.4626 +function SwfSoundStream_decode_MP3(data) { 1.4627 + var samplesCount = data[1] << 8 | data[0]; 1.4628 + var seek = data[3] << 8 | data[2]; 1.4629 + this.currentSample += samplesCount; 1.4630 + return { 1.4631 + streamId: this.streamId, 1.4632 + samplesCount: samplesCount, 1.4633 + data: new Uint8Array(data.subarray(4)), 1.4634 + seek: seek 1.4635 + }; 1.4636 +} 1.4637 +function createSoundStream(tag) { 1.4638 + var channels = tag.streamType == SOUND_TYPE_STEREO ? 2 : 1; 1.4639 + var samplesCount = tag.samplesCount; 1.4640 + var sampleRate = SOUND_RATES[tag.streamRate]; 1.4641 + var stream = new SwfSoundStream(samplesCount, sampleRate, channels); 1.4642 + switch (tag.streamCompression) { 1.4643 + case SOUND_FORMAT_PCM_BE: 1.4644 + stream.format = 'wave'; 1.4645 + if (tag.soundSize == SOUND_SIZE_16_BIT) { 1.4646 + stream.decode = SwfSoundStream_decode_PCM_be; 1.4647 + } else { 1.4648 + stream.decode = SwfSoundStream_decode_PCM; 1.4649 + } 1.4650 + break; 1.4651 + case SOUND_FORMAT_PCM_LE: 1.4652 + stream.format = 'wave'; 1.4653 + if (tag.soundSize == SOUND_SIZE_16_BIT) { 1.4654 + stream.decode = SwfSoundStream_decode_PCM_le; 1.4655 + } else { 1.4656 + stream.decode = SwfSoundStream_decode_PCM; 1.4657 + } 1.4658 + break; 1.4659 + case SOUND_FORMAT_MP3: 1.4660 + stream.format = 'mp3'; 1.4661 + stream.decode = SwfSoundStream_decode_MP3; 1.4662 + break; 1.4663 + default: 1.4664 + throw new Error('Unsupported audio format: ' + tag.soundFormat); 1.4665 + } 1.4666 + return stream; 1.4667 +} 1.4668 +function defineText(tag, dictionary) { 1.4669 + var dependencies = []; 1.4670 + if (tag.hasFont) { 1.4671 + var font = dictionary[tag.fontId]; 1.4672 + tag.font = font.uniqueName; 1.4673 + dependencies.push(font.id); 1.4674 + } 1.4675 + var props = { 1.4676 + type: 'text', 1.4677 + id: tag.id, 1.4678 + variableName: tag.variableName, 1.4679 + tag: tag 1.4680 + }; 1.4681 + if (dependencies.length) 1.4682 + props.require = dependencies; 1.4683 + return props; 1.4684 +} 1.4685 +var isWorker = typeof window === 'undefined'; 1.4686 +if (isWorker) { 1.4687 + importScripts('../../../lib/mp3/mp3.js'); 1.4688 + self.addEventListener('message', function (e) { 1.4689 + var data = e.data; 1.4690 + var sessionId = data.sessionId; 1.4691 + try { 1.4692 + switch (data.action) { 1.4693 + case 'create': 1.4694 + var session = new Session(sessionId); 1.4695 + sessions[sessionId] = session; 1.4696 + break; 1.4697 + case 'close': 1.4698 + var session = sessions[sessionId]; 1.4699 + if (session) { 1.4700 + session.close(); 1.4701 + sessions[sessionId] = null; 1.4702 + } 1.4703 + break; 1.4704 + case 'decode': 1.4705 + var session = sessions[sessionId]; 1.4706 + if (!session) { 1.4707 + throw new Error('mp3 decoding session is unavailable'); 1.4708 + } 1.4709 + session.decode(data.data); 1.4710 + break; 1.4711 + } 1.4712 + } catch (ex) { 1.4713 + self.postMessage({ 1.4714 + sessionId: sessionId, 1.4715 + action: 'error', 1.4716 + message: ex.message 1.4717 + }); 1.4718 + } 1.4719 + }, false); 1.4720 + var sessions = {}; 1.4721 + function Session(id) { 1.4722 + this.id = id; 1.4723 + if (typeof MP3Decoder === 'undefined') { 1.4724 + throw new Error('mp3 decoder is not available'); 1.4725 + } 1.4726 + var decoder = new MP3Decoder(); 1.4727 + decoder.onframedata = function (frameData, channels, sampleRate, bitRate) { 1.4728 + self.postMessage({ 1.4729 + sessionId: this.id, 1.4730 + action: 'frame', 1.4731 + frameData: frameData, 1.4732 + channels: channels, 1.4733 + sampleRate: sampleRate, 1.4734 + bitRate: bitRate 1.4735 + }); 1.4736 + }.bind(this); 1.4737 + decoder.onid3tag = function (data) { 1.4738 + self.postMessage({ 1.4739 + sessionId: this.id, 1.4740 + action: 'id3', 1.4741 + id3Data: data 1.4742 + }); 1.4743 + }.bind(this); 1.4744 + this.decoder = decoder; 1.4745 + } 1.4746 + Session.prototype = { 1.4747 + decode: function (data) { 1.4748 + this.decoder.push(data); 1.4749 + }, 1.4750 + close: function () { 1.4751 + self.postMessage({ 1.4752 + sessionId: this.id, 1.4753 + action: 'closed' 1.4754 + }); 1.4755 + } 1.4756 + }; 1.4757 + self.console = { 1.4758 + log: function (s) { 1.4759 + self.postMessage({ 1.4760 + action: 'console', 1.4761 + method: 'log', 1.4762 + message: s 1.4763 + }); 1.4764 + }, 1.4765 + error: function (s) { 1.4766 + self.postMessage({ 1.4767 + action: 'console', 1.4768 + method: 'error', 1.4769 + message: s 1.4770 + }); 1.4771 + } 1.4772 + }; 1.4773 +} else { 1.4774 + var mp3Worker; 1.4775 + function createMP3Worker() { 1.4776 + var worker = new Worker(SHUMWAY_ROOT + 'swf/mp3worker.js'); 1.4777 + worker.addEventListener('message', function (e) { 1.4778 + if (e.data.action === 'console') { 1.4779 + console[e.data.method].call(console, e.data.message); 1.4780 + } 1.4781 + }); 1.4782 + return worker; 1.4783 + } 1.4784 + var nextSessionId = 0; 1.4785 + function MP3DecoderSession() { 1.4786 + mp3Worker = mp3Worker || createMP3Worker(); 1.4787 + var sessionId = nextSessionId++; 1.4788 + this.id = sessionId; 1.4789 + this.onworkermessage = function (e) { 1.4790 + if (e.data.sessionId !== sessionId) 1.4791 + return; 1.4792 + var action = e.data.action; 1.4793 + switch (action) { 1.4794 + case 'closed': 1.4795 + if (this.onclosed) 1.4796 + this.onclosed(); 1.4797 + mp3Worker.removeEventListener('message', this.onworkermessage, false); 1.4798 + break; 1.4799 + case 'frame': 1.4800 + this.onframedata(e.data.frameData, e.data.channels, e.data.sampleRate, e.data.bitRate); 1.4801 + break; 1.4802 + case 'id3': 1.4803 + if (this.onid3tag) 1.4804 + this.onid3tag(e.data.id3Data); 1.4805 + break; 1.4806 + case 'error': 1.4807 + if (this.onerror) 1.4808 + this.onerror(e.data.message); 1.4809 + break; 1.4810 + } 1.4811 + }.bind(this); 1.4812 + mp3Worker.addEventListener('message', this.onworkermessage, false); 1.4813 + mp3Worker.postMessage({ 1.4814 + sessionId: sessionId, 1.4815 + action: 'create' 1.4816 + }); 1.4817 + } 1.4818 + MP3DecoderSession.prototype = { 1.4819 + pushAsync: function (data) { 1.4820 + mp3Worker.postMessage({ 1.4821 + sessionId: this.id, 1.4822 + action: 'decode', 1.4823 + data: data 1.4824 + }); 1.4825 + }, 1.4826 + close: function () { 1.4827 + mp3Worker.postMessage({ 1.4828 + sessionId: this.id, 1.4829 + action: 'close' 1.4830 + }); 1.4831 + } 1.4832 + }; 1.4833 + MP3DecoderSession.processAll = function (data, onloaded) { 1.4834 + var currentBufferSize = 8000; 1.4835 + var currentBuffer = new Float32Array(currentBufferSize); 1.4836 + var bufferPosition = 0; 1.4837 + var id3Tags = []; 1.4838 + var sessionAborted = false; 1.4839 + var session = new MP3DecoderSession(); 1.4840 + session.onframedata = function (frameData, channels, sampleRate, bitRate) { 1.4841 + var needed = frameData.length + bufferPosition; 1.4842 + if (needed > currentBufferSize) { 1.4843 + do { 1.4844 + currentBufferSize *= 2; 1.4845 + } while (needed > currentBufferSize); 1.4846 + var newBuffer = new Float32Array(currentBufferSize); 1.4847 + newBuffer.set(currentBuffer); 1.4848 + currentBuffer = newBuffer; 1.4849 + } 1.4850 + currentBuffer.set(frameData, bufferPosition); 1.4851 + bufferPosition += frameData.length; 1.4852 + }; 1.4853 + session.onid3tag = function (tagData) { 1.4854 + id3Tags.push(tagData); 1.4855 + }; 1.4856 + session.onclosed = function () { 1.4857 + if (sessionAborted) 1.4858 + return; 1.4859 + onloaded(currentBuffer.subarray(0, bufferPosition), id3Tags); 1.4860 + }; 1.4861 + session.onerror = function (error) { 1.4862 + if (sessionAborted) 1.4863 + return; 1.4864 + sessionAborted = true; 1.4865 + onloaded(null, null, error); 1.4866 + }; 1.4867 + session.pushAsync(data); 1.4868 + session.close(); 1.4869 + }; 1.4870 +} 1.4871 +SWF.embed = function (file, doc, container, options) { 1.4872 + var canvas = doc.createElement('canvas'); 1.4873 + var ctx = canvas.getContext('2d'); 1.4874 + var loader = new flash.display.Loader(); 1.4875 + var loaderInfo = loader._contentLoaderInfo; 1.4876 + var stage = new flash.display.Stage(); 1.4877 + var pixelRatio = 1; 1.4878 + var forceHidpiSetting = forceHidpi.value; 1.4879 + stage._loader = loader; 1.4880 + loaderInfo._parameters = options.movieParams; 1.4881 + loaderInfo._url = options.url || (typeof file === 'string' ? file : null); 1.4882 + loaderInfo._loaderURL = options.loaderURL || loaderInfo._url; 1.4883 + loader._parent = stage; 1.4884 + loader._stage = stage; 1.4885 + function setCanvasSize(width, height) { 1.4886 + if (pixelRatio === 1) { 1.4887 + canvas.width = width | 0; 1.4888 + canvas.height = height | 0; 1.4889 + return; 1.4890 + } 1.4891 + var canvasWidth = Math.floor(width * pixelRatio); 1.4892 + var canvasHeight = Math.floor(height * pixelRatio); 1.4893 + canvas.style.width = canvasWidth / pixelRatio + 'px'; 1.4894 + canvas.style.height = canvasHeight / pixelRatio + 'px'; 1.4895 + canvas.width = canvasWidth; 1.4896 + canvas.height = canvasHeight; 1.4897 + } 1.4898 + function fitCanvas(container) { 1.4899 + setCanvasSize(container.clientWidth, container.clientHeight); 1.4900 + stage._invalid = true; 1.4901 + } 1.4902 + loaderInfo._addEventListener('init', function () { 1.4903 + if (forceHidpiSetting || loaderInfo._swfVersion >= 18) { 1.4904 + pixelRatio = 'devicePixelRatio' in window ? window.devicePixelRatio : 1; 1.4905 + } 1.4906 + canvas._pixelRatio = pixelRatio; 1.4907 + stage._contentsScaleFactor = pixelRatio; 1.4908 + if (container.clientHeight) { 1.4909 + fitCanvas(container); 1.4910 + window.addEventListener('resize', function () { 1.4911 + fitCanvas(container); 1.4912 + }); 1.4913 + } else { 1.4914 + setCanvasSize(stage._stageWidth / 20, stage._stageHeight / 20); 1.4915 + } 1.4916 + container.setAttribute('style', 'position: relative'); 1.4917 + canvas.addEventListener('click', function () { 1.4918 + ShumwayKeyboardListener.focus = stage; 1.4919 + stage._mouseTarget._dispatchEvent('click'); 1.4920 + }); 1.4921 + canvas.addEventListener('dblclick', function () { 1.4922 + if (stage._mouseTarget._doubleClickEnabled) { 1.4923 + stage._mouseTarget._dispatchEvent('doubleClick'); 1.4924 + } 1.4925 + }); 1.4926 + canvas.addEventListener('mousedown', function () { 1.4927 + stage._mouseEvents.push('mousedown'); 1.4928 + }); 1.4929 + canvas.addEventListener('mousemove', function (domEvt) { 1.4930 + var node = this; 1.4931 + var left = 0; 1.4932 + var top = 0; 1.4933 + if (node.offsetParent) { 1.4934 + do { 1.4935 + left += node.offsetLeft; 1.4936 + top += node.offsetTop; 1.4937 + } while (node = node.offsetParent); 1.4938 + } 1.4939 + var m = stage._concatenatedTransform; 1.4940 + var mouseX = ((domEvt.pageX - left) * pixelRatio - m.tx / 20) / m.a; 1.4941 + var mouseY = ((domEvt.pageY - top) * pixelRatio - m.ty / 20) / m.d; 1.4942 + if (mouseX !== stage._mouseX || mouseY !== stage._mouseY) { 1.4943 + stage._mouseMoved = true; 1.4944 + stage._mouseX = mouseX * 20; 1.4945 + stage._mouseY = mouseY * 20; 1.4946 + } 1.4947 + }); 1.4948 + canvas.addEventListener('mouseup', function () { 1.4949 + stage._mouseEvents.push('mouseup'); 1.4950 + }); 1.4951 + canvas.addEventListener('mouseover', function () { 1.4952 + stage._mouseMoved = true; 1.4953 + stage._mouseOver = true; 1.4954 + }); 1.4955 + canvas.addEventListener('mouseout', function () { 1.4956 + stage._mouseMoved = true; 1.4957 + stage._mouseOver = false; 1.4958 + }); 1.4959 + window.addEventListener('message', function (evt) { 1.4960 + var data = evt.data; 1.4961 + if (typeof data !== 'object' || data === null) { 1.4962 + return; 1.4963 + } 1.4964 + var type = data.type; 1.4965 + switch (type) { 1.4966 + case 'mousemove': 1.4967 + case 'mouseup': 1.4968 + case 'mousedown': 1.4969 + var isMouseMove = type === 'mousemove'; 1.4970 + stage._mouseMoved = true; 1.4971 + stage._mouseOver = true; 1.4972 + stage._mouseX = data.x * 20; 1.4973 + stage._mouseY = data.y * 20; 1.4974 + if (!isMouseMove) { 1.4975 + stage._mouseEvents.push(type); 1.4976 + } 1.4977 + break; 1.4978 + case 'mouseover': 1.4979 + case 'mouseout': 1.4980 + stage._mouseMoved = true; 1.4981 + stage._mouseOver = type === 'mouseover'; 1.4982 + break; 1.4983 + case 'keyup': 1.4984 + case 'keydown': 1.4985 + stage._dispatchEvent(new flash.events.KeyboardEvent(type === 'keyup' ? 'keyUp' : 'keyDown', true, false, data.charCode, data.keyCode, data.keyLocation, data.ctrlKey || false, data.altKey || false, data.shiftKey || false)); 1.4986 + break; 1.4987 + } 1.4988 + }, false); 1.4989 + var bgcolor = loaderInfo._backgroundColor; 1.4990 + if (options.objectParams) { 1.4991 + var m; 1.4992 + if (options.objectParams.bgcolor && (m = /#([0-9A-F]{6})/i.exec(options.objectParams.bgcolor))) { 1.4993 + var hexColor = parseInt(m[1], 16); 1.4994 + bgcolor = { 1.4995 + red: hexColor >> 16 & 255, 1.4996 + green: hexColor >> 8 & 255, 1.4997 + blue: hexColor & 255, 1.4998 + alpha: 255 1.4999 + }; 1.5000 + } 1.5001 + if (options.objectParams.wmode === 'transparent') { 1.5002 + bgcolor = { 1.5003 + red: 0, 1.5004 + green: 0, 1.5005 + blue: 0, 1.5006 + alpha: 0 1.5007 + }; 1.5008 + } 1.5009 + } 1.5010 + stage._color = bgcolor; 1.5011 + ctx.fillStyle = rgbaObjToStr(bgcolor); 1.5012 + ctx.fillRect(0, 0, canvas.width, canvas.height); 1.5013 + var root = loader._content; 1.5014 + root._dispatchEvent('added', undefined, true); 1.5015 + root._dispatchEvent('addedToStage'); 1.5016 + container.appendChild(canvas); 1.5017 + stage._domContainer = container; 1.5018 + if (options.onStageInitialized) { 1.5019 + options.onStageInitialized(stage); 1.5020 + } 1.5021 + var startPromise = options.startPromise || Promise.resolve(); 1.5022 + startPromise.then(function () { 1.5023 + renderStage(stage, ctx, options); 1.5024 + }); 1.5025 + }); 1.5026 + if (options.onParsed) { 1.5027 + loaderInfo._addEventListener('parsed', function () { 1.5028 + options.onParsed(); 1.5029 + }); 1.5030 + } 1.5031 + if (options.onComplete) { 1.5032 + loaderInfo._addEventListener('complete', function () { 1.5033 + options.onComplete(); 1.5034 + }); 1.5035 + } 1.5036 + loader._load(typeof file === 'string' ? new flash.net.URLRequest(file) : file); 1.5037 + return loader; 1.5038 +}; 1.5039 +var rendererOptions = coreOptions.register(new OptionSet('Renderer Options')); 1.5040 +var traceRenderer = rendererOptions.register(new Option('tr', 'traceRenderer', 'number', 0, 'trace renderer execution')); 1.5041 +var disableRenderVisitor = rendererOptions.register(new Option('drv', 'disableRenderVisitor', 'boolean', false, 'disable render visitor')); 1.5042 +var disableMouseVisitor = rendererOptions.register(new Option('dmv', 'disableMouseVisitor', 'boolean', false, 'disable mouse visitor')); 1.5043 +var showRedrawRegions = rendererOptions.register(new Option('rr', 'showRedrawRegions', 'boolean', false, 'show redraw regions')); 1.5044 +var renderAsWireframe = rendererOptions.register(new Option('raw', 'renderAsWireframe', 'boolean', false, 'render as wireframe')); 1.5045 +var showQuadTree = rendererOptions.register(new Option('qt', 'showQuadTree', 'boolean', false, 'show quad tree')); 1.5046 +var turboMode = rendererOptions.register(new Option('', 'turbo', 'boolean', false, 'turbo mode')); 1.5047 +var forceHidpi = rendererOptions.register(new Option('', 'forceHidpi', 'boolean', false, 'force hidpi')); 1.5048 +var skipFrameDraw = rendererOptions.register(new Option('', 'skipFrameDraw', 'boolean', false, 'skip frame when not on time')); 1.5049 +var hud = rendererOptions.register(new Option('', 'hud', 'boolean', false, 'show hud mode')); 1.5050 +var dummyAnimation = rendererOptions.register(new Option('', 'dummy', 'boolean', false, 'show test balls animation')); 1.5051 +var enableConstructChildren = rendererOptions.register(new Option('', 'constructChildren', 'boolean', true, 'Construct Children')); 1.5052 +var enableEnterFrame = rendererOptions.register(new Option('', 'enterFrame', 'boolean', true, 'Enter Frame')); 1.5053 +var enableAdvanceFrame = rendererOptions.register(new Option('', 'advanceFrame', 'boolean', true, 'Advance Frame')); 1.5054 +var CanvasCache = { 1.5055 + cache: [], 1.5056 + getCanvas: function getCanvas(protoCanvas) { 1.5057 + var tempCanvas = this.cache.shift(); 1.5058 + if (!tempCanvas) { 1.5059 + tempCanvas = { 1.5060 + canvas: document.createElement('canvas') 1.5061 + }; 1.5062 + tempCanvas.ctx = tempCanvas.canvas.getContext('2d'); 1.5063 + } 1.5064 + tempCanvas.canvas.width = protoCanvas.width; 1.5065 + tempCanvas.canvas.height = protoCanvas.height; 1.5066 + tempCanvas.ctx.save(); 1.5067 + return tempCanvas; 1.5068 + }, 1.5069 + releaseCanvas: function releaseCanvas(tempCanvas) { 1.5070 + tempCanvas.ctx.restore(); 1.5071 + this.cache.push(tempCanvas); 1.5072 + } 1.5073 + }; 1.5074 +function isCanvasVisible(canvas) { 1.5075 + if (canvas.ownerDocument.hidden) { 1.5076 + return false; 1.5077 + } 1.5078 + if (canvas.mozVisible === false) { 1.5079 + return false; 1.5080 + } 1.5081 + return true; 1.5082 +} 1.5083 +function visitContainer(container, visitor, context) { 1.5084 + var children = container._children; 1.5085 + visitor.childrenStart(container); 1.5086 + for (var i = 0, n = children.length; i < n; i++) { 1.5087 + var child = children[i]; 1.5088 + if (!child) { 1.5089 + continue; 1.5090 + } 1.5091 + if (visitor.ignoreVisibleAttribute || child._visible && !child._maskedObject) { 1.5092 + visitor.visit(child, visitContainer, context); 1.5093 + } 1.5094 + } 1.5095 + visitor.childrenEnd(container); 1.5096 +} 1.5097 +var BlendModeNameMap = { 1.5098 + 'normal': 'normal', 1.5099 + 'multiply': 'multiply', 1.5100 + 'screen': 'screen', 1.5101 + 'lighten': 'lighten', 1.5102 + 'darken': 'darken', 1.5103 + 'difference': 'difference', 1.5104 + 'overlay': 'overlay', 1.5105 + 'hardlight': 'hard-light' 1.5106 + }; 1.5107 +function getBlendModeName(blendMode) { 1.5108 + return BlendModeNameMap[blendMode] || 'normal'; 1.5109 +} 1.5110 +function RenderVisitor(root, ctx, invalidPath, refreshStage) { 1.5111 + this.root = root; 1.5112 + this.ctx = ctx; 1.5113 + this.depth = 0; 1.5114 + this.invalidPath = invalidPath; 1.5115 + this.refreshStage = refreshStage; 1.5116 + this.clipDepth = null; 1.5117 + this.clipStack = null; 1.5118 +} 1.5119 +RenderVisitor.prototype = { 1.5120 + ignoreVisibleAttribute: false, 1.5121 + start: function () { 1.5122 + visitContainer(this.root, this, new RenderingContext(this.refreshStage, this.invalidPath)); 1.5123 + }, 1.5124 + startFragment: function (matrix) { 1.5125 + var root = this.root; 1.5126 + var currentTransform = root._currentTransform; 1.5127 + var t = currentTransform; 1.5128 + if (matrix) { 1.5129 + t = root._currentTransform = { 1.5130 + a: matrix.a, 1.5131 + b: matrix.b, 1.5132 + c: matrix.c, 1.5133 + d: matrix.d, 1.5134 + tx: matrix.tx * 20 | 0, 1.5135 + ty: matrix.ty * 20 | 0 1.5136 + }; 1.5137 + root._invalidateTransform(); 1.5138 + } 1.5139 + var inverse; 1.5140 + if (t) { 1.5141 + inverse = new flash.geom.Matrix(t.a, t.b, t.c, t.d, t.tx / 20, t.ty / 20); 1.5142 + inverse.invert(); 1.5143 + this.ctx.save(); 1.5144 + this.ctx.transform(inverse.a, inverse.b, inverse.c, inverse.d, inverse.tx, inverse.ty); 1.5145 + } 1.5146 + this.visit(root, visitContainer, new RenderingContext(this.refreshStage, this.invalidPath)); 1.5147 + if (t) { 1.5148 + this.ctx.restore(); 1.5149 + } 1.5150 + if (matrix) { 1.5151 + root._currentTransform = currentTransform; 1.5152 + root._invalidateTransform(); 1.5153 + } 1.5154 + }, 1.5155 + childrenStart: function (parent) { 1.5156 + if (this.depth === 0) { 1.5157 + var ctx = this.ctx; 1.5158 + ctx.save(); 1.5159 + if (this.invalidPath && !this.refreshStage && !renderAsWireframe.value) { 1.5160 + this.invalidPath.draw(ctx, false, 0, null); 1.5161 + ctx.clip(); 1.5162 + } 1.5163 + var bgcolor = this.root._color; 1.5164 + if (bgcolor) { 1.5165 + if (bgcolor.alpha < 255) { 1.5166 + ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); 1.5167 + } 1.5168 + if (bgcolor.alpha > 0) { 1.5169 + ctx.fillStyle = rgbaObjToStr(bgcolor); 1.5170 + if (this.invalidPath && !this.refreshStage && !renderAsWireframe.value) { 1.5171 + ctx.fill(); 1.5172 + } else { 1.5173 + ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); 1.5174 + } 1.5175 + } 1.5176 + } 1.5177 + ctx.mozFillRule = 'evenodd'; 1.5178 + } 1.5179 + this.depth++; 1.5180 + if (this.clipDepth && this.clipDepth.length > 0) { 1.5181 + this.clipStack = { 1.5182 + depth: this.depth, 1.5183 + clip: this.clipDepth, 1.5184 + next: this.clipStack 1.5185 + }; 1.5186 + this.clipDepth = null; 1.5187 + } 1.5188 + }, 1.5189 + childrenEnd: function (parent) { 1.5190 + if (this.clipDepth) { 1.5191 + while (this.clipDepth.length > 0) { 1.5192 + var clipDepthInfo = this.clipDepth.pop(); 1.5193 + this.clipEnd(clipDepthInfo); 1.5194 + this.ctx = clipDepthInfo.ctx; 1.5195 + } 1.5196 + this.clipDepth = null; 1.5197 + } 1.5198 + if (this.clipStack && this.clipStack.depth === this.depth) { 1.5199 + this.clipDepth = this.clipStack.clip; 1.5200 + this.clipStack = this.clipStack.next; 1.5201 + } 1.5202 + this.depth--; 1.5203 + if (this.depth === 0) { 1.5204 + this.ctx.restore(); 1.5205 + this.invalidPath = null; 1.5206 + } 1.5207 + }, 1.5208 + visit: function (child, visitContainer, context) { 1.5209 + var ctx = this.ctx; 1.5210 + var parentHasClippingMask = context.isClippingMask; 1.5211 + var parentColorTransform = context.colorTransform; 1.5212 + var clippingMask = parentHasClippingMask === true; 1.5213 + if (child._cxform) { 1.5214 + context.colorTransform = parentColorTransform.applyCXForm(child._cxform); 1.5215 + } 1.5216 + if (!clippingMask) { 1.5217 + while (this.clipDepth && this.clipDepth.length > 0 && child._depth > this.clipDepth[0].clipDepth) { 1.5218 + var clipDepthInfo = this.clipDepth.shift(); 1.5219 + this.clipEnd(clipDepthInfo); 1.5220 + context.parentCtxs.shift(); 1.5221 + ctx = this.ctx = clipDepthInfo.ctx; 1.5222 + } 1.5223 + if (this.clipDepth && this.clipDepth.length > 0 && child._depth <= this.clipDepth[0].clipDepth) { 1.5224 + ctx = this.ctx = this.clipDepth[0].maskee.ctx; 1.5225 + } 1.5226 + if (child._clipDepth) { 1.5227 + context.isClippingMask = clippingMask = true; 1.5228 + var clipDepthInfo = this.clipStart(child); 1.5229 + if (!this.clipDepth) { 1.5230 + this.clipDepth = [ 1.5231 + clipDepthInfo 1.5232 + ]; 1.5233 + } else { 1.5234 + this.clipDepth.unshift(clipDepthInfo); 1.5235 + } 1.5236 + context.parentCtxs.unshift(ctx); 1.5237 + ctx = this.ctx = clipDepthInfo.mask.ctx; 1.5238 + } 1.5239 + } 1.5240 + if (clippingMask && child._isContainer) { 1.5241 + ctx.save(); 1.5242 + renderDisplayObject(child, ctx, context); 1.5243 + for (var i = 0, n = child._children.length; i < n; i++) { 1.5244 + var child1 = child._children[i]; 1.5245 + if (!child1) { 1.5246 + continue; 1.5247 + } 1.5248 + if (this.ignoreVisibleAttribute || child1._visible && !child1._maskedObject) { 1.5249 + this.visit(child1, visitContainer, context); 1.5250 + } 1.5251 + } 1.5252 + ctx.restore(); 1.5253 + ctx.fill(); 1.5254 + context.isClippingMask = parentHasClippingMask; 1.5255 + context.colorTransform = parentColorTransform; 1.5256 + return; 1.5257 + } 1.5258 + ctx.save(); 1.5259 + ctx.globalCompositeOperation = getBlendModeName(child._blendMode); 1.5260 + if (child._mask) { 1.5261 + var clipInfo = this.clipStart(child); 1.5262 + var mask = clipInfo.mask; 1.5263 + var maskee = clipInfo.maskee; 1.5264 + context.parentCtxs.push(ctx); 1.5265 + var savedClipDepth = this.clipDepth; 1.5266 + this.clipDepth = null; 1.5267 + this.ctx = mask.ctx; 1.5268 + this.visit(child._mask, visitContainer, new RenderingContext(this.refreshStage)); 1.5269 + this.ctx = ctx; 1.5270 + this.clipDepth = savedClipDepth; 1.5271 + renderDisplayObject(child, maskee.ctx, context); 1.5272 + if (child._isContainer) { 1.5273 + this.ctx = maskee.ctx; 1.5274 + visitContainer(child, this, context); 1.5275 + this.ctx = ctx; 1.5276 + } 1.5277 + context.parentCtxs.pop(); 1.5278 + this.clipEnd(clipInfo); 1.5279 + } else { 1.5280 + renderDisplayObject(child, ctx, context); 1.5281 + if (child._isContainer) { 1.5282 + visitContainer(child, this, context); 1.5283 + } 1.5284 + } 1.5285 + ctx.restore(); 1.5286 + if (clippingMask) { 1.5287 + ctx.fill(); 1.5288 + } 1.5289 + context.isClippingMask = parentHasClippingMask; 1.5290 + context.colorTransform = parentColorTransform; 1.5291 + }, 1.5292 + clipStart: function (child) { 1.5293 + var m = child._parent._getConcatenatedTransform(null, true); 1.5294 + var tx = m.tx / 20; 1.5295 + var ty = m.ty / 20; 1.5296 + var mask = CanvasCache.getCanvas(this.ctx.canvas); 1.5297 + mask.ctx.setTransform(m.a, m.b, m.c, m.d, tx, ty); 1.5298 + var maskee = CanvasCache.getCanvas(this.ctx.canvas); 1.5299 + maskee.ctx.setTransform(m.a, m.b, m.c, m.d, tx, ty); 1.5300 + var clipInfo = { 1.5301 + ctx: this.ctx, 1.5302 + mask: mask, 1.5303 + maskee: maskee, 1.5304 + clipDepth: child._clipDepth 1.5305 + }; 1.5306 + return clipInfo; 1.5307 + }, 1.5308 + clipEnd: function (clipInfo) { 1.5309 + var ctx = clipInfo.ctx; 1.5310 + var mask = clipInfo.mask; 1.5311 + var maskee = clipInfo.maskee; 1.5312 + maskee.ctx.globalCompositeOperation = 'destination-in'; 1.5313 + maskee.ctx.setTransform(1, 0, 0, 1, 0, 0); 1.5314 + maskee.ctx.drawImage(mask.canvas, 0, 0); 1.5315 + ctx.save(); 1.5316 + ctx.setTransform(1, 0, 0, 1, 0, 0); 1.5317 + ctx.drawImage(maskee.canvas, 0, 0); 1.5318 + ctx.restore(); 1.5319 + CanvasCache.releaseCanvas(mask); 1.5320 + CanvasCache.releaseCanvas(maskee); 1.5321 + } 1.5322 +}; 1.5323 +function RenderingColorTransform() { 1.5324 + this.mode = null; 1.5325 + this.transform = [ 1.5326 + 1, 1.5327 + 1, 1.5328 + 1, 1.5329 + 1, 1.5330 + 0, 1.5331 + 0, 1.5332 + 0, 1.5333 + 0 1.5334 + ]; 1.5335 +} 1.5336 +RenderingColorTransform.prototype = { 1.5337 + applyCXForm: function (cxform) { 1.5338 + var t = this.transform; 1.5339 + t = [ 1.5340 + t[0] * cxform.redMultiplier / 256, 1.5341 + t[1] * cxform.greenMultiplier / 256, 1.5342 + t[2] * cxform.blueMultiplier / 256, 1.5343 + t[3] * cxform.alphaMultiplier / 256, 1.5344 + t[4] * cxform.redMultiplier / 256 + cxform.redOffset, 1.5345 + t[5] * cxform.greenMultiplier / 256 + cxform.greenOffset, 1.5346 + t[6] * cxform.blueMultiplier / 256 + cxform.blueOffset, 1.5347 + t[7] * cxform.alphaMultiplier / 256 + cxform.alphaOffset 1.5348 + ]; 1.5349 + var mode; 1.5350 + var PRECISION = 0.0001; 1.5351 + if (Math.abs(t[0] - 1) < PRECISION && Math.abs(t[1] - 1) < PRECISION && Math.abs(t[2] - 1) < PRECISION && t[3] >= 0 && Math.abs(t[4]) < PRECISION && Math.abs(t[5]) < PRECISION && Math.abs(t[6]) < PRECISION && Math.abs(t[7]) < PRECISION) { 1.5352 + mode = Math.abs(t[3] - 1) < PRECISION ? null : 'simple'; 1.5353 + } else { 1.5354 + mode = 'complex'; 1.5355 + } 1.5356 + var clone = Object.create(RenderingColorTransform.prototype); 1.5357 + clone.mode = mode; 1.5358 + clone.transform = t; 1.5359 + return clone; 1.5360 + }, 1.5361 + setFillStyle: function (ctx, style) { 1.5362 + if (this.mode === 'complex') { 1.5363 + style = typeof style === 'function' ? style(ctx, this) : this.convertColor(style); 1.5364 + } else if (typeof style === 'number') { 1.5365 + style = this.convertNumericColor(style); 1.5366 + } else if (typeof style === 'function') { 1.5367 + style = style.defaultFillStyle; 1.5368 + } 1.5369 + ctx.fillStyle = style; 1.5370 + }, 1.5371 + setStrokeStyle: function (ctx, style) { 1.5372 + if (this.mode === 'complex') { 1.5373 + style = typeof style === 'function' ? style(ctx, this) : this.convertColor(style); 1.5374 + } else if (typeof style === 'number') { 1.5375 + style = this.convertNumericColor(style); 1.5376 + } else if (typeof style === 'function') { 1.5377 + style = style.defaultFillStyle; 1.5378 + } 1.5379 + ctx.strokeStyle = style; 1.5380 + }, 1.5381 + addGradientColorStop: function (gradient, ratio, style) { 1.5382 + if (this.mode === 'complex') { 1.5383 + style = this.convertColor(style); 1.5384 + } else if (typeof style === 'number') { 1.5385 + style = this.convertNumericColor(style); 1.5386 + } 1.5387 + gradient.addColorStop(ratio, style); 1.5388 + }, 1.5389 + setAlpha: function (ctx, force) { 1.5390 + if (this.mode === 'simple' || force) { 1.5391 + var t = this.transform; 1.5392 + ctx.globalAlpha = Math.min(1, Math.max(0, ctx.globalAlpha * t[3])); 1.5393 + } 1.5394 + }, 1.5395 + convertNumericColor: function (num) { 1.5396 + return '#' + (num | 16777216).toString(16).substr(1); 1.5397 + }, 1.5398 + convertColor: function (style) { 1.5399 + var t = this.transform; 1.5400 + var m; 1.5401 + switch (typeof style) { 1.5402 + case 'string': 1.5403 + if (style[0] === '#') { 1.5404 + m = [ 1.5405 + undefined, 1.5406 + parseInt(style.substr(1, 2), 16), 1.5407 + parseInt(style.substr(3, 2), 16), 1.5408 + parseInt(style.substr(5, 2), 16), 1.5409 + 1 1.5410 + ]; 1.5411 + } 1.5412 + m = m || /rgba\(([^,]+),([^,]+),([^,]+),([^)]+)\)/.exec(style); 1.5413 + if (!m) { 1.5414 + return style; 1.5415 + } 1.5416 + break; 1.5417 + case 'number': 1.5418 + m = [ 1.5419 + style, 1.5420 + style >> 16 & 255, 1.5421 + style >> 8 & 255, 1.5422 + style & 255, 1.5423 + 1 1.5424 + ]; 1.5425 + break; 1.5426 + default: 1.5427 + return style; 1.5428 + } 1.5429 + var r = Math.min(255, Math.max(0, m[1] * t[0] + t[4])) | 0; 1.5430 + var g = Math.min(255, Math.max(0, m[2] * t[1] + t[5])) | 0; 1.5431 + var b = Math.min(255, Math.max(0, m[3] * t[2] + t[6])) | 0; 1.5432 + var a = Math.min(1, Math.max(0, m[4] * t[3] + t[7] / 256)); 1.5433 + return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; 1.5434 + }, 1.5435 + getTransformFingerprint: function () { 1.5436 + return this.transform.join('|'); 1.5437 + } 1.5438 +}; 1.5439 +function RenderingContext(refreshStage, invalidPath) { 1.5440 + this.refreshStage = refreshStage === true; 1.5441 + this.invalidPath = invalidPath; 1.5442 + this.isClippingMask = false; 1.5443 + this.colorTransform = new RenderingColorTransform(); 1.5444 + this.parentCtxs = []; 1.5445 +} 1.5446 +function renderDisplayObject(child, ctx, context) { 1.5447 + var m = child._currentTransform; 1.5448 + if (m) { 1.5449 + ctx.transform(m.a, m.b, m.c, m.d, m.tx / 20, m.ty / 20); 1.5450 + } 1.5451 + if (!renderAsWireframe.value) { 1.5452 + if (child._alpha !== 1) { 1.5453 + ctx.globalAlpha *= child._alpha; 1.5454 + } 1.5455 + if (context.invalidPath && !child._invalid && !context.refreshStage) { 1.5456 + return; 1.5457 + } 1.5458 + if (child._graphics) { 1.5459 + var graphics = child._graphics; 1.5460 + if (graphics._bitmap) { 1.5461 + ctx.save(); 1.5462 + ctx.translate(child._bbox.xMin / 20, child._bbox.yMin / 20); 1.5463 + context.colorTransform.setAlpha(ctx, true); 1.5464 + ctx.drawImage(graphics._bitmap, 0, 0); 1.5465 + ctx.restore(); 1.5466 + } else { 1.5467 + var ratio = child.ratio; 1.5468 + if (ratio === undefined) { 1.5469 + ratio = 0; 1.5470 + } 1.5471 + graphics.draw(ctx, context.isClippingMask, ratio, context.colorTransform); 1.5472 + } 1.5473 + } 1.5474 + if (child.draw) { 1.5475 + child.draw(ctx, child.ratio, context.colorTransform, context.parentCtxs); 1.5476 + } 1.5477 + } else { 1.5478 + if (!child._invalid && !context.refreshStage) { 1.5479 + return; 1.5480 + } 1.5481 + if (child.getBounds) { 1.5482 + var b = child.getBounds(null); 1.5483 + if (b && b.xMax - b.xMin > 0 && b.yMax - b.yMin > 0) { 1.5484 + if (!child._wireframeStrokeStyle) { 1.5485 + child._wireframeStrokeStyle = randomStyle(); 1.5486 + } 1.5487 + ctx.save(); 1.5488 + ctx.strokeStyle = child._wireframeStrokeStyle; 1.5489 + var x = b.xMin / 20; 1.5490 + var y = b.yMin / 20; 1.5491 + ctx.strokeRect(x + 0.5, y + 0.5, b.xMax / 20 - x - 1, b.yMax / 20 - y - 1); 1.5492 + ctx.restore(); 1.5493 + } 1.5494 + } 1.5495 + } 1.5496 + child._invalid = false; 1.5497 +} 1.5498 +function renderQuadTree(ctx, qtree) { 1.5499 + ctx.strokeRect(qtree.x / 20, qtree.y / 20, qtree.width / 20, qtree.height / 20); 1.5500 + var nodes = qtree.nodes; 1.5501 + for (var i = 0; i < nodes.length; i++) { 1.5502 + renderQuadTree(ctx, nodes[i]); 1.5503 + } 1.5504 +} 1.5505 +var renderingTerminated = false; 1.5506 +var samplesLeftPlusOne = 0; 1.5507 +function triggerSampling(count) { 1.5508 + samplesLeftPlusOne = -count - 1; 1.5509 +} 1.5510 +function sampleStart() { 1.5511 + if (!samplesLeftPlusOne) { 1.5512 + return; 1.5513 + } 1.5514 + if (samplesLeftPlusOne < 0) { 1.5515 + console.profile('Sample'); 1.5516 + samplesLeftPlusOne *= -1; 1.5517 + } 1.5518 + if (samplesLeftPlusOne > 0) { 1.5519 + console.info('Sampling Frame: ' + (samplesLeftPlusOne - 1)); 1.5520 + } 1.5521 +} 1.5522 +function sampleEnd() { 1.5523 + if (!samplesLeftPlusOne) { 1.5524 + return; 1.5525 + } 1.5526 + samplesLeftPlusOne--; 1.5527 + if (samplesLeftPlusOne === 1) { 1.5528 + console.profileEnd('Sample'); 1.5529 + } 1.5530 +} 1.5531 +var timeline; 1.5532 +var hudTimeline; 1.5533 +function timelineEnter(name) { 1.5534 + timeline && timeline.enter(name); 1.5535 + hudTimeline && hudTimeline.enter(name); 1.5536 +} 1.5537 +function timelineLeave(name) { 1.5538 + timeline && timeline.leave(name); 1.5539 + hudTimeline && hudTimeline.leave(name); 1.5540 +} 1.5541 +function timelineWrapBroadcastMessage(domain, message) { 1.5542 + timelineEnter(message); 1.5543 + domain.broadcastMessage(message); 1.5544 + timelineLeave(message); 1.5545 +} 1.5546 +function initializeHUD(stage, parentCanvas) { 1.5547 + var canvas = document.createElement('canvas'); 1.5548 + var canvasContainer = document.createElement('div'); 1.5549 + canvasContainer.appendChild(canvas); 1.5550 + canvasContainer.style.position = 'absolute'; 1.5551 + canvasContainer.style.top = '0px'; 1.5552 + canvasContainer.style.left = '0px'; 1.5553 + canvasContainer.style.width = '100%'; 1.5554 + canvasContainer.style.height = '150px'; 1.5555 + canvasContainer.style.backgroundColor = 'rgba(0, 0, 0, 0.4)'; 1.5556 + canvasContainer.style.pointerEvents = 'none'; 1.5557 + parentCanvas.parentElement.appendChild(canvasContainer); 1.5558 + hudTimeline = new Timeline(canvas); 1.5559 + hudTimeline.setFrameRate(stage._frameRate); 1.5560 + hudTimeline.refreshEvery(10); 1.5561 +} 1.5562 +function createRenderDummyBalls(ctx, stage) { 1.5563 + var dummyBalls; 1.5564 + var radius = 10; 1.5565 + var speed = 1; 1.5566 + var m = stage._concatenatedTransform; 1.5567 + var scaleX = m.a, scaleY = m.d; 1.5568 + dummyBalls = []; 1.5569 + for (var i = 0; i < 10; i++) { 1.5570 + dummyBalls.push({ 1.5571 + position: { 1.5572 + x: radius + Math.random() * ((ctx.canvas.width - 2 * radius) / scaleX), 1.5573 + y: radius + Math.random() * ((ctx.canvas.height - 2 * radius) / scaleY) 1.5574 + }, 1.5575 + velocity: { 1.5576 + x: speed * (Math.random() - 0.5), 1.5577 + y: speed * (Math.random() - 0.5) 1.5578 + } 1.5579 + }); 1.5580 + } 1.5581 + ctx.fillStyle = 'black'; 1.5582 + ctx.lineWidth = 2; 1.5583 + ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); 1.5584 + return function renderDummyBalls() { 1.5585 + ctx.fillStyle = 'black'; 1.5586 + ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height); 1.5587 + ctx.strokeStyle = 'green'; 1.5588 + dummyBalls.forEach(function (ball) { 1.5589 + var position = ball.position; 1.5590 + var velocity = ball.velocity; 1.5591 + ctx.beginPath(); 1.5592 + ctx.arc(position.x, position.y, radius, 0, Math.PI * 2, true); 1.5593 + ctx.stroke(); 1.5594 + var x = position.x + velocity.x; 1.5595 + var y = position.y + velocity.y; 1.5596 + if (x < radius || x > ctx.canvas.width / scaleX - radius) { 1.5597 + velocity.x *= -1; 1.5598 + } 1.5599 + if (y < radius || y > ctx.canvas.height / scaleY - radius) { 1.5600 + velocity.y *= -1; 1.5601 + } 1.5602 + position.x += velocity.x; 1.5603 + position.y += velocity.y; 1.5604 + }); 1.5605 + }; 1.5606 +} 1.5607 +function renderStage(stage, ctx, events) { 1.5608 + var frameWidth, frameHeight; 1.5609 + if (!timeline && hud.value) { 1.5610 + initializeHUD(stage, ctx.canvas); 1.5611 + } 1.5612 + function updateRenderTransform() { 1.5613 + frameWidth = ctx.canvas.width; 1.5614 + frameHeight = ctx.canvas.height; 1.5615 + var scaleX = frameWidth / stage._stageWidth * 20; 1.5616 + var scaleY = frameHeight / stage._stageHeight * 20; 1.5617 + switch (stage._scaleMode) { 1.5618 + case 'exactFit': 1.5619 + break; 1.5620 + case 'noBorder': 1.5621 + if (scaleX > scaleY) { 1.5622 + scaleY = scaleX; 1.5623 + } else { 1.5624 + scaleX = scaleY; 1.5625 + } 1.5626 + break; 1.5627 + case 'noScale': 1.5628 + var pixelRatio = ctx.canvas._pixelRatio || 1; 1.5629 + scaleX = pixelRatio; 1.5630 + scaleY = pixelRatio; 1.5631 + break; 1.5632 + case 'showAll': 1.5633 + if (scaleX < scaleY) { 1.5634 + scaleY = scaleX; 1.5635 + } else { 1.5636 + scaleX = scaleY; 1.5637 + } 1.5638 + break; 1.5639 + } 1.5640 + var align = stage._align; 1.5641 + var offsetX, offsetY; 1.5642 + if (align.indexOf('L') >= 0) { 1.5643 + offsetX = 0; 1.5644 + } else if (align.indexOf('R') >= 0) { 1.5645 + offsetX = frameWidth - scaleX * stage._stageWidth / 20; 1.5646 + } else { 1.5647 + offsetX = (frameWidth - scaleX * stage._stageWidth / 20) / 2; 1.5648 + } 1.5649 + if (align.indexOf('T') >= 0) { 1.5650 + offsetY = 0; 1.5651 + } else if (align.indexOf('B') >= 0) { 1.5652 + offsetY = frameHeight - scaleY * stage._stageHeight / 20; 1.5653 + } else { 1.5654 + offsetY = (frameHeight - scaleY * stage._stageHeight / 20) / 2; 1.5655 + } 1.5656 + ctx.setTransform(scaleX, 0, 0, scaleY, offsetX, offsetY); 1.5657 + var m = stage._concatenatedTransform; 1.5658 + m.a = scaleX; 1.5659 + m.d = scaleY; 1.5660 + m.tx = offsetX * 20; 1.5661 + m.ty = offsetY * 20; 1.5662 + } 1.5663 + updateRenderTransform(); 1.5664 + var frameScheduler = new FrameScheduler(); 1.5665 + stage._frameScheduler = frameScheduler; 1.5666 + var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout; 1.5667 + var renderDummyBalls = dummyAnimation.value && createRenderDummyBalls(ctx, stage); 1.5668 + console.timeEnd('Initialize Renderer'); 1.5669 + console.timeEnd('Total'); 1.5670 + var firstRun = true; 1.5671 + var frameCount = 0; 1.5672 + var frameFPSAverage = new Shumway.Metrics.Average(120); 1.5673 + var frameRequested = true; 1.5674 + function drawFrame(renderFrame, repaint) { 1.5675 + sampleStart(); 1.5676 + var refreshStage = false; 1.5677 + if (stage._invalid) { 1.5678 + updateRenderTransform(); 1.5679 + stage._invalid = false; 1.5680 + refreshStage = true; 1.5681 + } 1.5682 + var mouseMoved = false; 1.5683 + if (stage._mouseMoved) { 1.5684 + stage._mouseMoved = false; 1.5685 + mouseMoved = stage._mouseOver; 1.5686 + } else { 1.5687 + stage._handleMouseButtons(); 1.5688 + } 1.5689 + if (renderFrame || refreshStage || mouseMoved) { 1.5690 + FrameCounter.clear(); 1.5691 + var frameStartTime = performance.now(); 1.5692 + timelineEnter('frame'); 1.5693 + traceRenderer.value && appendToFrameTerminal('Begin Frame #' + frameCount++, 'purple'); 1.5694 + var domain = avm2.systemDomain; 1.5695 + if (renderFrame) { 1.5696 + timelineEnter('events'); 1.5697 + if (firstRun) { 1.5698 + firstRun = false; 1.5699 + } else { 1.5700 + enableAdvanceFrame.value && timelineWrapBroadcastMessage(domain, 'advanceFrame'); 1.5701 + enableEnterFrame.value && timelineWrapBroadcastMessage(domain, 'enterFrame'); 1.5702 + enableConstructChildren.value && timelineWrapBroadcastMessage(domain, 'constructChildren'); 1.5703 + } 1.5704 + timelineWrapBroadcastMessage(domain, 'frameConstructed'); 1.5705 + timelineWrapBroadcastMessage(domain, 'executeFrame'); 1.5706 + timelineWrapBroadcastMessage(domain, 'exitFrame'); 1.5707 + timelineLeave('events'); 1.5708 + } 1.5709 + if (stage._deferRenderEvent) { 1.5710 + stage._deferRenderEvent = false; 1.5711 + domain.broadcastMessage('render', 'render'); 1.5712 + } 1.5713 + var drawEnabled = isCanvasVisible(ctx.canvas) && (refreshStage || renderFrame) && (frameRequested || repaint || !skipFrameDraw.value); 1.5714 + if (drawEnabled && !repaint && skipFrameDraw.value && frameScheduler.shallSkipDraw) { 1.5715 + drawEnabled = false; 1.5716 + frameScheduler.skipDraw(); 1.5717 + traceRenderer.value && appendToFrameTerminal('Skip Frame Draw', 'red'); 1.5718 + } 1.5719 + if (drawEnabled) { 1.5720 + frameScheduler.startDraw(); 1.5721 + var invalidPath = null; 1.5722 + traceRenderer.value && frameWriter.enter('> Invalidation'); 1.5723 + timelineEnter('invalidate'); 1.5724 + invalidPath = stage._processInvalidations(refreshStage); 1.5725 + timelineLeave('invalidate'); 1.5726 + traceRenderer.value && frameWriter.leave('< Invalidation'); 1.5727 + if (!disableRenderVisitor.value && !invalidPath.isEmpty) { 1.5728 + timelineEnter('render'); 1.5729 + traceRenderer.value && frameWriter.enter('> Rendering'); 1.5730 + new RenderVisitor(stage, ctx, invalidPath, refreshStage).start(); 1.5731 + traceRenderer.value && frameWriter.leave('< Rendering'); 1.5732 + timelineLeave('render'); 1.5733 + } 1.5734 + if (showQuadTree.value) { 1.5735 + ctx.strokeStyle = 'green'; 1.5736 + renderQuadTree(ctx, stage._qtree); 1.5737 + } 1.5738 + if (invalidPath && !refreshStage && showRedrawRegions.value) { 1.5739 + ctx.strokeStyle = 'red'; 1.5740 + invalidPath.draw(ctx); 1.5741 + ctx.stroke(); 1.5742 + } 1.5743 + frameScheduler.endDraw(); 1.5744 + } 1.5745 + if (mouseMoved && !disableMouseVisitor.value) { 1.5746 + renderFrame && timelineEnter('mouse'); 1.5747 + traceRenderer.value && frameWriter.enter('> Mouse Handling'); 1.5748 + stage._handleMouse(); 1.5749 + traceRenderer.value && frameWriter.leave('< Mouse Handling'); 1.5750 + renderFrame && timelineLeave('mouse'); 1.5751 + ctx.canvas.style.cursor = stage._cursor; 1.5752 + } 1.5753 + if (traceRenderer.value) { 1.5754 + frameWriter.enter('> Frame Counters'); 1.5755 + for (var name in FrameCounter.counts) { 1.5756 + frameWriter.writeLn(name + ': ' + FrameCounter.counts[name]); 1.5757 + } 1.5758 + frameWriter.leave('< Frame Counters'); 1.5759 + var frameElapsedTime = performance.now() - frameStartTime; 1.5760 + var frameFPS = 1000 / frameElapsedTime; 1.5761 + frameFPSAverage.push(frameFPS); 1.5762 + traceRenderer.value && appendToFrameTerminal('End Frame Time: ' + frameElapsedTime.toFixed(2) + ' (' + frameFPS.toFixed(2) + ' fps, ' + frameFPSAverage.average().toFixed(2) + ' average fps)', 'purple'); 1.5763 + } 1.5764 + timelineLeave('frame'); 1.5765 + } else { 1.5766 + traceRenderer.value && appendToFrameTerminal('Skip Frame', 'black'); 1.5767 + } 1.5768 + sampleEnd(); 1.5769 + } 1.5770 + (function draw() { 1.5771 + var renderFrame = true; 1.5772 + if (events.onBeforeFrame) { 1.5773 + var e = { 1.5774 + cancel: false 1.5775 + }; 1.5776 + events.onBeforeFrame(e); 1.5777 + renderFrame = !e.cancel; 1.5778 + } 1.5779 + if (renderDummyBalls) { 1.5780 + if (renderFrame) { 1.5781 + renderDummyBalls(); 1.5782 + events.onAfterFrame && events.onAfterFrame(); 1.5783 + } 1.5784 + setTimeout(draw); 1.5785 + return; 1.5786 + } 1.5787 + frameScheduler.startFrame(stage._frameRate); 1.5788 + drawFrame(renderFrame, false); 1.5789 + frameScheduler.endFrame(); 1.5790 + frameRequested = false; 1.5791 + if (!frameScheduler.isOnTime) { 1.5792 + traceRenderer.value && appendToFrameTerminal('Frame Is Late', 'red'); 1.5793 + } 1.5794 + if (renderFrame && events.onAfterFrame) { 1.5795 + events.onAfterFrame(); 1.5796 + } 1.5797 + if (renderingTerminated) { 1.5798 + if (events.onTerminated) { 1.5799 + events.onTerminated(); 1.5800 + } 1.5801 + return; 1.5802 + } 1.5803 + setTimeout(draw, turboMode.value ? 0 : frameScheduler.nextFrameIn); 1.5804 + }()); 1.5805 + (function frame() { 1.5806 + if (renderingTerminated) { 1.5807 + return; 1.5808 + } 1.5809 + frameRequested = true; 1.5810 + if ((stage._invalid || stage._mouseMoved) && !renderDummyBalls) { 1.5811 + drawFrame(false, true); 1.5812 + } 1.5813 + requestAnimationFrame(frame); 1.5814 + }()); 1.5815 +} 1.5816 +var FrameScheduler = function () { 1.5817 + var STATS_TO_REMEMBER = 50; 1.5818 + var MAX_DRAWS_TO_SKIP = 2; 1.5819 + var INTERVAL_PADDING_MS = 4; 1.5820 + var SPEED_ADJUST_RATE = 0.9; 1.5821 + function FrameScheduler() { 1.5822 + this._drawStats = []; 1.5823 + this._drawStatsSum = 0; 1.5824 + this._drawStarted = 0; 1.5825 + this._drawsSkipped = 0; 1.5826 + this._expectedNextFrameAt = performance.now(); 1.5827 + this._onTime = true; 1.5828 + this._trackDelta = false; 1.5829 + this._delta = 0; 1.5830 + this._onTimeDelta = 0; 1.5831 + } 1.5832 + FrameScheduler.prototype = { 1.5833 + get shallSkipDraw() { 1.5834 + if (this._drawsSkipped >= MAX_DRAWS_TO_SKIP) { 1.5835 + return false; 1.5836 + } 1.5837 + var averageDraw = this._drawStats.length < STATS_TO_REMEMBER ? 0 : this._drawStatsSum / this._drawStats.length; 1.5838 + var estimatedDrawEnd = performance.now() + averageDraw; 1.5839 + return estimatedDrawEnd + INTERVAL_PADDING_MS > this._expectedNextFrameAt; 1.5840 + }, 1.5841 + get nextFrameIn() { 1.5842 + return Math.max(0, this._expectedNextFrameAt - performance.now()); 1.5843 + }, 1.5844 + get isOnTime() { 1.5845 + return this._onTime; 1.5846 + }, 1.5847 + startFrame: function (frameRate) { 1.5848 + var interval = 1000 / frameRate; 1.5849 + var adjustedInterval = interval; 1.5850 + var delta = this._onTimeDelta + this._delta; 1.5851 + if (delta !== 0) { 1.5852 + if (delta < 0) { 1.5853 + adjustedInterval *= SPEED_ADJUST_RATE; 1.5854 + } else if (delta > 0) { 1.5855 + adjustedInterval /= SPEED_ADJUST_RATE; 1.5856 + } 1.5857 + this._onTimeDelta += interval - adjustedInterval; 1.5858 + } 1.5859 + this._expectedNextFrameAt += adjustedInterval; 1.5860 + this._onTime = true; 1.5861 + }, 1.5862 + endFrame: function () { 1.5863 + var estimatedNextFrameStart = performance.now() + INTERVAL_PADDING_MS; 1.5864 + if (estimatedNextFrameStart > this._expectedNextFrameAt) { 1.5865 + if (this._trackDelta) { 1.5866 + this._onTimeDelta += this._expectedNextFrameAt - estimatedNextFrameStart; 1.5867 + console.log(this._onTimeDelta); 1.5868 + } 1.5869 + this._expectedNextFrameAt = estimatedNextFrameStart; 1.5870 + this._onTime = false; 1.5871 + } 1.5872 + }, 1.5873 + startDraw: function () { 1.5874 + this._drawsSkipped = 0; 1.5875 + this._drawStarted = performance.now(); 1.5876 + }, 1.5877 + endDraw: function () { 1.5878 + var drawTime = performance.now() - this._drawStarted; 1.5879 + this._drawStats.push(drawTime); 1.5880 + this._drawStatsSum += drawTime; 1.5881 + while (this._drawStats.length > STATS_TO_REMEMBER) { 1.5882 + this._drawStatsSum -= this._drawStats.shift(); 1.5883 + } 1.5884 + }, 1.5885 + skipDraw: function () { 1.5886 + this._drawsSkipped++; 1.5887 + }, 1.5888 + setDelta: function (value) { 1.5889 + if (!this._trackDelta) { 1.5890 + return; 1.5891 + } 1.5892 + this._delta = value; 1.5893 + }, 1.5894 + startTrackDelta: function () { 1.5895 + this._trackDelta = true; 1.5896 + }, 1.5897 + endTrackDelta: function () { 1.5898 + if (!this._trackDelta) { 1.5899 + return; 1.5900 + } 1.5901 + this._trackDelta = false; 1.5902 + this._delta = 0; 1.5903 + this._onTimeDelta = 0; 1.5904 + } 1.5905 + }; 1.5906 + return FrameScheduler; 1.5907 + }(); 1.5908 +var tagHandler = function (global) { 1.5909 + function defineShape($bytes, $stream, $, swfVersion, tagCode) { 1.5910 + $ || ($ = {}); 1.5911 + $.id = readUi16($bytes, $stream); 1.5912 + var $0 = $.bbox = {}; 1.5913 + bbox($bytes, $stream, $0, swfVersion, tagCode); 1.5914 + var isMorph = $.isMorph = tagCode === 46 || tagCode === 84; 1.5915 + if (isMorph) { 1.5916 + var $1 = $.bboxMorph = {}; 1.5917 + bbox($bytes, $stream, $1, swfVersion, tagCode); 1.5918 + } 1.5919 + var hasStrokes = $.hasStrokes = tagCode === 83 || tagCode === 84; 1.5920 + if (hasStrokes) { 1.5921 + var $2 = $.strokeBbox = {}; 1.5922 + bbox($bytes, $stream, $2, swfVersion, tagCode); 1.5923 + if (isMorph) { 1.5924 + var $3 = $.strokeBboxMorph = {}; 1.5925 + bbox($bytes, $stream, $3, swfVersion, tagCode); 1.5926 + } 1.5927 + var reserved = readUb($bytes, $stream, 5); 1.5928 + $.fillWinding = readUb($bytes, $stream, 1); 1.5929 + $.nonScalingStrokes = readUb($bytes, $stream, 1); 1.5930 + $.scalingStrokes = readUb($bytes, $stream, 1); 1.5931 + } 1.5932 + if (isMorph) { 1.5933 + $.offsetMorph = readUi32($bytes, $stream); 1.5934 + morphShapeWithStyle($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes); 1.5935 + } else { 1.5936 + shapeWithStyle($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes); 1.5937 + } 1.5938 + return $; 1.5939 + } 1.5940 + function placeObject($bytes, $stream, $, swfVersion, tagCode) { 1.5941 + var flags, hasEvents, clip, hasName, hasRatio, hasCxform, hasMatrix, place; 1.5942 + var move, hasBackgroundColor, hasVisibility, hasImage, hasClassName, cache; 1.5943 + var blend, hasFilters, eoe; 1.5944 + $ || ($ = {}); 1.5945 + if (tagCode > 4) { 1.5946 + if (tagCode > 26) { 1.5947 + flags = readUi16($bytes, $stream); 1.5948 + } else { 1.5949 + flags = readUi8($bytes, $stream); 1.5950 + } 1.5951 + hasEvents = $.hasEvents = flags >> 7 & 1; 1.5952 + clip = $.clip = flags >> 6 & 1; 1.5953 + hasName = $.hasName = flags >> 5 & 1; 1.5954 + hasRatio = $.hasRatio = flags >> 4 & 1; 1.5955 + hasCxform = $.hasCxform = flags >> 3 & 1; 1.5956 + hasMatrix = $.hasMatrix = flags >> 2 & 1; 1.5957 + place = $.place = flags >> 1 & 1; 1.5958 + move = $.move = flags & 1; 1.5959 + if (tagCode === 70) { 1.5960 + hasBackgroundColor = $.hasBackgroundColor = flags >> 15 & 1; 1.5961 + hasVisibility = $.hasVisibility = flags >> 14 & 1; 1.5962 + hasImage = $.hasImage = flags >> 12 & 1; 1.5963 + hasClassName = $.hasClassName = flags >> 11 & 1; 1.5964 + cache = $.cache = flags >> 10 & 1; 1.5965 + blend = $.blend = flags >> 9 & 1; 1.5966 + hasFilters = $.hasFilters = flags >> 8 & 1; 1.5967 + } else { 1.5968 + cache = $.cache = 0; 1.5969 + blend = $.blend = 0; 1.5970 + hasFilters = $.hasFilters = 0; 1.5971 + } 1.5972 + $.depth = readUi16($bytes, $stream); 1.5973 + if (hasClassName) { 1.5974 + $.className = readString($bytes, $stream, 0); 1.5975 + } 1.5976 + if (place) { 1.5977 + $.symbolId = readUi16($bytes, $stream); 1.5978 + } 1.5979 + if (hasMatrix) { 1.5980 + var $0 = $.matrix = {}; 1.5981 + matrix($bytes, $stream, $0, swfVersion, tagCode); 1.5982 + } 1.5983 + if (hasCxform) { 1.5984 + var $1 = $.cxform = {}; 1.5985 + cxform($bytes, $stream, $1, swfVersion, tagCode); 1.5986 + } 1.5987 + if (hasRatio) { 1.5988 + $.ratio = readUi16($bytes, $stream); 1.5989 + } 1.5990 + if (hasName) { 1.5991 + $.name = readString($bytes, $stream, 0); 1.5992 + } 1.5993 + if (clip) { 1.5994 + $.clipDepth = readUi16($bytes, $stream); 1.5995 + } 1.5996 + if (hasFilters) { 1.5997 + var count = readUi8($bytes, $stream); 1.5998 + var $2 = $.filters = []; 1.5999 + var $3 = count; 1.6000 + while ($3--) { 1.6001 + var $4 = {}; 1.6002 + anyFilter($bytes, $stream, $4, swfVersion, tagCode); 1.6003 + $2.push($4); 1.6004 + } 1.6005 + } 1.6006 + if (blend) { 1.6007 + $.blendMode = readUi8($bytes, $stream); 1.6008 + } 1.6009 + if (cache) { 1.6010 + $.bmpCache = readUi8($bytes, $stream); 1.6011 + } 1.6012 + if (hasEvents) { 1.6013 + var reserved = readUi16($bytes, $stream); 1.6014 + if (swfVersion >= 6) { 1.6015 + var allFlags = readUi32($bytes, $stream); 1.6016 + } else { 1.6017 + var allFlags = readUi16($bytes, $stream); 1.6018 + } 1.6019 + var $28 = $.events = []; 1.6020 + do { 1.6021 + var $29 = {}; 1.6022 + var temp = events($bytes, $stream, $29, swfVersion, tagCode); 1.6023 + eoe = temp.eoe; 1.6024 + $28.push($29); 1.6025 + } while (!eoe); 1.6026 + } 1.6027 + if (hasBackgroundColor) { 1.6028 + var $126 = $.backgroundColor = {}; 1.6029 + argb($bytes, $stream, $126, swfVersion, tagCode); 1.6030 + } 1.6031 + if (hasVisibility) { 1.6032 + $.visibility = readUi8($bytes, $stream); 1.6033 + } 1.6034 + } else { 1.6035 + $.place = 1; 1.6036 + $.symbolId = readUi16($bytes, $stream); 1.6037 + $.depth = readUi16($bytes, $stream); 1.6038 + $.hasMatrix = 1; 1.6039 + var $30 = $.matrix = {}; 1.6040 + matrix($bytes, $stream, $30, swfVersion, tagCode); 1.6041 + if ($stream.remaining()) { 1.6042 + $.hasCxform = 1; 1.6043 + var $31 = $.cxform = {}; 1.6044 + cxform($bytes, $stream, $31, swfVersion, tagCode); 1.6045 + } 1.6046 + } 1.6047 + return $; 1.6048 + } 1.6049 + function removeObject($bytes, $stream, $, swfVersion, tagCode) { 1.6050 + $ || ($ = {}); 1.6051 + if (tagCode === 5) { 1.6052 + $.symbolId = readUi16($bytes, $stream); 1.6053 + } 1.6054 + $.depth = readUi16($bytes, $stream); 1.6055 + return $; 1.6056 + } 1.6057 + function defineImage($bytes, $stream, $, swfVersion, tagCode) { 1.6058 + var imgData; 1.6059 + $ || ($ = {}); 1.6060 + $.id = readUi16($bytes, $stream); 1.6061 + if (tagCode > 21) { 1.6062 + var alphaDataOffset = readUi32($bytes, $stream); 1.6063 + if (tagCode === 90) { 1.6064 + $.deblock = readFixed8($bytes, $stream); 1.6065 + } 1.6066 + imgData = $.imgData = readBinary($bytes, $stream, alphaDataOffset); 1.6067 + $.alphaData = readBinary($bytes, $stream, 0); 1.6068 + } else { 1.6069 + imgData = $.imgData = readBinary($bytes, $stream, 0); 1.6070 + } 1.6071 + switch (imgData[0] << 8 | imgData[1]) { 1.6072 + case 65496: 1.6073 + case 65497: 1.6074 + $.mimeType = 'image/jpeg'; 1.6075 + break; 1.6076 + case 35152: 1.6077 + $.mimeType = 'image/png'; 1.6078 + break; 1.6079 + case 18249: 1.6080 + $.mimeType = 'image/gif'; 1.6081 + break; 1.6082 + default: 1.6083 + $.mimeType = 'application/octet-stream'; 1.6084 + } 1.6085 + if (tagCode === 6) { 1.6086 + $.incomplete = 1; 1.6087 + } 1.6088 + return $; 1.6089 + } 1.6090 + function defineButton($bytes, $stream, $, swfVersion, tagCode) { 1.6091 + var eob, hasFilters, count, blend; 1.6092 + $ || ($ = {}); 1.6093 + $.id = readUi16($bytes, $stream); 1.6094 + if (tagCode == 7) { 1.6095 + var $0 = $.characters = []; 1.6096 + do { 1.6097 + var $1 = {}; 1.6098 + var temp = button($bytes, $stream, $1, swfVersion, tagCode); 1.6099 + eob = temp.eob; 1.6100 + $0.push($1); 1.6101 + } while (!eob); 1.6102 + $.actionsData = readBinary($bytes, $stream, 0); 1.6103 + } else { 1.6104 + var trackFlags = readUi8($bytes, $stream); 1.6105 + $.trackAsMenu = trackFlags >> 7 & 1; 1.6106 + var actionOffset = readUi16($bytes, $stream); 1.6107 + var $28 = $.characters = []; 1.6108 + do { 1.6109 + var $29 = {}; 1.6110 + var flags = readUi8($bytes, $stream); 1.6111 + var eob = $29.eob = !flags; 1.6112 + if (swfVersion >= 8) { 1.6113 + blend = $29.blend = flags >> 5 & 1; 1.6114 + hasFilters = $29.hasFilters = flags >> 4 & 1; 1.6115 + } else { 1.6116 + blend = $29.blend = 0; 1.6117 + hasFilters = $29.hasFilters = 0; 1.6118 + } 1.6119 + $29.stateHitTest = flags >> 3 & 1; 1.6120 + $29.stateDown = flags >> 2 & 1; 1.6121 + $29.stateOver = flags >> 1 & 1; 1.6122 + $29.stateUp = flags & 1; 1.6123 + if (!eob) { 1.6124 + $29.symbolId = readUi16($bytes, $stream); 1.6125 + $29.depth = readUi16($bytes, $stream); 1.6126 + var $30 = $29.matrix = {}; 1.6127 + matrix($bytes, $stream, $30, swfVersion, tagCode); 1.6128 + if (tagCode === 34) { 1.6129 + var $31 = $29.cxform = {}; 1.6130 + cxform($bytes, $stream, $31, swfVersion, tagCode); 1.6131 + } 1.6132 + if (hasFilters) { 1.6133 + var count = readUi8($bytes, $stream); 1.6134 + var $2 = $.filters = []; 1.6135 + var $3 = count; 1.6136 + while ($3--) { 1.6137 + var $4 = {}; 1.6138 + anyFilter($bytes, $stream, $4, swfVersion, tagCode); 1.6139 + $2.push($4); 1.6140 + } 1.6141 + } 1.6142 + if (blend) { 1.6143 + $29.blendMode = readUi8($bytes, $stream); 1.6144 + } 1.6145 + } 1.6146 + $28.push($29); 1.6147 + } while (!eob); 1.6148 + if (!(!actionOffset)) { 1.6149 + var $56 = $.buttonActions = []; 1.6150 + do { 1.6151 + var $57 = {}; 1.6152 + buttonCondAction($bytes, $stream, $57, swfVersion, tagCode); 1.6153 + $56.push($57); 1.6154 + } while ($stream.remaining() > 0); 1.6155 + } 1.6156 + } 1.6157 + return $; 1.6158 + } 1.6159 + function defineJPEGTables($bytes, $stream, $, swfVersion, tagCode) { 1.6160 + $ || ($ = {}); 1.6161 + $.id = 0; 1.6162 + $.imgData = readBinary($bytes, $stream, 0); 1.6163 + $.mimeType = 'application/octet-stream'; 1.6164 + return $; 1.6165 + } 1.6166 + function setBackgroundColor($bytes, $stream, $, swfVersion, tagCode) { 1.6167 + $ || ($ = {}); 1.6168 + var $0 = $.color = {}; 1.6169 + rgb($bytes, $stream, $0, swfVersion, tagCode); 1.6170 + return $; 1.6171 + } 1.6172 + function defineBinaryData($bytes, $stream, $, swfVersion, tagCode) { 1.6173 + $ || ($ = {}); 1.6174 + $.id = readUi16($bytes, $stream); 1.6175 + var reserved = readUi32($bytes, $stream); 1.6176 + $.data = readBinary($bytes, $stream, 0); 1.6177 + return $; 1.6178 + } 1.6179 + function defineFont($bytes, $stream, $, swfVersion, tagCode) { 1.6180 + $ || ($ = {}); 1.6181 + $.id = readUi16($bytes, $stream); 1.6182 + var firstOffset = readUi16($bytes, $stream); 1.6183 + var glyphCount = $.glyphCount = firstOffset / 2; 1.6184 + var restOffsets = []; 1.6185 + var $0 = glyphCount - 1; 1.6186 + while ($0--) { 1.6187 + restOffsets.push(readUi16($bytes, $stream)); 1.6188 + } 1.6189 + $.offsets = [ 1.6190 + firstOffset 1.6191 + ].concat(restOffsets); 1.6192 + var $1 = $.glyphs = []; 1.6193 + var $2 = glyphCount; 1.6194 + while ($2--) { 1.6195 + var $3 = {}; 1.6196 + shape($bytes, $stream, $3, swfVersion, tagCode); 1.6197 + $1.push($3); 1.6198 + } 1.6199 + return $; 1.6200 + } 1.6201 + function defineLabel($bytes, $stream, $, swfVersion, tagCode) { 1.6202 + var eot; 1.6203 + $ || ($ = {}); 1.6204 + $.id = readUi16($bytes, $stream); 1.6205 + var $0 = $.bbox = {}; 1.6206 + bbox($bytes, $stream, $0, swfVersion, tagCode); 1.6207 + var $1 = $.matrix = {}; 1.6208 + matrix($bytes, $stream, $1, swfVersion, tagCode); 1.6209 + var glyphBits = $.glyphBits = readUi8($bytes, $stream); 1.6210 + var advanceBits = $.advanceBits = readUi8($bytes, $stream); 1.6211 + var $2 = $.records = []; 1.6212 + do { 1.6213 + var $3 = {}; 1.6214 + var temp = textRecord($bytes, $stream, $3, swfVersion, tagCode, glyphBits, advanceBits); 1.6215 + eot = temp.eot; 1.6216 + $2.push($3); 1.6217 + } while (!eot); 1.6218 + return $; 1.6219 + } 1.6220 + function doAction($bytes, $stream, $, swfVersion, tagCode) { 1.6221 + $ || ($ = {}); 1.6222 + if (tagCode === 59) { 1.6223 + $.spriteId = readUi16($bytes, $stream); 1.6224 + } 1.6225 + $.actionsData = readBinary($bytes, $stream, 0); 1.6226 + return $; 1.6227 + } 1.6228 + function defineSound($bytes, $stream, $, swfVersion, tagCode) { 1.6229 + $ || ($ = {}); 1.6230 + $.id = readUi16($bytes, $stream); 1.6231 + var soundFlags = readUi8($bytes, $stream); 1.6232 + $.soundFormat = soundFlags >> 4 & 15; 1.6233 + $.soundRate = soundFlags >> 2 & 3; 1.6234 + $.soundSize = soundFlags >> 1 & 1; 1.6235 + $.soundType = soundFlags & 1; 1.6236 + $.samplesCount = readUi32($bytes, $stream); 1.6237 + $.soundData = readBinary($bytes, $stream, 0); 1.6238 + return $; 1.6239 + } 1.6240 + function startSound($bytes, $stream, $, swfVersion, tagCode) { 1.6241 + $ || ($ = {}); 1.6242 + if (tagCode == 15) { 1.6243 + $.soundId = readUi16($bytes, $stream); 1.6244 + } 1.6245 + if (tagCode == 89) { 1.6246 + $.soundClassName = readString($bytes, $stream, 0); 1.6247 + } 1.6248 + var $0 = $.soundInfo = {}; 1.6249 + soundInfo($bytes, $stream, $0, swfVersion, tagCode); 1.6250 + return $; 1.6251 + } 1.6252 + function soundStreamHead($bytes, $stream, $, swfVersion, tagCode) { 1.6253 + $ || ($ = {}); 1.6254 + var playbackFlags = readUi8($bytes, $stream); 1.6255 + $.playbackRate = playbackFlags >> 2 & 3; 1.6256 + $.playbackSize = playbackFlags >> 1 & 1; 1.6257 + $.playbackType = playbackFlags & 1; 1.6258 + var streamFlags = readUi8($bytes, $stream); 1.6259 + var streamCompression = $.streamCompression = streamFlags >> 4 & 15; 1.6260 + $.streamRate = streamFlags >> 2 & 3; 1.6261 + $.streamSize = streamFlags >> 1 & 1; 1.6262 + $.streamType = streamFlags & 1; 1.6263 + $.samplesCount = readUi32($bytes, $stream); 1.6264 + if (streamCompression == 2) { 1.6265 + $.latencySeek = readSi16($bytes, $stream); 1.6266 + } 1.6267 + return $; 1.6268 + } 1.6269 + function soundStreamBlock($bytes, $stream, $, swfVersion, tagCode) { 1.6270 + $ || ($ = {}); 1.6271 + $.data = readBinary($bytes, $stream, 0); 1.6272 + return $; 1.6273 + } 1.6274 + function defineBitmap($bytes, $stream, $, swfVersion, tagCode) { 1.6275 + $ || ($ = {}); 1.6276 + $.id = readUi16($bytes, $stream); 1.6277 + var format = $.format = readUi8($bytes, $stream); 1.6278 + $.width = readUi16($bytes, $stream); 1.6279 + $.height = readUi16($bytes, $stream); 1.6280 + $.hasAlpha = tagCode === 36; 1.6281 + if (format === 3) { 1.6282 + $.colorTableSize = readUi8($bytes, $stream); 1.6283 + } 1.6284 + $.bmpData = readBinary($bytes, $stream, 0); 1.6285 + return $; 1.6286 + } 1.6287 + function defineText($bytes, $stream, $, swfVersion, tagCode) { 1.6288 + $ || ($ = {}); 1.6289 + $.id = readUi16($bytes, $stream); 1.6290 + var $0 = $.bbox = {}; 1.6291 + bbox($bytes, $stream, $0, swfVersion, tagCode); 1.6292 + var flags = readUi16($bytes, $stream); 1.6293 + var hasText = $.hasText = flags >> 7 & 1; 1.6294 + $.wordWrap = flags >> 6 & 1; 1.6295 + $.multiline = flags >> 5 & 1; 1.6296 + $.password = flags >> 4 & 1; 1.6297 + $.readonly = flags >> 3 & 1; 1.6298 + var hasColor = $.hasColor = flags >> 2 & 1; 1.6299 + var hasMaxLength = $.hasMaxLength = flags >> 1 & 1; 1.6300 + var hasFont = $.hasFont = flags & 1; 1.6301 + var hasFontClass = $.hasFontClass = flags >> 15 & 1; 1.6302 + $.autoSize = flags >> 14 & 1; 1.6303 + var hasLayout = $.hasLayout = flags >> 13 & 1; 1.6304 + $.noSelect = flags >> 12 & 1; 1.6305 + $.border = flags >> 11 & 1; 1.6306 + $.wasStatic = flags >> 10 & 1; 1.6307 + $.html = flags >> 9 & 1; 1.6308 + $.useOutlines = flags >> 8 & 1; 1.6309 + if (hasFont) { 1.6310 + $.fontId = readUi16($bytes, $stream); 1.6311 + } 1.6312 + if (hasFontClass) { 1.6313 + $.fontClass = readString($bytes, $stream, 0); 1.6314 + } 1.6315 + if (hasFont) { 1.6316 + $.fontHeight = readUi16($bytes, $stream); 1.6317 + } 1.6318 + if (hasColor) { 1.6319 + var $1 = $.color = {}; 1.6320 + rgba($bytes, $stream, $1, swfVersion, tagCode); 1.6321 + } 1.6322 + if (hasMaxLength) { 1.6323 + $.maxLength = readUi16($bytes, $stream); 1.6324 + } 1.6325 + if (hasLayout) { 1.6326 + $.align = readUi8($bytes, $stream); 1.6327 + $.leftMargin = readUi16($bytes, $stream); 1.6328 + $.rightMargin = readUi16($bytes, $stream); 1.6329 + $.indent = readSi16($bytes, $stream); 1.6330 + $.leading = readSi16($bytes, $stream); 1.6331 + } 1.6332 + $.variableName = readString($bytes, $stream, 0); 1.6333 + if (hasText) { 1.6334 + $.initialText = readString($bytes, $stream, 0); 1.6335 + } 1.6336 + return $; 1.6337 + } 1.6338 + function frameLabel($bytes, $stream, $, swfVersion, tagCode) { 1.6339 + $ || ($ = {}); 1.6340 + $.name = readString($bytes, $stream, 0); 1.6341 + return $; 1.6342 + } 1.6343 + function defineFont2($bytes, $stream, $, swfVersion, tagCode) { 1.6344 + $ || ($ = {}); 1.6345 + $.id = readUi16($bytes, $stream); 1.6346 + var hasLayout = $.hasLayout = readUb($bytes, $stream, 1); 1.6347 + if (swfVersion > 5) { 1.6348 + $.shiftJis = readUb($bytes, $stream, 1); 1.6349 + } else { 1.6350 + var reserved = readUb($bytes, $stream, 1); 1.6351 + } 1.6352 + $.smallText = readUb($bytes, $stream, 1); 1.6353 + $.ansi = readUb($bytes, $stream, 1); 1.6354 + var wideOffset = $.wideOffset = readUb($bytes, $stream, 1); 1.6355 + var wide = $.wide = readUb($bytes, $stream, 1); 1.6356 + $.italic = readUb($bytes, $stream, 1); 1.6357 + $.bold = readUb($bytes, $stream, 1); 1.6358 + if (swfVersion > 5) { 1.6359 + $.language = readUi8($bytes, $stream); 1.6360 + } else { 1.6361 + var reserved = readUi8($bytes, $stream); 1.6362 + $.language = 0; 1.6363 + } 1.6364 + var nameLength = readUi8($bytes, $stream); 1.6365 + $.name = readString($bytes, $stream, nameLength); 1.6366 + if (tagCode === 75) { 1.6367 + $.resolution = 20; 1.6368 + } 1.6369 + var glyphCount = $.glyphCount = readUi16($bytes, $stream); 1.6370 + if (wideOffset) { 1.6371 + var $0 = $.offsets = []; 1.6372 + var $1 = glyphCount; 1.6373 + while ($1--) { 1.6374 + $0.push(readUi32($bytes, $stream)); 1.6375 + } 1.6376 + $.mapOffset = readUi32($bytes, $stream); 1.6377 + } else { 1.6378 + var $2 = $.offsets = []; 1.6379 + var $3 = glyphCount; 1.6380 + while ($3--) { 1.6381 + $2.push(readUi16($bytes, $stream)); 1.6382 + } 1.6383 + $.mapOffset = readUi16($bytes, $stream); 1.6384 + } 1.6385 + var $4 = $.glyphs = []; 1.6386 + var $5 = glyphCount; 1.6387 + while ($5--) { 1.6388 + var $6 = {}; 1.6389 + shape($bytes, $stream, $6, swfVersion, tagCode); 1.6390 + $4.push($6); 1.6391 + } 1.6392 + if (wide) { 1.6393 + var $47 = $.codes = []; 1.6394 + var $48 = glyphCount; 1.6395 + while ($48--) { 1.6396 + $47.push(readUi16($bytes, $stream)); 1.6397 + } 1.6398 + } else { 1.6399 + var $49 = $.codes = []; 1.6400 + var $50 = glyphCount; 1.6401 + while ($50--) { 1.6402 + $49.push(readUi8($bytes, $stream)); 1.6403 + } 1.6404 + } 1.6405 + if (hasLayout) { 1.6406 + $.ascent = readUi16($bytes, $stream); 1.6407 + $.descent = readUi16($bytes, $stream); 1.6408 + $.leading = readSi16($bytes, $stream); 1.6409 + var $51 = $.advance = []; 1.6410 + var $52 = glyphCount; 1.6411 + while ($52--) { 1.6412 + $51.push(readSi16($bytes, $stream)); 1.6413 + } 1.6414 + var $53 = $.bbox = []; 1.6415 + var $54 = glyphCount; 1.6416 + while ($54--) { 1.6417 + var $55 = {}; 1.6418 + bbox($bytes, $stream, $55, swfVersion, tagCode); 1.6419 + $53.push($55); 1.6420 + } 1.6421 + var kerningCount = readUi16($bytes, $stream); 1.6422 + var $56 = $.kerning = []; 1.6423 + var $57 = kerningCount; 1.6424 + while ($57--) { 1.6425 + var $58 = {}; 1.6426 + kerning($bytes, $stream, $58, swfVersion, tagCode, wide); 1.6427 + $56.push($58); 1.6428 + } 1.6429 + } 1.6430 + return $; 1.6431 + } 1.6432 + function fileAttributes($bytes, $stream, $, swfVersion, tagCode) { 1.6433 + $ || ($ = {}); 1.6434 + var reserved = readUb($bytes, $stream, 1); 1.6435 + $.useDirectBlit = readUb($bytes, $stream, 1); 1.6436 + $.useGpu = readUb($bytes, $stream, 1); 1.6437 + $.hasMetadata = readUb($bytes, $stream, 1); 1.6438 + $.doAbc = readUb($bytes, $stream, 1); 1.6439 + $.noCrossDomainCaching = readUb($bytes, $stream, 1); 1.6440 + $.relativeUrls = readUb($bytes, $stream, 1); 1.6441 + $.network = readUb($bytes, $stream, 1); 1.6442 + var pad = readUb($bytes, $stream, 24); 1.6443 + return $; 1.6444 + } 1.6445 + function doABC($bytes, $stream, $, swfVersion, tagCode) { 1.6446 + $ || ($ = {}); 1.6447 + if (tagCode === 82) { 1.6448 + $.flags = readUi32($bytes, $stream); 1.6449 + } else { 1.6450 + $.flags = 0; 1.6451 + } 1.6452 + if (tagCode === 82) { 1.6453 + $.name = readString($bytes, $stream, 0); 1.6454 + } else { 1.6455 + $.name = ''; 1.6456 + } 1.6457 + $.data = readBinary($bytes, $stream, 0); 1.6458 + return $; 1.6459 + } 1.6460 + function exportAssets($bytes, $stream, $, swfVersion, tagCode) { 1.6461 + $ || ($ = {}); 1.6462 + var exportsCount = readUi16($bytes, $stream); 1.6463 + var $0 = $.exports = []; 1.6464 + var $1 = exportsCount; 1.6465 + while ($1--) { 1.6466 + var $2 = {}; 1.6467 + $2.symbolId = readUi16($bytes, $stream); 1.6468 + $2.className = readString($bytes, $stream, 0); 1.6469 + $0.push($2); 1.6470 + } 1.6471 + return $; 1.6472 + } 1.6473 + function symbolClass($bytes, $stream, $, swfVersion, tagCode) { 1.6474 + $ || ($ = {}); 1.6475 + var symbolCount = readUi16($bytes, $stream); 1.6476 + var $0 = $.exports = []; 1.6477 + var $1 = symbolCount; 1.6478 + while ($1--) { 1.6479 + var $2 = {}; 1.6480 + $2.symbolId = readUi16($bytes, $stream); 1.6481 + $2.className = readString($bytes, $stream, 0); 1.6482 + $0.push($2); 1.6483 + } 1.6484 + return $; 1.6485 + } 1.6486 + function defineScalingGrid($bytes, $stream, $, swfVersion, tagCode) { 1.6487 + $ || ($ = {}); 1.6488 + $.symbolId = readUi16($bytes, $stream); 1.6489 + var $0 = $.splitter = {}; 1.6490 + bbox($bytes, $stream, $0, swfVersion, tagCode); 1.6491 + return $; 1.6492 + } 1.6493 + function defineScene($bytes, $stream, $, swfVersion, tagCode) { 1.6494 + $ || ($ = {}); 1.6495 + var sceneCount = readEncodedU32($bytes, $stream); 1.6496 + var $0 = $.scenes = []; 1.6497 + var $1 = sceneCount; 1.6498 + while ($1--) { 1.6499 + var $2 = {}; 1.6500 + $2.offset = readEncodedU32($bytes, $stream); 1.6501 + $2.name = readString($bytes, $stream, 0); 1.6502 + $0.push($2); 1.6503 + } 1.6504 + var labelCount = readEncodedU32($bytes, $stream); 1.6505 + var $3 = $.labels = []; 1.6506 + var $4 = labelCount; 1.6507 + while ($4--) { 1.6508 + var $5 = {}; 1.6509 + $5.frame = readEncodedU32($bytes, $stream); 1.6510 + $5.name = readString($bytes, $stream, 0); 1.6511 + $3.push($5); 1.6512 + } 1.6513 + return $; 1.6514 + } 1.6515 + function bbox($bytes, $stream, $, swfVersion, tagCode) { 1.6516 + align($bytes, $stream); 1.6517 + var bits = readUb($bytes, $stream, 5); 1.6518 + var xMin = readSb($bytes, $stream, bits); 1.6519 + var xMax = readSb($bytes, $stream, bits); 1.6520 + var yMin = readSb($bytes, $stream, bits); 1.6521 + var yMax = readSb($bytes, $stream, bits); 1.6522 + $.xMin = xMin; 1.6523 + $.xMax = xMax; 1.6524 + $.yMin = yMin; 1.6525 + $.yMax = yMax; 1.6526 + align($bytes, $stream); 1.6527 + } 1.6528 + function rgb($bytes, $stream, $, swfVersion, tagCode) { 1.6529 + $.red = readUi8($bytes, $stream); 1.6530 + $.green = readUi8($bytes, $stream); 1.6531 + $.blue = readUi8($bytes, $stream); 1.6532 + $.alpha = 255; 1.6533 + return; 1.6534 + } 1.6535 + function rgba($bytes, $stream, $, swfVersion, tagCode) { 1.6536 + $.red = readUi8($bytes, $stream); 1.6537 + $.green = readUi8($bytes, $stream); 1.6538 + $.blue = readUi8($bytes, $stream); 1.6539 + $.alpha = readUi8($bytes, $stream); 1.6540 + return; 1.6541 + } 1.6542 + function argb($bytes, $stream, $, swfVersion, tagCode) { 1.6543 + $.alpha = readUi8($bytes, $stream); 1.6544 + $.red = readUi8($bytes, $stream); 1.6545 + $.green = readUi8($bytes, $stream); 1.6546 + $.blue = readUi8($bytes, $stream); 1.6547 + } 1.6548 + function fillSolid($bytes, $stream, $, swfVersion, tagCode, isMorph) { 1.6549 + if (tagCode > 22 || isMorph) { 1.6550 + var $125 = $.color = {}; 1.6551 + rgba($bytes, $stream, $125, swfVersion, tagCode); 1.6552 + } else { 1.6553 + var $126 = $.color = {}; 1.6554 + rgb($bytes, $stream, $126, swfVersion, tagCode); 1.6555 + } 1.6556 + if (isMorph) { 1.6557 + var $127 = $.colorMorph = {}; 1.6558 + rgba($bytes, $stream, $127, swfVersion, tagCode); 1.6559 + } 1.6560 + return; 1.6561 + } 1.6562 + function matrix($bytes, $stream, $, swfVersion, tagCode) { 1.6563 + align($bytes, $stream); 1.6564 + var hasScale = readUb($bytes, $stream, 1); 1.6565 + if (hasScale) { 1.6566 + var bits = readUb($bytes, $stream, 5); 1.6567 + $.a = readFb($bytes, $stream, bits); 1.6568 + $.d = readFb($bytes, $stream, bits); 1.6569 + } else { 1.6570 + $.a = 1; 1.6571 + $.d = 1; 1.6572 + } 1.6573 + var hasRotate = readUb($bytes, $stream, 1); 1.6574 + if (hasRotate) { 1.6575 + var bits = readUb($bytes, $stream, 5); 1.6576 + $.b = readFb($bytes, $stream, bits); 1.6577 + $.c = readFb($bytes, $stream, bits); 1.6578 + } else { 1.6579 + $.b = 0; 1.6580 + $.c = 0; 1.6581 + } 1.6582 + var bits = readUb($bytes, $stream, 5); 1.6583 + var e = readSb($bytes, $stream, bits); 1.6584 + var f = readSb($bytes, $stream, bits); 1.6585 + $.tx = e; 1.6586 + $.ty = f; 1.6587 + align($bytes, $stream); 1.6588 + } 1.6589 + function cxform($bytes, $stream, $, swfVersion, tagCode) { 1.6590 + align($bytes, $stream); 1.6591 + var hasOffsets = readUb($bytes, $stream, 1); 1.6592 + var hasMultipliers = readUb($bytes, $stream, 1); 1.6593 + var bits = readUb($bytes, $stream, 4); 1.6594 + if (hasMultipliers) { 1.6595 + $.redMultiplier = readSb($bytes, $stream, bits); 1.6596 + $.greenMultiplier = readSb($bytes, $stream, bits); 1.6597 + $.blueMultiplier = readSb($bytes, $stream, bits); 1.6598 + if (tagCode > 4) { 1.6599 + $.alphaMultiplier = readSb($bytes, $stream, bits); 1.6600 + } else { 1.6601 + $.alphaMultiplier = 256; 1.6602 + } 1.6603 + } else { 1.6604 + $.redMultiplier = 256; 1.6605 + $.greenMultiplier = 256; 1.6606 + $.blueMultiplier = 256; 1.6607 + $.alphaMultiplier = 256; 1.6608 + } 1.6609 + if (hasOffsets) { 1.6610 + $.redOffset = readSb($bytes, $stream, bits); 1.6611 + $.greenOffset = readSb($bytes, $stream, bits); 1.6612 + $.blueOffset = readSb($bytes, $stream, bits); 1.6613 + if (tagCode > 4) { 1.6614 + $.alphaOffset = readSb($bytes, $stream, bits); 1.6615 + } else { 1.6616 + $.alphaOffset = 0; 1.6617 + } 1.6618 + } else { 1.6619 + $.redOffset = 0; 1.6620 + $.greenOffset = 0; 1.6621 + $.blueOffset = 0; 1.6622 + $.alphaOffset = 0; 1.6623 + } 1.6624 + align($bytes, $stream); 1.6625 + } 1.6626 + function fillGradient($bytes, $stream, $, swfVersion, tagCode, isMorph, type) { 1.6627 + var $128 = $.matrix = {}; 1.6628 + matrix($bytes, $stream, $128, swfVersion, tagCode); 1.6629 + if (isMorph) { 1.6630 + var $129 = $.matrixMorph = {}; 1.6631 + matrix($bytes, $stream, $129, swfVersion, tagCode); 1.6632 + } 1.6633 + gradient($bytes, $stream, $, swfVersion, tagCode, isMorph, type); 1.6634 + } 1.6635 + function gradient($bytes, $stream, $, swfVersion, tagCode, isMorph, type) { 1.6636 + if (tagCode === 83) { 1.6637 + $.spreadMode = readUb($bytes, $stream, 2); 1.6638 + $.interpolationMode = readUb($bytes, $stream, 2); 1.6639 + } else { 1.6640 + var pad = readUb($bytes, $stream, 4); 1.6641 + } 1.6642 + var count = $.count = readUb($bytes, $stream, 4); 1.6643 + var $130 = $.records = []; 1.6644 + var $131 = count; 1.6645 + while ($131--) { 1.6646 + var $132 = {}; 1.6647 + gradientRecord($bytes, $stream, $132, swfVersion, tagCode, isMorph); 1.6648 + $130.push($132); 1.6649 + } 1.6650 + if (type === 19) { 1.6651 + $.focalPoint = readFixed8($bytes, $stream); 1.6652 + if (isMorph) { 1.6653 + $.focalPointMorph = readFixed8($bytes, $stream); 1.6654 + } 1.6655 + } 1.6656 + } 1.6657 + function gradientRecord($bytes, $stream, $, swfVersion, tagCode, isMorph) { 1.6658 + $.ratio = readUi8($bytes, $stream); 1.6659 + if (tagCode > 22) { 1.6660 + var $133 = $.color = {}; 1.6661 + rgba($bytes, $stream, $133, swfVersion, tagCode); 1.6662 + } else { 1.6663 + var $134 = $.color = {}; 1.6664 + rgb($bytes, $stream, $134, swfVersion, tagCode); 1.6665 + } 1.6666 + if (isMorph) { 1.6667 + $.ratioMorph = readUi8($bytes, $stream); 1.6668 + var $135 = $.colorMorph = {}; 1.6669 + rgba($bytes, $stream, $135, swfVersion, tagCode); 1.6670 + } 1.6671 + } 1.6672 + function morphShapeWithStyle($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes) { 1.6673 + var eos, bits; 1.6674 + var temp = styles($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes); 1.6675 + var lineBits = temp.lineBits; 1.6676 + var fillBits = temp.fillBits; 1.6677 + var $160 = $.records = []; 1.6678 + do { 1.6679 + var $161 = {}; 1.6680 + var temp = shapeRecord($bytes, $stream, $161, swfVersion, tagCode, isMorph, fillBits, lineBits, hasStrokes, bits); 1.6681 + var eos = temp.eos; 1.6682 + var flags = temp.flags; 1.6683 + var type = temp.type; 1.6684 + var fillBits = temp.fillBits; 1.6685 + var lineBits = temp.lineBits; 1.6686 + var bits = temp.bits; 1.6687 + $160.push($161); 1.6688 + } while (!eos); 1.6689 + var temp = styleBits($bytes, $stream, $, swfVersion, tagCode); 1.6690 + var fillBits = temp.fillBits; 1.6691 + var lineBits = temp.lineBits; 1.6692 + var $162 = $.recordsMorph = []; 1.6693 + do { 1.6694 + var $163 = {}; 1.6695 + var temp = shapeRecord($bytes, $stream, $163, swfVersion, tagCode, isMorph, fillBits, lineBits, hasStrokes, bits); 1.6696 + eos = temp.eos; 1.6697 + var flags = temp.flags; 1.6698 + var type = temp.type; 1.6699 + var fillBits = temp.fillBits; 1.6700 + var lineBits = temp.lineBits; 1.6701 + bits = temp.bits; 1.6702 + $162.push($163); 1.6703 + } while (!eos); 1.6704 + } 1.6705 + function shapeWithStyle($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes) { 1.6706 + var eos; 1.6707 + var temp = styles($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes); 1.6708 + var fillBits = temp.fillBits; 1.6709 + var lineBits = temp.lineBits; 1.6710 + var $160 = $.records = []; 1.6711 + do { 1.6712 + var $161 = {}; 1.6713 + var temp = shapeRecord($bytes, $stream, $161, swfVersion, tagCode, isMorph, fillBits, lineBits, hasStrokes, bits); 1.6714 + eos = temp.eos; 1.6715 + var flags = temp.flags; 1.6716 + var type = temp.type; 1.6717 + var fillBits = temp.fillBits; 1.6718 + var lineBits = temp.lineBits; 1.6719 + var bits = temp.bits; 1.6720 + $160.push($161); 1.6721 + } while (!eos); 1.6722 + } 1.6723 + function shapeRecord($bytes, $stream, $, swfVersion, tagCode, isMorph, fillBits, lineBits, hasStrokes, bits) { 1.6724 + var type = $.type = readUb($bytes, $stream, 1); 1.6725 + var flags = readUb($bytes, $stream, 5); 1.6726 + var eos = $.eos = !(type || flags); 1.6727 + if (type) { 1.6728 + var temp = shapeRecordEdge($bytes, $stream, $, swfVersion, tagCode, flags, bits); 1.6729 + var bits = temp.bits; 1.6730 + } else { 1.6731 + var temp = shapeRecordSetup($bytes, $stream, $, swfVersion, tagCode, flags, isMorph, fillBits, lineBits, hasStrokes, bits); 1.6732 + var fillBits = temp.fillBits; 1.6733 + var lineBits = temp.lineBits; 1.6734 + var bits = temp.bits; 1.6735 + } 1.6736 + return { 1.6737 + type: type, 1.6738 + flags: flags, 1.6739 + eos: eos, 1.6740 + fillBits: fillBits, 1.6741 + lineBits: lineBits, 1.6742 + bits: bits 1.6743 + }; 1.6744 + } 1.6745 + function shapeRecordEdge($bytes, $stream, $, swfVersion, tagCode, flags, bits) { 1.6746 + var isStraight = 0, tmp = 0, bits = 0, isGeneral = 0, isVertical = 0; 1.6747 + isStraight = $.isStraight = flags >> 4; 1.6748 + tmp = flags & 15; 1.6749 + bits = tmp + 2; 1.6750 + if (isStraight) { 1.6751 + isGeneral = $.isGeneral = readUb($bytes, $stream, 1); 1.6752 + if (isGeneral) { 1.6753 + $.deltaX = readSb($bytes, $stream, bits); 1.6754 + $.deltaY = readSb($bytes, $stream, bits); 1.6755 + } else { 1.6756 + isVertical = $.isVertical = readUb($bytes, $stream, 1); 1.6757 + if (isVertical) { 1.6758 + $.deltaY = readSb($bytes, $stream, bits); 1.6759 + } else { 1.6760 + $.deltaX = readSb($bytes, $stream, bits); 1.6761 + } 1.6762 + } 1.6763 + } else { 1.6764 + $.controlDeltaX = readSb($bytes, $stream, bits); 1.6765 + $.controlDeltaY = readSb($bytes, $stream, bits); 1.6766 + $.anchorDeltaX = readSb($bytes, $stream, bits); 1.6767 + $.anchorDeltaY = readSb($bytes, $stream, bits); 1.6768 + } 1.6769 + return { 1.6770 + bits: bits 1.6771 + }; 1.6772 + } 1.6773 + function shapeRecordSetup($bytes, $stream, $, swfVersion, tagCode, flags, isMorph, fillBits, lineBits, hasStrokes, bits) { 1.6774 + var hasNewStyles = 0, hasLineStyle = 0, hasFillStyle1 = 0; 1.6775 + var hasFillStyle0 = 0, move = 0; 1.6776 + if (tagCode > 2) { 1.6777 + hasNewStyles = $.hasNewStyles = flags >> 4; 1.6778 + } else { 1.6779 + hasNewStyles = $.hasNewStyles = 0; 1.6780 + } 1.6781 + hasLineStyle = $.hasLineStyle = flags >> 3 & 1; 1.6782 + hasFillStyle1 = $.hasFillStyle1 = flags >> 2 & 1; 1.6783 + hasFillStyle0 = $.hasFillStyle0 = flags >> 1 & 1; 1.6784 + move = $.move = flags & 1; 1.6785 + if (move) { 1.6786 + bits = readUb($bytes, $stream, 5); 1.6787 + $.moveX = readSb($bytes, $stream, bits); 1.6788 + $.moveY = readSb($bytes, $stream, bits); 1.6789 + } 1.6790 + if (hasFillStyle0) { 1.6791 + $.fillStyle0 = readUb($bytes, $stream, fillBits); 1.6792 + } 1.6793 + if (hasFillStyle1) { 1.6794 + $.fillStyle1 = readUb($bytes, $stream, fillBits); 1.6795 + } 1.6796 + if (hasLineStyle) { 1.6797 + $.lineStyle = readUb($bytes, $stream, lineBits); 1.6798 + } 1.6799 + if (hasNewStyles) { 1.6800 + var temp = styles($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes); 1.6801 + var lineBits = temp.lineBits; 1.6802 + var fillBits = temp.fillBits; 1.6803 + } 1.6804 + return { 1.6805 + lineBits: lineBits, 1.6806 + fillBits: fillBits, 1.6807 + bits: bits 1.6808 + }; 1.6809 + } 1.6810 + function styles($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes) { 1.6811 + fillStyleArray($bytes, $stream, $, swfVersion, tagCode, isMorph); 1.6812 + lineStyleArray($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes); 1.6813 + var temp = styleBits($bytes, $stream, $, swfVersion, tagCode); 1.6814 + var fillBits = temp.fillBits; 1.6815 + var lineBits = temp.lineBits; 1.6816 + return { 1.6817 + fillBits: fillBits, 1.6818 + lineBits: lineBits 1.6819 + }; 1.6820 + } 1.6821 + function fillStyleArray($bytes, $stream, $, swfVersion, tagCode, isMorph) { 1.6822 + var count; 1.6823 + var tmp = readUi8($bytes, $stream); 1.6824 + if (tagCode > 2 && tmp === 255) { 1.6825 + count = readUi16($bytes, $stream); 1.6826 + } else { 1.6827 + count = tmp; 1.6828 + } 1.6829 + var $4 = $.fillStyles = []; 1.6830 + var $5 = count; 1.6831 + while ($5--) { 1.6832 + var $6 = {}; 1.6833 + fillStyle($bytes, $stream, $6, swfVersion, tagCode, isMorph); 1.6834 + $4.push($6); 1.6835 + } 1.6836 + } 1.6837 + function lineStyleArray($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes) { 1.6838 + var count; 1.6839 + var tmp = readUi8($bytes, $stream); 1.6840 + if (tagCode > 2 && tmp === 255) { 1.6841 + count = readUi16($bytes, $stream); 1.6842 + } else { 1.6843 + count = tmp; 1.6844 + } 1.6845 + var $138 = $.lineStyles = []; 1.6846 + var $139 = count; 1.6847 + while ($139--) { 1.6848 + var $140 = {}; 1.6849 + lineStyle($bytes, $stream, $140, swfVersion, tagCode, isMorph, hasStrokes); 1.6850 + $138.push($140); 1.6851 + } 1.6852 + } 1.6853 + function styleBits($bytes, $stream, $, swfVersion, tagCode) { 1.6854 + align($bytes, $stream); 1.6855 + var fillBits = readUb($bytes, $stream, 4); 1.6856 + var lineBits = readUb($bytes, $stream, 4); 1.6857 + return { 1.6858 + fillBits: fillBits, 1.6859 + lineBits: lineBits 1.6860 + }; 1.6861 + } 1.6862 + function fillStyle($bytes, $stream, $, swfVersion, tagCode, isMorph) { 1.6863 + var type = $.type = readUi8($bytes, $stream); 1.6864 + switch (type) { 1.6865 + case 0: 1.6866 + fillSolid($bytes, $stream, $, swfVersion, tagCode, isMorph); 1.6867 + break; 1.6868 + case 16: 1.6869 + case 18: 1.6870 + case 19: 1.6871 + fillGradient($bytes, $stream, $, swfVersion, tagCode, isMorph, type); 1.6872 + break; 1.6873 + case 64: 1.6874 + case 65: 1.6875 + case 66: 1.6876 + case 67: 1.6877 + fillBitmap($bytes, $stream, $, swfVersion, tagCode, isMorph, type); 1.6878 + break; 1.6879 + default: 1.6880 + } 1.6881 + } 1.6882 + function lineStyle($bytes, $stream, $, swfVersion, tagCode, isMorph, hasStrokes) { 1.6883 + $.width = readUi16($bytes, $stream); 1.6884 + if (isMorph) { 1.6885 + $.widthMorph = readUi16($bytes, $stream); 1.6886 + } 1.6887 + if (hasStrokes) { 1.6888 + align($bytes, $stream); 1.6889 + $.startCapStyle = readUb($bytes, $stream, 2); 1.6890 + var joinStyle = $.joinStyle = readUb($bytes, $stream, 2); 1.6891 + var hasFill = $.hasFill = readUb($bytes, $stream, 1); 1.6892 + $.noHscale = readUb($bytes, $stream, 1); 1.6893 + $.noVscale = readUb($bytes, $stream, 1); 1.6894 + $.pixelHinting = readUb($bytes, $stream, 1); 1.6895 + var reserved = readUb($bytes, $stream, 5); 1.6896 + $.noClose = readUb($bytes, $stream, 1); 1.6897 + $.endCapStyle = readUb($bytes, $stream, 2); 1.6898 + if (joinStyle === 2) { 1.6899 + $.miterLimitFactor = readFixed8($bytes, $stream); 1.6900 + } 1.6901 + if (hasFill) { 1.6902 + var $141 = $.fillStyle = {}; 1.6903 + fillStyle($bytes, $stream, $141, swfVersion, tagCode, isMorph); 1.6904 + } else { 1.6905 + var $155 = $.color = {}; 1.6906 + rgba($bytes, $stream, $155, swfVersion, tagCode); 1.6907 + if (isMorph) { 1.6908 + var $156 = $.colorMorph = {}; 1.6909 + rgba($bytes, $stream, $156, swfVersion, tagCode); 1.6910 + } 1.6911 + } 1.6912 + } else { 1.6913 + if (tagCode > 22) { 1.6914 + var $157 = $.color = {}; 1.6915 + rgba($bytes, $stream, $157, swfVersion, tagCode); 1.6916 + } else { 1.6917 + var $158 = $.color = {}; 1.6918 + rgb($bytes, $stream, $158, swfVersion, tagCode); 1.6919 + } 1.6920 + if (isMorph) { 1.6921 + var $159 = $.colorMorph = {}; 1.6922 + rgba($bytes, $stream, $159, swfVersion, tagCode); 1.6923 + } 1.6924 + } 1.6925 + } 1.6926 + function fillBitmap($bytes, $stream, $, swfVersion, tagCode, isMorph, type) { 1.6927 + $.bitmapId = readUi16($bytes, $stream); 1.6928 + var $18 = $.matrix = {}; 1.6929 + matrix($bytes, $stream, $18, swfVersion, tagCode); 1.6930 + if (isMorph) { 1.6931 + var $19 = $.matrixMorph = {}; 1.6932 + matrix($bytes, $stream, $19, swfVersion, tagCode); 1.6933 + } 1.6934 + $.condition = type === 64 || type === 67; 1.6935 + } 1.6936 + function filterGlow($bytes, $stream, $, swfVersion, tagCode, type) { 1.6937 + var count; 1.6938 + if (type === 4 || type === 7) { 1.6939 + count = readUi8($bytes, $stream); 1.6940 + } else { 1.6941 + count = 1; 1.6942 + } 1.6943 + var $5 = $.colors = []; 1.6944 + var $6 = count; 1.6945 + while ($6--) { 1.6946 + var $7 = {}; 1.6947 + rgba($bytes, $stream, $7, swfVersion, tagCode); 1.6948 + $5.push($7); 1.6949 + } 1.6950 + if (type === 3) { 1.6951 + var $8 = $.higlightColor = {}; 1.6952 + rgba($bytes, $stream, $8, swfVersion, tagCode); 1.6953 + } 1.6954 + if (type === 4 || type === 7) { 1.6955 + var $9 = $.ratios = []; 1.6956 + var $10 = count; 1.6957 + while ($10--) { 1.6958 + $9.push(readUi8($bytes, $stream)); 1.6959 + } 1.6960 + } 1.6961 + $.blurX = readFixed($bytes, $stream); 1.6962 + $.blurY = readFixed($bytes, $stream); 1.6963 + if (type !== 2) { 1.6964 + $.angle = readFixed($bytes, $stream); 1.6965 + $.distance = readFixed($bytes, $stream); 1.6966 + } 1.6967 + $.strength = readFixed8($bytes, $stream); 1.6968 + $.innerShadow = readUb($bytes, $stream, 1); 1.6969 + $.knockout = readUb($bytes, $stream, 1); 1.6970 + $.compositeSource = readUb($bytes, $stream, 1); 1.6971 + if (type === 3) { 1.6972 + $.onTop = readUb($bytes, $stream, 1); 1.6973 + } else { 1.6974 + var reserved = readUb($bytes, $stream, 1); 1.6975 + } 1.6976 + if (type === 4 || type === 7) { 1.6977 + $.passes = readUb($bytes, $stream, 4); 1.6978 + } else { 1.6979 + var reserved = readUb($bytes, $stream, 4); 1.6980 + } 1.6981 + } 1.6982 + function filterBlur($bytes, $stream, $, swfVersion, tagCode) { 1.6983 + $.blurX = readFixed($bytes, $stream); 1.6984 + $.blurY = readFixed($bytes, $stream); 1.6985 + $.passes = readUb($bytes, $stream, 5); 1.6986 + var reserved = readUb($bytes, $stream, 3); 1.6987 + } 1.6988 + function filterConvolution($bytes, $stream, $, swfVersion, tagCode) { 1.6989 + var columns = $.columns = readUi8($bytes, $stream); 1.6990 + var rows = $.rows = readUi8($bytes, $stream); 1.6991 + $.divisor = readFloat($bytes, $stream); 1.6992 + $.bias = readFloat($bytes, $stream); 1.6993 + var $17 = $.weights = []; 1.6994 + var $18 = columns * rows; 1.6995 + while ($18--) { 1.6996 + $17.push(readFloat($bytes, $stream)); 1.6997 + } 1.6998 + var $19 = $.defaultColor = {}; 1.6999 + rgba($bytes, $stream, $19, swfVersion, tagCode); 1.7000 + var reserved = readUb($bytes, $stream, 6); 1.7001 + $.clamp = readUb($bytes, $stream, 1); 1.7002 + $.preserveAlpha = readUb($bytes, $stream, 1); 1.7003 + } 1.7004 + function filterColorMatrix($bytes, $stream, $, swfVersion, tagCode) { 1.7005 + var $20 = $.matrix = []; 1.7006 + var $21 = 20; 1.7007 + while ($21--) { 1.7008 + $20.push(readFloat($bytes, $stream)); 1.7009 + } 1.7010 + } 1.7011 + function anyFilter($bytes, $stream, $, swfVersion, tagCode) { 1.7012 + var type = $.type = readUi8($bytes, $stream); 1.7013 + switch (type) { 1.7014 + case 0: 1.7015 + case 2: 1.7016 + case 3: 1.7017 + case 4: 1.7018 + case 7: 1.7019 + filterGlow($bytes, $stream, $, swfVersion, tagCode, type); 1.7020 + break; 1.7021 + case 1: 1.7022 + filterBlur($bytes, $stream, $, swfVersion, tagCode); 1.7023 + break; 1.7024 + case 5: 1.7025 + filterConvolution($bytes, $stream, $, swfVersion, tagCode); 1.7026 + break; 1.7027 + case 6: 1.7028 + filterColorMatrix($bytes, $stream, $, swfVersion, tagCode); 1.7029 + break; 1.7030 + default: 1.7031 + } 1.7032 + } 1.7033 + function events($bytes, $stream, $, swfVersion, tagCode) { 1.7034 + var flags, keyPress; 1.7035 + if (swfVersion >= 6) { 1.7036 + flags = readUi32($bytes, $stream); 1.7037 + } else { 1.7038 + flags = readUi16($bytes, $stream); 1.7039 + } 1.7040 + var eoe = $.eoe = !flags; 1.7041 + $.onKeyUp = flags >> 7 & 1; 1.7042 + $.onKeyDown = flags >> 6 & 1; 1.7043 + $.onMouseUp = flags >> 5 & 1; 1.7044 + $.onMouseDown = flags >> 4 & 1; 1.7045 + $.onMouseMove = flags >> 3 & 1; 1.7046 + $.onUnload = flags >> 2 & 1; 1.7047 + $.onEnterFrame = flags >> 1 & 1; 1.7048 + $.onLoad = flags & 1; 1.7049 + if (swfVersion >= 6) { 1.7050 + $.onDragOver = flags >> 15 & 1; 1.7051 + $.onRollOut = flags >> 14 & 1; 1.7052 + $.onRollOver = flags >> 13 & 1; 1.7053 + $.onReleaseOutside = flags >> 12 & 1; 1.7054 + $.onRelease = flags >> 11 & 1; 1.7055 + $.onPress = flags >> 10 & 1; 1.7056 + $.onInitialize = flags >> 9 & 1; 1.7057 + $.onData = flags >> 8 & 1; 1.7058 + if (swfVersion >= 7) { 1.7059 + $.onConstruct = flags >> 18 & 1; 1.7060 + } else { 1.7061 + $.onConstruct = 0; 1.7062 + } 1.7063 + keyPress = $.keyPress = flags >> 17 & 1; 1.7064 + $.onDragOut = flags >> 16 & 1; 1.7065 + } 1.7066 + if (!eoe) { 1.7067 + var length = $.length = readUi32($bytes, $stream); 1.7068 + if (keyPress) { 1.7069 + $.keyCode = readUi8($bytes, $stream); 1.7070 + } 1.7071 + $.actionsData = readBinary($bytes, $stream, length - (keyPress ? 1 : 0)); 1.7072 + } 1.7073 + return { 1.7074 + eoe: eoe 1.7075 + }; 1.7076 + } 1.7077 + function kerning($bytes, $stream, $, swfVersion, tagCode, wide) { 1.7078 + if (wide) { 1.7079 + $.code1 = readUi16($bytes, $stream); 1.7080 + $.code2 = readUi16($bytes, $stream); 1.7081 + } else { 1.7082 + $.code1 = readUi8($bytes, $stream); 1.7083 + $.code2 = readUi8($bytes, $stream); 1.7084 + } 1.7085 + $.adjustment = readUi16($bytes, $stream); 1.7086 + } 1.7087 + function textEntry($bytes, $stream, $, swfVersion, tagCode, glyphBits, advanceBits) { 1.7088 + $.glyphIndex = readUb($bytes, $stream, glyphBits); 1.7089 + $.advance = readSb($bytes, $stream, advanceBits); 1.7090 + } 1.7091 + function textRecordSetup($bytes, $stream, $, swfVersion, tagCode, flags) { 1.7092 + var hasFont = $.hasFont = flags >> 3 & 1; 1.7093 + var hasColor = $.hasColor = flags >> 2 & 1; 1.7094 + var hasMoveY = $.hasMoveY = flags >> 1 & 1; 1.7095 + var hasMoveX = $.hasMoveX = flags & 1; 1.7096 + if (hasFont) { 1.7097 + $.fontId = readUi16($bytes, $stream); 1.7098 + } 1.7099 + if (hasColor) { 1.7100 + if (tagCode === 33) { 1.7101 + var $4 = $.color = {}; 1.7102 + rgba($bytes, $stream, $4, swfVersion, tagCode); 1.7103 + } else { 1.7104 + var $5 = $.color = {}; 1.7105 + rgb($bytes, $stream, $5, swfVersion, tagCode); 1.7106 + } 1.7107 + } 1.7108 + if (hasMoveX) { 1.7109 + $.moveX = readSi16($bytes, $stream); 1.7110 + } 1.7111 + if (hasMoveY) { 1.7112 + $.moveY = readSi16($bytes, $stream); 1.7113 + } 1.7114 + if (hasFont) { 1.7115 + $.fontHeight = readUi16($bytes, $stream); 1.7116 + } 1.7117 + } 1.7118 + function textRecord($bytes, $stream, $, swfVersion, tagCode, glyphBits, advanceBits) { 1.7119 + var glyphCount; 1.7120 + align($bytes, $stream); 1.7121 + var flags = readUb($bytes, $stream, 8); 1.7122 + var eot = $.eot = !flags; 1.7123 + textRecordSetup($bytes, $stream, $, swfVersion, tagCode, flags); 1.7124 + if (!eot) { 1.7125 + var tmp = readUi8($bytes, $stream); 1.7126 + if (swfVersion > 6) { 1.7127 + glyphCount = $.glyphCount = tmp; 1.7128 + } else { 1.7129 + glyphCount = $.glyphCount = tmp & 127; 1.7130 + } 1.7131 + var $6 = $.entries = []; 1.7132 + var $7 = glyphCount; 1.7133 + while ($7--) { 1.7134 + var $8 = {}; 1.7135 + textEntry($bytes, $stream, $8, swfVersion, tagCode, glyphBits, advanceBits); 1.7136 + $6.push($8); 1.7137 + } 1.7138 + } 1.7139 + return { 1.7140 + eot: eot 1.7141 + }; 1.7142 + } 1.7143 + function soundEnvelope($bytes, $stream, $, swfVersion, tagCode) { 1.7144 + $.pos44 = readUi32($bytes, $stream); 1.7145 + $.volumeLeft = readUi16($bytes, $stream); 1.7146 + $.volumeRight = readUi16($bytes, $stream); 1.7147 + } 1.7148 + function soundInfo($bytes, $stream, $, swfVersion, tagCode) { 1.7149 + var reserved = readUb($bytes, $stream, 2); 1.7150 + $.stop = readUb($bytes, $stream, 1); 1.7151 + $.noMultiple = readUb($bytes, $stream, 1); 1.7152 + var hasEnvelope = $.hasEnvelope = readUb($bytes, $stream, 1); 1.7153 + var hasLoops = $.hasLoops = readUb($bytes, $stream, 1); 1.7154 + var hasOutPoint = $.hasOutPoint = readUb($bytes, $stream, 1); 1.7155 + var hasInPoint = $.hasInPoint = readUb($bytes, $stream, 1); 1.7156 + if (hasInPoint) { 1.7157 + $.inPoint = readUi32($bytes, $stream); 1.7158 + } 1.7159 + if (hasOutPoint) { 1.7160 + $.outPoint = readUi32($bytes, $stream); 1.7161 + } 1.7162 + if (hasLoops) { 1.7163 + $.loopCount = readUi16($bytes, $stream); 1.7164 + } 1.7165 + if (hasEnvelope) { 1.7166 + var envelopeCount = $.envelopeCount = readUi8($bytes, $stream); 1.7167 + var $1 = $.envelopes = []; 1.7168 + var $2 = envelopeCount; 1.7169 + while ($2--) { 1.7170 + var $3 = {}; 1.7171 + soundEnvelope($bytes, $stream, $3, swfVersion, tagCode); 1.7172 + $1.push($3); 1.7173 + } 1.7174 + } 1.7175 + } 1.7176 + function button($bytes, $stream, $, swfVersion, tagCode) { 1.7177 + var hasFilters, blend; 1.7178 + var flags = readUi8($bytes, $stream); 1.7179 + var eob = $.eob = !flags; 1.7180 + if (swfVersion >= 8) { 1.7181 + blend = $.blend = flags >> 5 & 1; 1.7182 + hasFilters = $.hasFilters = flags >> 4 & 1; 1.7183 + } else { 1.7184 + blend = $.blend = 0; 1.7185 + hasFilters = $.hasFilters = 0; 1.7186 + } 1.7187 + $.stateHitTest = flags >> 3 & 1; 1.7188 + $.stateDown = flags >> 2 & 1; 1.7189 + $.stateOver = flags >> 1 & 1; 1.7190 + $.stateUp = flags & 1; 1.7191 + if (!eob) { 1.7192 + $.symbolId = readUi16($bytes, $stream); 1.7193 + $.depth = readUi16($bytes, $stream); 1.7194 + var $2 = $.matrix = {}; 1.7195 + matrix($bytes, $stream, $2, swfVersion, tagCode); 1.7196 + if (tagCode === 34) { 1.7197 + var $3 = $.cxform = {}; 1.7198 + cxform($bytes, $stream, $3, swfVersion, tagCode); 1.7199 + } 1.7200 + if (hasFilters) { 1.7201 + $.filterCount = readUi8($bytes, $stream); 1.7202 + var $4 = $.filters = {}; 1.7203 + anyFilter($bytes, $stream, $4, swfVersion, tagCode); 1.7204 + } 1.7205 + if (blend) { 1.7206 + $.blendMode = readUi8($bytes, $stream); 1.7207 + } 1.7208 + } 1.7209 + return { 1.7210 + eob: eob 1.7211 + }; 1.7212 + } 1.7213 + function buttonCondAction($bytes, $stream, $, swfVersion, tagCode) { 1.7214 + var buttonCondSize = readUi16($bytes, $stream); 1.7215 + var buttonConditions = readUi16($bytes, $stream); 1.7216 + $.idleToOverDown = buttonConditions >> 7 & 1; 1.7217 + $.outDownToIdle = buttonConditions >> 6 & 1; 1.7218 + $.outDownToOverDown = buttonConditions >> 5 & 1; 1.7219 + $.overDownToOutDown = buttonConditions >> 4 & 1; 1.7220 + $.overDownToOverUp = buttonConditions >> 3 & 1; 1.7221 + $.overUpToOverDown = buttonConditions >> 2 & 1; 1.7222 + $.overUpToIdle = buttonConditions >> 1 & 1; 1.7223 + $.idleToOverUp = buttonConditions & 1; 1.7224 + $.mouseEventFlags = buttonConditions & 511; 1.7225 + $.keyPress = buttonConditions >> 9 & 127; 1.7226 + $.overDownToIdle = buttonConditions >> 8 & 1; 1.7227 + if (!buttonCondSize) { 1.7228 + $.actionsData = readBinary($bytes, $stream, 0); 1.7229 + } else { 1.7230 + $.actionsData = readBinary($bytes, $stream, buttonCondSize - 4); 1.7231 + } 1.7232 + } 1.7233 + function shape($bytes, $stream, $, swfVersion, tagCode) { 1.7234 + var eos; 1.7235 + var temp = styleBits($bytes, $stream, $, swfVersion, tagCode); 1.7236 + var fillBits = temp.fillBits; 1.7237 + var lineBits = temp.lineBits; 1.7238 + var $4 = $.records = []; 1.7239 + do { 1.7240 + var $5 = {}; 1.7241 + var isMorph = false; 1.7242 + var hasStrokes = false; 1.7243 + var temp = shapeRecord($bytes, $stream, $5, swfVersion, tagCode, isMorph, fillBits, lineBits, hasStrokes, bits); 1.7244 + eos = temp.eos; 1.7245 + var fillBits = temp.fillBits; 1.7246 + var lineBits = temp.lineBits; 1.7247 + var bits = bits; 1.7248 + $4.push($5); 1.7249 + } while (!eos); 1.7250 + } 1.7251 + return { 1.7252 + 0: undefined, 1.7253 + 1: undefined, 1.7254 + 2: defineShape, 1.7255 + 4: placeObject, 1.7256 + 5: removeObject, 1.7257 + 6: defineImage, 1.7258 + 7: defineButton, 1.7259 + 8: defineJPEGTables, 1.7260 + 9: setBackgroundColor, 1.7261 + 10: defineFont, 1.7262 + 11: defineLabel, 1.7263 + 12: doAction, 1.7264 + 13: undefined, 1.7265 + 14: defineSound, 1.7266 + 15: startSound, 1.7267 + 17: undefined, 1.7268 + 18: soundStreamHead, 1.7269 + 19: soundStreamBlock, 1.7270 + 20: defineBitmap, 1.7271 + 21: defineImage, 1.7272 + 22: defineShape, 1.7273 + 23: undefined, 1.7274 + 24: undefined, 1.7275 + 26: placeObject, 1.7276 + 28: removeObject, 1.7277 + 32: defineShape, 1.7278 + 33: defineLabel, 1.7279 + 34: defineButton, 1.7280 + 35: defineImage, 1.7281 + 36: defineBitmap, 1.7282 + 37: defineText, 1.7283 + 39: undefined, 1.7284 + 43: frameLabel, 1.7285 + 45: soundStreamHead, 1.7286 + 46: defineShape, 1.7287 + 48: defineFont2, 1.7288 + 56: exportAssets, 1.7289 + 57: undefined, 1.7290 + 58: undefined, 1.7291 + 59: doAction, 1.7292 + 60: undefined, 1.7293 + 61: undefined, 1.7294 + 62: undefined, 1.7295 + 64: undefined, 1.7296 + 65: undefined, 1.7297 + 66: undefined, 1.7298 + 69: fileAttributes, 1.7299 + 70: placeObject, 1.7300 + 71: undefined, 1.7301 + 72: doABC, 1.7302 + 73: undefined, 1.7303 + 74: undefined, 1.7304 + 75: defineFont2, 1.7305 + 76: symbolClass, 1.7306 + 77: undefined, 1.7307 + 78: defineScalingGrid, 1.7308 + 82: doABC, 1.7309 + 83: defineShape, 1.7310 + 84: defineShape, 1.7311 + 86: defineScene, 1.7312 + 87: defineBinaryData, 1.7313 + 88: undefined, 1.7314 + 89: startSound, 1.7315 + 90: defineImage, 1.7316 + 91: undefined 1.7317 + }; 1.7318 + }(this); 1.7319 +var readHeader = function readHeader($bytes, $stream, $, swfVersion, tagCode) { 1.7320 + $ || ($ = {}); 1.7321 + var $0 = $.bbox = {}; 1.7322 + align($bytes, $stream); 1.7323 + var bits = readUb($bytes, $stream, 5); 1.7324 + var xMin = readSb($bytes, $stream, bits); 1.7325 + var xMax = readSb($bytes, $stream, bits); 1.7326 + var yMin = readSb($bytes, $stream, bits); 1.7327 + var yMax = readSb($bytes, $stream, bits); 1.7328 + $0.xMin = xMin; 1.7329 + $0.xMax = xMax; 1.7330 + $0.yMin = yMin; 1.7331 + $0.yMax = yMax; 1.7332 + align($bytes, $stream); 1.7333 + var frameRateFraction = readUi8($bytes, $stream); 1.7334 + $.frameRate = readUi8($bytes, $stream) + frameRateFraction / 256; 1.7335 + $.frameCount = readUi16($bytes, $stream); 1.7336 + return $; 1.7337 +}; 1.7338 +function readTags(context, stream, swfVersion, final, onprogress, onexception) { 1.7339 + var tags = context.tags; 1.7340 + var bytes = stream.bytes; 1.7341 + var lastSuccessfulPosition; 1.7342 + var tag = null; 1.7343 + if (context._readTag) { 1.7344 + tag = context._readTag; 1.7345 + context._readTag = null; 1.7346 + } 1.7347 + try { 1.7348 + while (stream.pos < stream.end) { 1.7349 + lastSuccessfulPosition = stream.pos; 1.7350 + stream.ensure(2); 1.7351 + var tagCodeAndLength = readUi16(bytes, stream); 1.7352 + if (!tagCodeAndLength) { 1.7353 + final = true; 1.7354 + break; 1.7355 + } 1.7356 + var tagCode = tagCodeAndLength >> 6; 1.7357 + var length = tagCodeAndLength & 63; 1.7358 + if (length === 63) { 1.7359 + stream.ensure(4); 1.7360 + length = readUi32(bytes, stream); 1.7361 + } 1.7362 + if (tag) { 1.7363 + if (tagCode === 1 && tag.code === 1) { 1.7364 + tag.repeat++; 1.7365 + stream.pos += length; 1.7366 + continue; 1.7367 + } 1.7368 + tags.push(tag); 1.7369 + if (onprogress && tag.id !== undefined) { 1.7370 + onprogress(context); 1.7371 + } 1.7372 + tag = null; 1.7373 + } 1.7374 + stream.ensure(length); 1.7375 + var substream = stream.substream(stream.pos, stream.pos += length); 1.7376 + var subbytes = substream.bytes; 1.7377 + var nextTag = { 1.7378 + code: tagCode 1.7379 + }; 1.7380 + if (tagCode === 39) { 1.7381 + nextTag.type = 'sprite'; 1.7382 + nextTag.id = readUi16(subbytes, substream); 1.7383 + nextTag.frameCount = readUi16(subbytes, substream); 1.7384 + nextTag.tags = []; 1.7385 + readTags(nextTag, substream, swfVersion, true); 1.7386 + } else if (tagCode === 1) { 1.7387 + nextTag.repeat = 1; 1.7388 + } else { 1.7389 + var handler = tagHandler[tagCode]; 1.7390 + if (handler) { 1.7391 + handler(subbytes, substream, nextTag, swfVersion, tagCode); 1.7392 + } 1.7393 + } 1.7394 + tag = nextTag; 1.7395 + } 1.7396 + if (tag && final) { 1.7397 + tag.finalTag = true; 1.7398 + tags.push(tag); 1.7399 + if (onprogress) { 1.7400 + onprogress(context); 1.7401 + } 1.7402 + } else { 1.7403 + context._readTag = tag; 1.7404 + } 1.7405 + } catch (e) { 1.7406 + if (e !== StreamNoDataError) { 1.7407 + onexception && onexception(e); 1.7408 + throw e; 1.7409 + } 1.7410 + stream.pos = lastSuccessfulPosition; 1.7411 + context._readTag = tag; 1.7412 + } 1.7413 +} 1.7414 +function HeadTailBuffer(defaultSize) { 1.7415 + this.bufferSize = defaultSize || 16; 1.7416 + this.buffer = new Uint8Array(this.bufferSize); 1.7417 + this.pos = 0; 1.7418 +} 1.7419 +HeadTailBuffer.prototype = { 1.7420 + push: function (data, need) { 1.7421 + var bufferLengthNeed = this.pos + data.length; 1.7422 + if (this.bufferSize < bufferLengthNeed) { 1.7423 + var newBufferSize = this.bufferSize; 1.7424 + while (newBufferSize < bufferLengthNeed) { 1.7425 + newBufferSize <<= 1; 1.7426 + } 1.7427 + var newBuffer = new Uint8Array(newBufferSize); 1.7428 + if (this.bufferSize > 0) { 1.7429 + newBuffer.set(this.buffer); 1.7430 + } 1.7431 + this.buffer = newBuffer; 1.7432 + this.bufferSize = newBufferSize; 1.7433 + } 1.7434 + this.buffer.set(data, this.pos); 1.7435 + this.pos += data.length; 1.7436 + if (need) 1.7437 + return this.pos >= need; 1.7438 + }, 1.7439 + getHead: function (size) { 1.7440 + return this.buffer.subarray(0, size); 1.7441 + }, 1.7442 + getTail: function (offset) { 1.7443 + return this.buffer.subarray(offset, this.pos); 1.7444 + }, 1.7445 + removeHead: function (size) { 1.7446 + var tail = this.getTail(size); 1.7447 + this.buffer = new Uint8Array(this.bufferSize); 1.7448 + this.buffer.set(tail); 1.7449 + this.pos = tail.length; 1.7450 + }, 1.7451 + get arrayBuffer() { 1.7452 + return this.buffer.buffer; 1.7453 + }, 1.7454 + get length() { 1.7455 + return this.pos; 1.7456 + }, 1.7457 + createStream: function () { 1.7458 + return new Stream(this.arrayBuffer, 0, this.length); 1.7459 + } 1.7460 +}; 1.7461 +function CompressedPipe(target, length) { 1.7462 + this.target = target; 1.7463 + this.length = length; 1.7464 + this.initialize = true; 1.7465 + this.buffer = new HeadTailBuffer(8096); 1.7466 + this.state = { 1.7467 + bitBuffer: 0, 1.7468 + bitLength: 0, 1.7469 + compression: { 1.7470 + header: null, 1.7471 + distanceTable: null, 1.7472 + literalTable: null, 1.7473 + sym: null, 1.7474 + len: null, 1.7475 + sym2: null 1.7476 + } 1.7477 + }; 1.7478 + this.output = { 1.7479 + data: new Uint8Array(length), 1.7480 + available: 0, 1.7481 + completed: false 1.7482 + }; 1.7483 +} 1.7484 +CompressedPipe.prototype = { 1.7485 + push: function (data, progressInfo) { 1.7486 + var buffer = this.buffer; 1.7487 + if (this.initialize) { 1.7488 + if (!buffer.push(data, 2)) 1.7489 + return; 1.7490 + var headerBytes = buffer.getHead(2); 1.7491 + verifyDeflateHeader(headerBytes); 1.7492 + buffer.removeHead(2); 1.7493 + this.initialize = false; 1.7494 + } else { 1.7495 + buffer.push(data); 1.7496 + } 1.7497 + var stream = buffer.createStream(); 1.7498 + stream.bitBuffer = this.state.bitBuffer; 1.7499 + stream.bitLength = this.state.bitLength; 1.7500 + var output = this.output; 1.7501 + var lastAvailable = output.available; 1.7502 + try { 1.7503 + do { 1.7504 + inflateBlock(stream, output, this.state.compression); 1.7505 + } while (stream.pos < buffer.length && !output.completed); 1.7506 + } catch (e) { 1.7507 + if (e !== InflateNoDataError) 1.7508 + throw e; 1.7509 + } finally { 1.7510 + this.state.bitBuffer = stream.bitBuffer; 1.7511 + this.state.bitLength = stream.bitLength; 1.7512 + } 1.7513 + buffer.removeHead(stream.pos); 1.7514 + this.target.push(output.data.subarray(lastAvailable, output.available), progressInfo); 1.7515 + } 1.7516 +}; 1.7517 +function BodyParser(swfVersion, length, options) { 1.7518 + this.swf = { 1.7519 + swfVersion: swfVersion, 1.7520 + parseTime: 0 1.7521 + }; 1.7522 + this.buffer = new HeadTailBuffer(32768); 1.7523 + this.initialize = true; 1.7524 + this.totalRead = 0; 1.7525 + this.length = length; 1.7526 + this.options = options; 1.7527 +} 1.7528 +BodyParser.prototype = { 1.7529 + push: function (data, progressInfo) { 1.7530 + if (data.length === 0) 1.7531 + return; 1.7532 + var swf = this.swf; 1.7533 + var swfVersion = swf.swfVersion; 1.7534 + var buffer = this.buffer; 1.7535 + var options = this.options; 1.7536 + var stream; 1.7537 + if (this.initialize) { 1.7538 + var PREFETCH_SIZE = 27; 1.7539 + if (!buffer.push(data, PREFETCH_SIZE)) 1.7540 + return; 1.7541 + stream = buffer.createStream(); 1.7542 + var bytes = stream.bytes; 1.7543 + readHeader(bytes, stream, swf); 1.7544 + var nextTagHeader = readUi16(bytes, stream); 1.7545 + var FILE_ATTRIBUTES_LENGTH = 4; 1.7546 + if (nextTagHeader == (SWF_TAG_CODE_FILE_ATTRIBUTES << 6 | FILE_ATTRIBUTES_LENGTH)) { 1.7547 + stream.ensure(FILE_ATTRIBUTES_LENGTH); 1.7548 + var substream = stream.substream(stream.pos, stream.pos += FILE_ATTRIBUTES_LENGTH); 1.7549 + var handler = tagHandler[SWF_TAG_CODE_FILE_ATTRIBUTES]; 1.7550 + var fileAttributesTag = { 1.7551 + code: SWF_TAG_CODE_FILE_ATTRIBUTES 1.7552 + }; 1.7553 + handler(substream.bytes, substream, fileAttributesTag, swfVersion, SWF_TAG_CODE_FILE_ATTRIBUTES); 1.7554 + swf.fileAttributes = fileAttributesTag; 1.7555 + } else { 1.7556 + stream.pos -= 2; 1.7557 + swf.fileAttributes = {}; 1.7558 + } 1.7559 + if (options.onstart) 1.7560 + options.onstart(swf); 1.7561 + swf.tags = []; 1.7562 + this.initialize = false; 1.7563 + } else { 1.7564 + buffer.push(data); 1.7565 + stream = buffer.createStream(); 1.7566 + } 1.7567 + var finalBlock = false; 1.7568 + if (progressInfo) { 1.7569 + swf.bytesLoaded = progressInfo.bytesLoaded; 1.7570 + swf.bytesTotal = progressInfo.bytesTotal; 1.7571 + finalBlock = progressInfo.bytesLoaded >= progressInfo.bytesTotal; 1.7572 + } 1.7573 + var readStartTime = performance.now(); 1.7574 + readTags(swf, stream, swfVersion, finalBlock, options.onprogress, options.onexception); 1.7575 + swf.parseTime += performance.now() - readStartTime; 1.7576 + var read = stream.pos; 1.7577 + buffer.removeHead(read); 1.7578 + this.totalRead += read; 1.7579 + if (options.oncomplete && swf.tags[swf.tags.length - 1].finalTag) { 1.7580 + options.oncomplete(swf); 1.7581 + } 1.7582 + } 1.7583 +}; 1.7584 +SWF.parseAsync = function swf_parseAsync(options) { 1.7585 + var buffer = new HeadTailBuffer(); 1.7586 + var pipe = { 1.7587 + push: function (data, progressInfo) { 1.7588 + if (this.target !== undefined) { 1.7589 + return this.target.push(data, progressInfo); 1.7590 + } 1.7591 + if (!buffer.push(data, 8)) { 1.7592 + return null; 1.7593 + } 1.7594 + var bytes = buffer.getHead(8); 1.7595 + var magic1 = bytes[0]; 1.7596 + var magic2 = bytes[1]; 1.7597 + var magic3 = bytes[2]; 1.7598 + if ((magic1 === 70 || magic1 === 67) && magic2 === 87 && magic3 === 83) { 1.7599 + var swfVersion = bytes[3]; 1.7600 + var compressed = magic1 === 67; 1.7601 + parseSWF(compressed, swfVersion, progressInfo); 1.7602 + buffer = null; 1.7603 + return; 1.7604 + } 1.7605 + var isImage = false; 1.7606 + var imageType; 1.7607 + if (magic1 === 255 && magic2 === 216 && magic3 === 255) { 1.7608 + isImage = true; 1.7609 + imageType = 'image/jpeg'; 1.7610 + } else if (magic1 === 137 && magic2 === 80 && magic3 === 78) { 1.7611 + isImage = true; 1.7612 + imageType = 'image/png'; 1.7613 + } 1.7614 + if (isImage) { 1.7615 + parseImage(data, progressInfo.bytesTotal, imageType); 1.7616 + } 1.7617 + buffer = null; 1.7618 + }, 1.7619 + close: function () { 1.7620 + if (buffer) { 1.7621 + var symbol = { 1.7622 + command: 'empty', 1.7623 + data: buffer.buffer.subarray(0, buffer.pos) 1.7624 + }; 1.7625 + options.oncomplete && options.oncomplete(symbol); 1.7626 + } 1.7627 + if (this.target !== undefined && this.target.close) { 1.7628 + this.target.close(); 1.7629 + } 1.7630 + } 1.7631 + }; 1.7632 + function parseSWF(compressed, swfVersion, progressInfo) { 1.7633 + var stream = buffer.createStream(); 1.7634 + stream.pos += 4; 1.7635 + var fileLength = readUi32(null, stream); 1.7636 + var bodyLength = fileLength - 8; 1.7637 + var target = new BodyParser(swfVersion, bodyLength, options); 1.7638 + if (compressed) { 1.7639 + target = new CompressedPipe(target, bodyLength); 1.7640 + } 1.7641 + target.push(buffer.getTail(8), progressInfo); 1.7642 + pipe['target'] = target; 1.7643 + } 1.7644 + function parseImage(data, bytesTotal, type) { 1.7645 + var buffer = new Uint8Array(bytesTotal); 1.7646 + buffer.set(data); 1.7647 + var bufferPos = data.length; 1.7648 + pipe['target'] = { 1.7649 + push: function (data) { 1.7650 + buffer.set(data, bufferPos); 1.7651 + bufferPos += data.length; 1.7652 + }, 1.7653 + close: function () { 1.7654 + var props = {}; 1.7655 + var chunks; 1.7656 + if (type == 'image/jpeg') { 1.7657 + chunks = parseJpegChunks(props, buffer); 1.7658 + } else { 1.7659 + chunks = [ 1.7660 + buffer 1.7661 + ]; 1.7662 + } 1.7663 + var symbol = { 1.7664 + type: 'image', 1.7665 + props: props, 1.7666 + data: new Blob(chunks, { 1.7667 + type: type 1.7668 + }) 1.7669 + }; 1.7670 + options.oncomplete && options.oncomplete(symbol); 1.7671 + } 1.7672 + }; 1.7673 + } 1.7674 + return pipe; 1.7675 +}; 1.7676 +SWF.parse = function (buffer, options) { 1.7677 + if (!options) 1.7678 + options = {}; 1.7679 + var pipe = SWF.parseAsync(options); 1.7680 + var bytes = new Uint8Array(buffer); 1.7681 + var progressInfo = { 1.7682 + bytesLoaded: bytes.length, 1.7683 + bytesTotal: bytes.length 1.7684 + }; 1.7685 + pipe.push(bytes, progressInfo); 1.7686 + pipe.close(); 1.7687 +}; 1.7688 +var $RELEASE = false; 1.7689 +var isWorker = typeof window === 'undefined'; 1.7690 +if (isWorker && !true) { 1.7691 + importScripts.apply(null, [ 1.7692 + '../../lib/DataView.js/DataView.js', 1.7693 + '../flash/util.js', 1.7694 + 'config.js', 1.7695 + 'swf.js', 1.7696 + 'types.js', 1.7697 + 'structs.js', 1.7698 + 'tags.js', 1.7699 + 'inflate.js', 1.7700 + 'stream.js', 1.7701 + 'templates.js', 1.7702 + 'generator.js', 1.7703 + 'handlers.js', 1.7704 + 'parser.js', 1.7705 + 'bitmap.js', 1.7706 + 'button.js', 1.7707 + 'font.js', 1.7708 + 'image.js', 1.7709 + 'label.js', 1.7710 + 'shape.js', 1.7711 + 'sound.js', 1.7712 + 'text.js' 1.7713 + ]); 1.7714 +} 1.7715 +function defineSymbol(swfTag, symbols) { 1.7716 + var symbol; 1.7717 + switch (swfTag.code) { 1.7718 + case SWF_TAG_CODE_DEFINE_BITS: 1.7719 + case SWF_TAG_CODE_DEFINE_BITS_JPEG2: 1.7720 + case SWF_TAG_CODE_DEFINE_BITS_JPEG3: 1.7721 + case SWF_TAG_CODE_DEFINE_BITS_JPEG4: 1.7722 + case SWF_TAG_CODE_JPEG_TABLES: 1.7723 + symbol = defineImage(swfTag, symbols); 1.7724 + break; 1.7725 + case SWF_TAG_CODE_DEFINE_BITS_LOSSLESS: 1.7726 + case SWF_TAG_CODE_DEFINE_BITS_LOSSLESS2: 1.7727 + symbol = defineBitmap(swfTag); 1.7728 + break; 1.7729 + case SWF_TAG_CODE_DEFINE_BUTTON: 1.7730 + case SWF_TAG_CODE_DEFINE_BUTTON2: 1.7731 + symbol = defineButton(swfTag, symbols); 1.7732 + break; 1.7733 + case SWF_TAG_CODE_DEFINE_EDIT_TEXT: 1.7734 + symbol = defineText(swfTag, symbols); 1.7735 + break; 1.7736 + case SWF_TAG_CODE_DEFINE_FONT: 1.7737 + case SWF_TAG_CODE_DEFINE_FONT2: 1.7738 + case SWF_TAG_CODE_DEFINE_FONT3: 1.7739 + case SWF_TAG_CODE_DEFINE_FONT4: 1.7740 + symbol = defineFont(swfTag, symbols); 1.7741 + break; 1.7742 + case SWF_TAG_CODE_DEFINE_MORPH_SHAPE: 1.7743 + case SWF_TAG_CODE_DEFINE_MORPH_SHAPE2: 1.7744 + case SWF_TAG_CODE_DEFINE_SHAPE: 1.7745 + case SWF_TAG_CODE_DEFINE_SHAPE2: 1.7746 + case SWF_TAG_CODE_DEFINE_SHAPE3: 1.7747 + case SWF_TAG_CODE_DEFINE_SHAPE4: 1.7748 + symbol = defineShape(swfTag, symbols); 1.7749 + break; 1.7750 + case SWF_TAG_CODE_DEFINE_SOUND: 1.7751 + symbol = defineSound(swfTag, symbols); 1.7752 + break; 1.7753 + case SWF_TAG_CODE_DEFINE_BINARY_DATA: 1.7754 + symbol = { 1.7755 + type: 'binary', 1.7756 + id: swfTag.id, 1.7757 + data: swfTag.data 1.7758 + }; 1.7759 + break; 1.7760 + case SWF_TAG_CODE_DEFINE_SPRITE: 1.7761 + var depths = {}; 1.7762 + var frame = { 1.7763 + type: 'frame' 1.7764 + }; 1.7765 + var frames = []; 1.7766 + var tags = swfTag.tags; 1.7767 + var frameScripts = null; 1.7768 + var frameIndex = 0; 1.7769 + var soundStream = null; 1.7770 + for (var i = 0, n = tags.length; i < n; i++) { 1.7771 + var tag = tags[i]; 1.7772 + switch (tag.code) { 1.7773 + case SWF_TAG_CODE_DO_ACTION: 1.7774 + if (!frameScripts) 1.7775 + frameScripts = []; 1.7776 + frameScripts.push(frameIndex); 1.7777 + frameScripts.push(tag.actionsData); 1.7778 + break; 1.7779 + case SWF_TAG_CODE_START_SOUND: 1.7780 + var startSounds = frame.startSounds || (frame.startSounds = []); 1.7781 + startSounds.push(tag); 1.7782 + break; 1.7783 + case SWF_TAG_CODE_SOUND_STREAM_HEAD: 1.7784 + try { 1.7785 + soundStream = createSoundStream(tag); 1.7786 + frame.soundStream = soundStream.info; 1.7787 + } catch (e) { 1.7788 + } 1.7789 + break; 1.7790 + case SWF_TAG_CODE_SOUND_STREAM_BLOCK: 1.7791 + if (soundStream) { 1.7792 + frame.soundStreamBlock = soundStream.decode(tag.data); 1.7793 + } 1.7794 + break; 1.7795 + case SWF_TAG_CODE_FRAME_LABEL: 1.7796 + frame.labelName = tag.name; 1.7797 + break; 1.7798 + case SWF_TAG_CODE_PLACE_OBJECT: 1.7799 + case SWF_TAG_CODE_PLACE_OBJECT2: 1.7800 + case SWF_TAG_CODE_PLACE_OBJECT3: 1.7801 + depths[tag.depth] = tag; 1.7802 + break; 1.7803 + case SWF_TAG_CODE_REMOVE_OBJECT: 1.7804 + case SWF_TAG_CODE_REMOVE_OBJECT2: 1.7805 + depths[tag.depth] = null; 1.7806 + break; 1.7807 + case SWF_TAG_CODE_SHOW_FRAME: 1.7808 + frameIndex += tag.repeat; 1.7809 + frame.repeat = tag.repeat; 1.7810 + frame.depths = depths; 1.7811 + frames.push(frame); 1.7812 + depths = {}; 1.7813 + frame = { 1.7814 + type: 'frame' 1.7815 + }; 1.7816 + break; 1.7817 + } 1.7818 + } 1.7819 + symbol = { 1.7820 + type: 'sprite', 1.7821 + id: swfTag.id, 1.7822 + frameCount: swfTag.frameCount, 1.7823 + frames: frames, 1.7824 + frameScripts: frameScripts 1.7825 + }; 1.7826 + break; 1.7827 + case SWF_TAG_CODE_DEFINE_TEXT: 1.7828 + case SWF_TAG_CODE_DEFINE_TEXT2: 1.7829 + symbol = defineLabel(swfTag, symbols); 1.7830 + break; 1.7831 + } 1.7832 + if (!symbol) { 1.7833 + return { 1.7834 + command: 'error', 1.7835 + message: 'unknown symbol type: ' + swfTag.code 1.7836 + }; 1.7837 + } 1.7838 + symbol.isSymbol = true; 1.7839 + symbols[swfTag.id] = symbol; 1.7840 + return symbol; 1.7841 +} 1.7842 +function createParsingContext(commitData) { 1.7843 + var depths = {}; 1.7844 + var symbols = {}; 1.7845 + var frame = { 1.7846 + type: 'frame' 1.7847 + }; 1.7848 + var tagsProcessed = 0; 1.7849 + var soundStream = null; 1.7850 + var lastProgressSent = 0; 1.7851 + return { 1.7852 + onstart: function (result) { 1.7853 + commitData({ 1.7854 + command: 'init', 1.7855 + result: result 1.7856 + }); 1.7857 + }, 1.7858 + onprogress: function (result) { 1.7859 + if (Date.now() - lastProgressSent > 1000 / 24 || result.bytesLoaded === result.bytesTotal) { 1.7860 + commitData({ 1.7861 + command: 'progress', 1.7862 + result: { 1.7863 + bytesLoaded: result.bytesLoaded, 1.7864 + bytesTotal: result.bytesTotal 1.7865 + } 1.7866 + }); 1.7867 + lastProgressSent = Date.now(); 1.7868 + } 1.7869 + var tags = result.tags; 1.7870 + for (var n = tags.length; tagsProcessed < n; tagsProcessed++) { 1.7871 + var tag = tags[tagsProcessed]; 1.7872 + if ('id' in tag) { 1.7873 + var symbol = defineSymbol(tag, symbols); 1.7874 + commitData(symbol, symbol.transferables); 1.7875 + continue; 1.7876 + } 1.7877 + switch (tag.code) { 1.7878 + case SWF_TAG_CODE_DEFINE_SCENE_AND_FRAME_LABEL_DATA: 1.7879 + frame.sceneData = tag; 1.7880 + break; 1.7881 + case SWF_TAG_CODE_DEFINE_SCALING_GRID: 1.7882 + var symbolUpdate = { 1.7883 + isSymbol: true, 1.7884 + id: tag.symbolId, 1.7885 + updates: { 1.7886 + scale9Grid: tag.splitter 1.7887 + } 1.7888 + }; 1.7889 + commitData(symbolUpdate); 1.7890 + break; 1.7891 + case SWF_TAG_CODE_DO_ABC: 1.7892 + case SWF_TAG_CODE_DO_ABC_: 1.7893 + var abcBlocks = frame.abcBlocks; 1.7894 + if (abcBlocks) 1.7895 + abcBlocks.push({ 1.7896 + data: tag.data, 1.7897 + flags: tag.flags 1.7898 + }); 1.7899 + else 1.7900 + frame.abcBlocks = [ 1.7901 + { 1.7902 + data: tag.data, 1.7903 + flags: tag.flags 1.7904 + } 1.7905 + ]; 1.7906 + break; 1.7907 + case SWF_TAG_CODE_DO_ACTION: 1.7908 + var actionBlocks = frame.actionBlocks; 1.7909 + if (actionBlocks) 1.7910 + actionBlocks.push(tag.actionsData); 1.7911 + else 1.7912 + frame.actionBlocks = [ 1.7913 + tag.actionsData 1.7914 + ]; 1.7915 + break; 1.7916 + case SWF_TAG_CODE_DO_INIT_ACTION: 1.7917 + var initActionBlocks = frame.initActionBlocks || (frame.initActionBlocks = []); 1.7918 + initActionBlocks.push({ 1.7919 + spriteId: tag.spriteId, 1.7920 + actionsData: tag.actionsData 1.7921 + }); 1.7922 + break; 1.7923 + case SWF_TAG_CODE_START_SOUND: 1.7924 + var startSounds = frame.startSounds; 1.7925 + if (!startSounds) 1.7926 + frame.startSounds = startSounds = []; 1.7927 + startSounds.push(tag); 1.7928 + break; 1.7929 + case SWF_TAG_CODE_SOUND_STREAM_HEAD: 1.7930 + try { 1.7931 + soundStream = createSoundStream(tag); 1.7932 + frame.soundStream = soundStream.info; 1.7933 + } catch (e) { 1.7934 + } 1.7935 + break; 1.7936 + case SWF_TAG_CODE_SOUND_STREAM_BLOCK: 1.7937 + if (soundStream) { 1.7938 + frame.soundStreamBlock = soundStream.decode(tag.data); 1.7939 + } 1.7940 + break; 1.7941 + case SWF_TAG_CODE_EXPORT_ASSETS: 1.7942 + var exports = frame.exports; 1.7943 + if (exports) 1.7944 + frame.exports = exports.concat(tag.exports); 1.7945 + else 1.7946 + frame.exports = tag.exports.slice(0); 1.7947 + break; 1.7948 + case SWF_TAG_CODE_SYMBOL_CLASS: 1.7949 + var symbolClasses = frame.symbolClasses; 1.7950 + if (symbolClasses) 1.7951 + frame.symbolClasses = symbolClasses.concat(tag.exports); 1.7952 + else 1.7953 + frame.symbolClasses = tag.exports.slice(0); 1.7954 + break; 1.7955 + case SWF_TAG_CODE_FRAME_LABEL: 1.7956 + frame.labelName = tag.name; 1.7957 + break; 1.7958 + case SWF_TAG_CODE_PLACE_OBJECT: 1.7959 + case SWF_TAG_CODE_PLACE_OBJECT2: 1.7960 + case SWF_TAG_CODE_PLACE_OBJECT3: 1.7961 + depths[tag.depth] = tag; 1.7962 + break; 1.7963 + case SWF_TAG_CODE_REMOVE_OBJECT: 1.7964 + case SWF_TAG_CODE_REMOVE_OBJECT2: 1.7965 + depths[tag.depth] = null; 1.7966 + break; 1.7967 + case SWF_TAG_CODE_SET_BACKGROUND_COLOR: 1.7968 + frame.bgcolor = tag.color; 1.7969 + break; 1.7970 + case SWF_TAG_CODE_SHOW_FRAME: 1.7971 + frame.repeat = tag.repeat; 1.7972 + frame.depths = depths; 1.7973 + frame.complete = !(!tag.finalTag); 1.7974 + commitData(frame); 1.7975 + depths = {}; 1.7976 + frame = { 1.7977 + type: 'frame' 1.7978 + }; 1.7979 + break; 1.7980 + } 1.7981 + } 1.7982 + }, 1.7983 + oncomplete: function (result) { 1.7984 + commitData(result); 1.7985 + var stats; 1.7986 + if (typeof result.swfVersion === 'number') { 1.7987 + var bbox = result.bbox; 1.7988 + stats = { 1.7989 + topic: 'parseInfo', 1.7990 + parseTime: result.parseTime, 1.7991 + bytesTotal: result.bytesTotal, 1.7992 + swfVersion: result.swfVersion, 1.7993 + frameRate: result.frameRate, 1.7994 + width: (bbox.xMax - bbox.xMin) / 20, 1.7995 + height: (bbox.yMax - bbox.yMin) / 20, 1.7996 + isAvm2: !(!result.fileAttributes.doAbc) 1.7997 + }; 1.7998 + } 1.7999 + commitData({ 1.8000 + command: 'complete', 1.8001 + stats: stats 1.8002 + }); 1.8003 + }, 1.8004 + onexception: function (e) { 1.8005 + commitData({ 1.8006 + type: 'exception', 1.8007 + message: e.message, 1.8008 + stack: e.stack 1.8009 + }); 1.8010 + } 1.8011 + }; 1.8012 +} 1.8013 +function parseBytes(bytes, commitData) { 1.8014 + SWF.parse(bytes, createParsingContext(commitData)); 1.8015 +} 1.8016 +function ResourceLoader(scope) { 1.8017 + this.subscription = null; 1.8018 + var self = this; 1.8019 + if (!isWorker) { 1.8020 + this.messenger = { 1.8021 + postMessage: function (data) { 1.8022 + self.onmessage({ 1.8023 + data: data 1.8024 + }); 1.8025 + } 1.8026 + }; 1.8027 + } else { 1.8028 + this.messenger = scope; 1.8029 + scope.onmessage = function (event) { 1.8030 + self.listener(event.data); 1.8031 + }; 1.8032 + } 1.8033 +} 1.8034 +ResourceLoader.prototype = { 1.8035 + terminate: function () { 1.8036 + this.messenger = null; 1.8037 + this.listener = null; 1.8038 + }, 1.8039 + onmessage: function (event) { 1.8040 + this.listener(event.data); 1.8041 + }, 1.8042 + postMessage: function (data) { 1.8043 + this.listener && this.listener(data); 1.8044 + }, 1.8045 + listener: function (data) { 1.8046 + if (this.subscription) { 1.8047 + this.subscription.callback(data.data, data.progress); 1.8048 + } else if (data === 'pipe:') { 1.8049 + this.subscription = { 1.8050 + subscribe: function (callback) { 1.8051 + this.callback = callback; 1.8052 + } 1.8053 + }; 1.8054 + this.parseLoadedData(this.messenger, this.subscription); 1.8055 + } else { 1.8056 + this.parseLoadedData(this.messenger, data); 1.8057 + } 1.8058 + }, 1.8059 + parseLoadedData: function (loader, request, context) { 1.8060 + function commitData(data, transferables) { 1.8061 + try { 1.8062 + loader.postMessage(data, transferables); 1.8063 + } catch (ex) { 1.8064 + if (ex != 'DataCloneError') { 1.8065 + throw ex; 1.8066 + } 1.8067 + loader.postMessage(data); 1.8068 + } 1.8069 + } 1.8070 + if (request instanceof ArrayBuffer) { 1.8071 + parseBytes(request, commitData); 1.8072 + } else if ('subscribe' in request) { 1.8073 + var pipe = SWF.parseAsync(createParsingContext(commitData)); 1.8074 + request.subscribe(function (data, progress) { 1.8075 + if (data) { 1.8076 + pipe.push(data, progress); 1.8077 + } else { 1.8078 + pipe.close(); 1.8079 + } 1.8080 + }); 1.8081 + } else if (typeof FileReaderSync !== 'undefined') { 1.8082 + var reader = new FileReaderSync(); 1.8083 + var buffer = reader.readAsArrayBuffer(request); 1.8084 + parseBytes(buffer, commitData); 1.8085 + } else { 1.8086 + var reader = new FileReader(); 1.8087 + reader.onload = function () { 1.8088 + parseBytes(this.result, commitData); 1.8089 + }; 1.8090 + reader.readAsArrayBuffer(request); 1.8091 + } 1.8092 + } 1.8093 +}; 1.8094 +if (isWorker) { 1.8095 + var loader = new ResourceLoader(this); 1.8096 +} 1.8097 +function ActionsDataStream(array, swfVersion) { 1.8098 + this.array = array; 1.8099 + this.position = 0; 1.8100 + this.end = array.length; 1.8101 + if (swfVersion >= 6) { 1.8102 + this.readString = this.readUTF8String; 1.8103 + } else { 1.8104 + this.readString = this.readANSIString; 1.8105 + } 1.8106 + var buffer = new ArrayBuffer(4); 1.8107 + new Int32Array(buffer)[0] = 1; 1.8108 + if (!new Uint8Array(buffer)[0]) { 1.8109 + throw new Error('big-endian platform'); 1.8110 + } 1.8111 +} 1.8112 +ActionsDataStream.prototype = { 1.8113 + readUI8: function ActionsDataStream_readUI8() { 1.8114 + return this.array[this.position++]; 1.8115 + }, 1.8116 + readUI16: function ActionsDataStream_readUI16() { 1.8117 + var position = this.position, array = this.array; 1.8118 + var value = array[position + 1] << 8 | array[position]; 1.8119 + this.position = position + 2; 1.8120 + return value; 1.8121 + }, 1.8122 + readSI16: function ActionsDataStream_readSI16() { 1.8123 + var position = this.position, array = this.array; 1.8124 + var value = array[position + 1] << 8 | array[position]; 1.8125 + this.position = position + 2; 1.8126 + return value < 32768 ? value : value - 65536; 1.8127 + }, 1.8128 + readInteger: function ActionsDataStream_readInteger() { 1.8129 + var position = this.position, array = this.array; 1.8130 + var value = array[position] | array[position + 1] << 8 | array[position + 2] << 16 | array[position + 3] << 24; 1.8131 + this.position = position + 4; 1.8132 + return value; 1.8133 + }, 1.8134 + readFloat: function ActionsDataStream_readFloat() { 1.8135 + var position = this.position; 1.8136 + var array = this.array; 1.8137 + var buffer = new ArrayBuffer(4); 1.8138 + var bytes = new Uint8Array(buffer); 1.8139 + bytes[0] = array[position]; 1.8140 + bytes[1] = array[position + 1]; 1.8141 + bytes[2] = array[position + 2]; 1.8142 + bytes[3] = array[position + 3]; 1.8143 + this.position = position + 4; 1.8144 + return new Float32Array(buffer)[0]; 1.8145 + }, 1.8146 + readDouble: function ActionsDataStream_readDouble() { 1.8147 + var position = this.position; 1.8148 + var array = this.array; 1.8149 + var buffer = new ArrayBuffer(8); 1.8150 + var bytes = new Uint8Array(buffer); 1.8151 + bytes[4] = array[position]; 1.8152 + bytes[5] = array[position + 1]; 1.8153 + bytes[6] = array[position + 2]; 1.8154 + bytes[7] = array[position + 3]; 1.8155 + bytes[0] = array[position + 4]; 1.8156 + bytes[1] = array[position + 5]; 1.8157 + bytes[2] = array[position + 6]; 1.8158 + bytes[3] = array[position + 7]; 1.8159 + this.position = position + 8; 1.8160 + return new Float64Array(buffer)[0]; 1.8161 + }, 1.8162 + readBoolean: function ActionsDataStream_readBoolean() { 1.8163 + return !(!this.readUI8()); 1.8164 + }, 1.8165 + readANSIString: function ActionsDataStream_readANSIString() { 1.8166 + var value = ''; 1.8167 + var ch; 1.8168 + while (ch = this.readUI8()) { 1.8169 + value += String.fromCharCode(ch); 1.8170 + } 1.8171 + return value; 1.8172 + }, 1.8173 + readUTF8String: function ActionsDataStream_readUTF8String() { 1.8174 + var value = ''; 1.8175 + var ch; 1.8176 + while (ch = this.readUI8()) { 1.8177 + if (ch < 128) { 1.8178 + value += String.fromCharCode(ch); 1.8179 + continue; 1.8180 + } 1.8181 + if ((ch & 192) === 128) { 1.8182 + throw new Error('Invalid UTF8 encoding'); 1.8183 + } 1.8184 + var currentPrefix = 192; 1.8185 + var validBits = 5; 1.8186 + do { 1.8187 + var mask = currentPrefix >> 1 | 128; 1.8188 + if ((ch & mask) === currentPrefix) { 1.8189 + break; 1.8190 + } 1.8191 + currentPrefix = mask; 1.8192 + --validBits; 1.8193 + } while (validBits >= 0); 1.8194 + var code = ch & (1 << validBits) - 1; 1.8195 + for (var i = 5; i >= validBits; --i) { 1.8196 + ch = this.readUI8(); 1.8197 + if ((ch & 192) !== 128) { 1.8198 + throw new Error('Invalid UTF8 encoding'); 1.8199 + } 1.8200 + code = code << 6 | ch & 63; 1.8201 + } 1.8202 + if (code >= 65536) { 1.8203 + value += String.fromCharCode(code - 65536 >> 10 & 1023 | 55296, code & 1023 | 56320); 1.8204 + } else { 1.8205 + value += String.fromCharCode(code); 1.8206 + } 1.8207 + } 1.8208 + return value; 1.8209 + }, 1.8210 + readBytes: function ActionsDataStream_readBytes(length) { 1.8211 + var position = this.position; 1.8212 + var remaining = Math.max(this.end - position, 0); 1.8213 + if (remaining < length) { 1.8214 + length = remaining; 1.8215 + } 1.8216 + var subarray = this.array.subarray(position, position + length); 1.8217 + this.position = position + length; 1.8218 + return subarray; 1.8219 + } 1.8220 +}; 1.8221 +if (typeof GLOBAL !== 'undefined') { 1.8222 + GLOBAL.ActionsDataStream = ActionsDataStream; 1.8223 +} 1.8224 +var AVM1_TRACE_ENABLED = false; 1.8225 +var AVM1_ERRORS_IGNORED = true; 1.8226 +var MAX_AVM1_HANG_TIMEOUT = 1000; 1.8227 +var MAX_AVM1_ERRORS_LIMIT = 1000; 1.8228 +var MAX_AVM1_STACK_LIMIT = 256; 1.8229 +function AS2ScopeListItem(scope, next) { 1.8230 + this.scope = scope; 1.8231 + this.next = next; 1.8232 +} 1.8233 +AS2ScopeListItem.prototype = { 1.8234 + create: function (scope) { 1.8235 + return new AS2ScopeListItem(scope, this); 1.8236 + } 1.8237 +}; 1.8238 +function AS2Context(swfVersion) { 1.8239 + this.swfVersion = swfVersion; 1.8240 + this.globals = new avm1lib.AS2Globals(this); 1.8241 + this.initialScope = new AS2ScopeListItem(this.globals, null); 1.8242 + this.assets = {}; 1.8243 + this.isActive = false; 1.8244 + this.executionProhibited = false; 1.8245 + this.abortExecutionAt = 0; 1.8246 + this.stackDepth = 0; 1.8247 + this.isTryCatchListening = false; 1.8248 + this.errorsIgnored = 0; 1.8249 + this.deferScriptExecution = true; 1.8250 + this.pendingScripts = []; 1.8251 +} 1.8252 +AS2Context.instance = null; 1.8253 +AS2Context.prototype = { 1.8254 + addAsset: function (className, symbolProps) { 1.8255 + this.assets[className] = symbolProps; 1.8256 + }, 1.8257 + resolveTarget: function (target) { 1.8258 + if (!target) { 1.8259 + target = this.defaultTarget; 1.8260 + } else if (typeof target === 'string') { 1.8261 + target = lookupAS2Children(target, this.defaultTarget, this.globals.asGetPublicProperty('_root')); 1.8262 + } 1.8263 + if (typeof target !== 'object' || target === null || !('$nativeObject' in target)) { 1.8264 + throw new Error('Invalid AS2 target object: ' + Object.prototype.toString.call(target)); 1.8265 + } 1.8266 + return target; 1.8267 + }, 1.8268 + resolveLevel: function (level) { 1.8269 + return this.resolveTarget(this.globals['_level' + level]); 1.8270 + }, 1.8271 + addToPendingScripts: function (fn) { 1.8272 + if (!this.deferScriptExecution) { 1.8273 + return fn(); 1.8274 + } 1.8275 + this.pendingScripts.push(fn); 1.8276 + }, 1.8277 + flushPendingScripts: function () { 1.8278 + var scripts = this.pendingScripts; 1.8279 + while (scripts.length) { 1.8280 + scripts.shift()(); 1.8281 + } 1.8282 + this.deferScriptExecution = false; 1.8283 + } 1.8284 +}; 1.8285 +function AS2Error(error) { 1.8286 + this.error = error; 1.8287 +} 1.8288 +function AS2CriticalError(message, error) { 1.8289 + this.message = message; 1.8290 + this.error = error; 1.8291 +} 1.8292 +AS2CriticalError.prototype = Object.create(Error.prototype); 1.8293 +function isAS2MovieClip(obj) { 1.8294 + return typeof obj === 'object' && obj && obj instanceof avm1lib.AS2MovieClip; 1.8295 +} 1.8296 +function as2GetType(v) { 1.8297 + if (v === null) { 1.8298 + return 'null'; 1.8299 + } 1.8300 + var type = typeof v; 1.8301 + if (type === 'function') { 1.8302 + return 'object'; 1.8303 + } 1.8304 + if (type === 'object' && isAS2MovieClip(v)) { 1.8305 + return 'movieclip'; 1.8306 + } 1.8307 + return type; 1.8308 +} 1.8309 +function as2ToPrimitive(value) { 1.8310 + return as2GetType(value) !== 'object' ? value : value.valueOf(); 1.8311 +} 1.8312 +function as2ToAddPrimitive(value) { 1.8313 + if (as2GetType(value) !== 'object') { 1.8314 + return value; 1.8315 + } 1.8316 + if (value instanceof Date && AS2Context.instance.swfVersion >= 6) { 1.8317 + return value.toString(); 1.8318 + } else { 1.8319 + return value.valueOf(); 1.8320 + } 1.8321 +} 1.8322 +function as2ToBoolean(value) { 1.8323 + switch (as2GetType(value)) { 1.8324 + default: 1.8325 + case 'undefined': 1.8326 + case 'null': 1.8327 + return false; 1.8328 + case 'boolean': 1.8329 + return value; 1.8330 + case 'number': 1.8331 + return value !== 0 && !isNaN(value); 1.8332 + case 'string': 1.8333 + return value.length !== 0; 1.8334 + case 'movieclip': 1.8335 + case 'object': 1.8336 + return true; 1.8337 + } 1.8338 +} 1.8339 +function as2ToNumber(value) { 1.8340 + value = as2ToPrimitive(value); 1.8341 + switch (as2GetType(value)) { 1.8342 + case 'undefined': 1.8343 + case 'null': 1.8344 + return AS2Context.instance.swfVersion >= 7 ? NaN : 0; 1.8345 + case 'boolean': 1.8346 + return value ? 1 : +0; 1.8347 + case 'number': 1.8348 + return value; 1.8349 + case 'string': 1.8350 + if (value === '' && AS2Context.instance.swfVersion < 5) { 1.8351 + return 0; 1.8352 + } 1.8353 + return +value; 1.8354 + default: 1.8355 + return AS2Context.instance.swfVersion >= 5 ? NaN : 0; 1.8356 + } 1.8357 +} 1.8358 +function as2ToInteger(value) { 1.8359 + var result = as2ToNumber(value); 1.8360 + if (isNaN(result)) { 1.8361 + return 0; 1.8362 + } 1.8363 + if (!isFinite(result) || result === 0) { 1.8364 + return result; 1.8365 + } 1.8366 + return (result < 0 ? -1 : 1) * Math.abs(result) | 0; 1.8367 +} 1.8368 +function as2ToInt32(value) { 1.8369 + var result = as2ToNumber(value); 1.8370 + return isNaN(result) || !isFinite(result) || result === 0 ? 0 : result | 0; 1.8371 +} 1.8372 +function as2ToString(value) { 1.8373 + switch (as2GetType(value)) { 1.8374 + case 'undefined': 1.8375 + return AS2Context.instance.swfVersion >= 7 ? 'undefined' : ''; 1.8376 + case 'null': 1.8377 + return 'null'; 1.8378 + case 'boolean': 1.8379 + return value ? 'true' : 'false'; 1.8380 + case 'number': 1.8381 + return value.toString(); 1.8382 + case 'string': 1.8383 + return value; 1.8384 + case 'movieclip': 1.8385 + return value.$targetPath; 1.8386 + case 'object': 1.8387 + var result = value.toString !== Function.prototype.toString ? value.toString() : value; 1.8388 + if (typeof result === 'string') { 1.8389 + return result; 1.8390 + } 1.8391 + return typeof value === 'function' ? '[type Function]' : '[type Object]'; 1.8392 + } 1.8393 +} 1.8394 +function as2Compare(x, y) { 1.8395 + var x2 = as2ToPrimitive(x); 1.8396 + var y2 = as2ToPrimitive(y); 1.8397 + if (typeof x2 === 'string' && typeof y2 === 'string') { 1.8398 + return x2 < y2; 1.8399 + } else { 1.8400 + return as2ToNumber(x2) < as2ToNumber(y2); 1.8401 + } 1.8402 +} 1.8403 +function as2InstanceOf(obj, constructor) { 1.8404 + if (obj instanceof constructor) { 1.8405 + return true; 1.8406 + } 1.8407 + return false; 1.8408 +} 1.8409 +function as2ResolveProperty(obj, name) { 1.8410 + var avm2PublicName = Multiname.getPublicQualifiedName(name); 1.8411 + if (avm2PublicName in obj) { 1.8412 + return name; 1.8413 + } 1.8414 + if (isNumeric(name)) { 1.8415 + return null; 1.8416 + } 1.8417 + var lowerCaseName = avm2PublicName.toLowerCase(); 1.8418 + for (var i in obj) { 1.8419 + if (i.toLowerCase() === lowerCaseName) { 1.8420 + notImplemented('FIX THIS'); 1.8421 + } 1.8422 + } 1.8423 + return null; 1.8424 +} 1.8425 +function as2GetPrototype(obj) { 1.8426 + return obj && obj.asGetPublicProperty('prototype'); 1.8427 +} 1.8428 +function isAvm2Class(obj) { 1.8429 + return typeof obj === 'object' && obj !== null && 'instanceConstructor' in obj; 1.8430 +} 1.8431 +function as2CreatePrototypeProxy(obj) { 1.8432 + var prototype = obj.asGetPublicProperty('prototype'); 1.8433 + if (typeof Proxy === 'undefined') { 1.8434 + console.error('ES6 proxies are not found'); 1.8435 + return prototype; 1.8436 + } 1.8437 + return Proxy.create({ 1.8438 + getOwnPropertyDescriptor: function (name) { 1.8439 + return Object.getOwnPropertyDescriptor(prototype, name); 1.8440 + }, 1.8441 + getPropertyDescriptor: function (name) { 1.8442 + for (var p = prototype; p; p = Object.getPrototypeOf(p)) { 1.8443 + var desc = Object.getOwnPropertyDescriptor(p, name); 1.8444 + if (desc) 1.8445 + return desc; 1.8446 + } 1.8447 + }, 1.8448 + getOwnPropertyNames: function () { 1.8449 + return Object.getOwnPropertyNames(prototype); 1.8450 + }, 1.8451 + getPropertyNames: function () { 1.8452 + var names = Object.getOwnPropertyNames(prototype); 1.8453 + for (var p = Object.getPrototypeOf(prototype); p; p = Object.getPrototypeOf(p)) { 1.8454 + names = names.concat(Object.getOwnPropertyNames(p)); 1.8455 + } 1.8456 + return names; 1.8457 + }, 1.8458 + defineProperty: function (name, desc) { 1.8459 + if (desc) { 1.8460 + if (typeof desc.value === 'function' && desc.value._setClass) { 1.8461 + desc.value._setClass(obj); 1.8462 + } 1.8463 + if (typeof desc.get === 'function' && desc.get._setClass) { 1.8464 + desc.get._setClass(obj); 1.8465 + } 1.8466 + if (typeof desc.set === 'function' && desc.set._setClass) { 1.8467 + desc.set._setClass(obj); 1.8468 + } 1.8469 + } 1.8470 + return Object.defineProperty(prototype, name, desc); 1.8471 + }, 1.8472 + delete: function (name) { 1.8473 + return delete prototype[name]; 1.8474 + }, 1.8475 + fix: function () { 1.8476 + return undefined; 1.8477 + } 1.8478 + }); 1.8479 +} 1.8480 +function executeActions(actionsData, context, scope) { 1.8481 + if (context.executionProhibited) { 1.8482 + return; 1.8483 + } 1.8484 + var actionTracer = ActionTracerFactory.get(); 1.8485 + var scopeContainer = context.initialScope.create(scope); 1.8486 + var savedContext = AS2Context.instance; 1.8487 + try { 1.8488 + AS2Context.instance = context; 1.8489 + context.isActive = true; 1.8490 + context.abortExecutionAt = Date.now() + MAX_AVM1_HANG_TIMEOUT; 1.8491 + context.errorsIgnored = 0; 1.8492 + context.defaultTarget = scope; 1.8493 + context.globals.asSetPublicProperty('this', scope); 1.8494 + actionTracer.message('ActionScript Execution Starts'); 1.8495 + actionTracer.indent(); 1.8496 + interpretActions(actionsData, scopeContainer, null, []); 1.8497 + } catch (e) { 1.8498 + if (e instanceof AS2CriticalError) { 1.8499 + console.error('Disabling AVM1 execution'); 1.8500 + context.executionProhibited = true; 1.8501 + } 1.8502 + throw e; 1.8503 + } finally { 1.8504 + context.isActive = false; 1.8505 + actionTracer.unindent(); 1.8506 + actionTracer.message('ActionScript Execution Stops'); 1.8507 + AS2Context.instance = savedContext; 1.8508 + } 1.8509 +} 1.8510 +function lookupAS2Children(targetPath, defaultTarget, root) { 1.8511 + var path = targetPath.split(/[\/.]/g); 1.8512 + if (path[path.length - 1] === '') { 1.8513 + path.pop(); 1.8514 + } 1.8515 + var obj = defaultTarget; 1.8516 + if (path[0] === '' || path[0] === '_level0' || path[0] === '_root') { 1.8517 + obj = root; 1.8518 + path.shift(); 1.8519 + } 1.8520 + while (path.length > 0) { 1.8521 + var prevObj = obj; 1.8522 + obj = obj.$lookupChild(path[0]); 1.8523 + if (!obj) { 1.8524 + throw new Error(path[0] + ' (expr ' + targetPath + ') is not found in ' + prevObj._target); 1.8525 + } 1.8526 + path.shift(); 1.8527 + } 1.8528 + return obj; 1.8529 +} 1.8530 +function createBuiltinType(obj, args) { 1.8531 + if (obj === Array) { 1.8532 + var result = args; 1.8533 + if (args.length == 1 && typeof args[0] === 'number') { 1.8534 + result = []; 1.8535 + result.length = args[0]; 1.8536 + } 1.8537 + return result; 1.8538 + } 1.8539 + if (obj === Boolean || obj === Number || obj === String || obj === Function) { 1.8540 + return obj.apply(null, args); 1.8541 + } 1.8542 + if (obj === Date) { 1.8543 + switch (args.length) { 1.8544 + case 0: 1.8545 + return new Date(); 1.8546 + case 1: 1.8547 + return new Date(args[0]); 1.8548 + default: 1.8549 + return new Date(args[0], args[1], args.length > 2 ? args[2] : 1, args.length > 3 ? args[3] : 0, args.length > 4 ? args[4] : 0, args.length > 5 ? args[5] : 0, args.length > 6 ? args[6] : 0); 1.8550 + } 1.8551 + } 1.8552 + if (obj === Object) { 1.8553 + return {}; 1.8554 + } 1.8555 +} 1.8556 +var AS2_SUPER_STUB = {}; 1.8557 +function interpretActions(actionsData, scopeContainer, constantPool, registers) { 1.8558 + var currentContext = AS2Context.instance; 1.8559 + function setTarget(targetPath) { 1.8560 + if (!targetPath) { 1.8561 + currentContext.defaultTarget = scope; 1.8562 + return; 1.8563 + } 1.8564 + try { 1.8565 + currentContext.defaultTarget = lookupAS2Children(targetPath, defaultTarget, _global.asGetPublicProperty('_root')); 1.8566 + } catch (e) { 1.8567 + currentContext.defaultTarget = null; 1.8568 + throw e; 1.8569 + } 1.8570 + } 1.8571 + function defineFunction(functionName, parametersNames, registersAllocation, actionsData) { 1.8572 + var ownerClass; 1.8573 + var fn = function () { 1.8574 + var newScope = {}; 1.8575 + newScope.asSetPublicProperty('this', this); 1.8576 + newScope.asSetPublicProperty('arguments', arguments); 1.8577 + newScope.asSetPublicProperty('super', AS2_SUPER_STUB); 1.8578 + newScope.asSetPublicProperty('__class', ownerClass); 1.8579 + var newScopeContainer = scopeContainer.create(newScope); 1.8580 + var i; 1.8581 + for (i = 0; i < arguments.length || i < parametersNames.length; i++) { 1.8582 + newScope.asSetPublicProperty(parametersNames[i], arguments[i]); 1.8583 + } 1.8584 + var registers = []; 1.8585 + if (registersAllocation) { 1.8586 + for (i = 0; i < registersAllocation.length; i++) { 1.8587 + var registerAllocation = registersAllocation[i]; 1.8588 + if (!registerAllocation) { 1.8589 + continue; 1.8590 + } 1.8591 + if (registerAllocation.type == 'param') { 1.8592 + registers[i] = arguments[registerAllocation.index]; 1.8593 + } else { 1.8594 + switch (registerAllocation.name) { 1.8595 + case 'this': 1.8596 + registers[i] = this; 1.8597 + break; 1.8598 + case 'arguments': 1.8599 + registers[i] = arguments; 1.8600 + break; 1.8601 + case 'super': 1.8602 + registers[i] = AS2_SUPER_STUB; 1.8603 + break; 1.8604 + case '_global': 1.8605 + registers[i] = _global; 1.8606 + break; 1.8607 + case '_parent': 1.8608 + registers[i] = scope.asGetPublicProperty('_parent'); 1.8609 + break; 1.8610 + case '_root': 1.8611 + registers[i] = _global.asGetPublicProperty('_root'); 1.8612 + break; 1.8613 + } 1.8614 + } 1.8615 + } 1.8616 + } 1.8617 + var savedContext = AS2Context.instance; 1.8618 + var savedIsActive = currentContext.isActive; 1.8619 + try { 1.8620 + AS2Context.instance = currentContext; 1.8621 + if (!savedIsActive) { 1.8622 + currentContext.abortExecutionAt = Date.now() + MAX_AVM1_HANG_TIMEOUT; 1.8623 + currentContext.errorsIgnored = 0; 1.8624 + currentContext.isActive = true; 1.8625 + } 1.8626 + currentContext.defaultTarget = scope; 1.8627 + actionTracer.indent(); 1.8628 + currentContext.stackDepth++; 1.8629 + if (currentContext.stackDepth >= MAX_AVM1_STACK_LIMIT) { 1.8630 + throw new AS2CriticalError('long running script -- AVM1 recursion limit is reached'); 1.8631 + } 1.8632 + return interpretActions(actionsData, newScopeContainer, constantPool, registers); 1.8633 + } finally { 1.8634 + currentContext.isActive = savedIsActive; 1.8635 + currentContext.stackDepth--; 1.8636 + actionTracer.unindent(); 1.8637 + currentContext.defaultTarget = defaultTarget; 1.8638 + AS2Context.instance = savedContext; 1.8639 + } 1.8640 + }; 1.8641 + ownerClass = fn; 1.8642 + fn._setClass = function (class_) { 1.8643 + ownerClass = class_; 1.8644 + }; 1.8645 + fn.instanceConstructor = fn; 1.8646 + fn.debugName = 'avm1 ' + (functionName || '<function>'); 1.8647 + if (functionName) { 1.8648 + fn.name = functionName; 1.8649 + } 1.8650 + return fn; 1.8651 + } 1.8652 + function deleteProperty(propertyName) { 1.8653 + for (var p = scopeContainer; p; p = p.next) { 1.8654 + if (p.scope.asHasProperty(undefined, propertyName, 0)) { 1.8655 + p.scope.asSetPublicProperty(propertyName, undefined); 1.8656 + return p.scope.asDeleteProperty(undefined, propertyName, 0); 1.8657 + } 1.8658 + } 1.8659 + return false; 1.8660 + } 1.8661 + function resolveVariableName(variableName, nonStrict) { 1.8662 + var obj, name, i; 1.8663 + if (variableName.indexOf(':') >= 0) { 1.8664 + var parts = variableName.split(':'); 1.8665 + obj = lookupAS2Children(parts[0], defaultTarget, _global.asGetPublicProperty('_root')); 1.8666 + if (!obj) { 1.8667 + throw new Error(parts[0] + ' is undefined'); 1.8668 + } 1.8669 + name = parts[1]; 1.8670 + } else if (variableName.indexOf('.') >= 0) { 1.8671 + var objPath = variableName.split('.'); 1.8672 + name = objPath.pop(); 1.8673 + obj = _global; 1.8674 + for (i = 0; i < objPath.length; i++) { 1.8675 + obj = obj.asGetPublicProperty(objPath[i]) || obj[objPath[i]]; 1.8676 + if (!obj) { 1.8677 + throw new Error(objPath.slice(0, i + 1) + ' is undefined'); 1.8678 + } 1.8679 + } 1.8680 + } 1.8681 + if (!obj) { 1.8682 + return null; 1.8683 + } 1.8684 + var resolvedName = as2ResolveProperty(obj, name); 1.8685 + var resolved = resolvedName !== null; 1.8686 + if (resolved || nonStrict) { 1.8687 + return { 1.8688 + obj: obj, 1.8689 + name: resolvedName || name, 1.8690 + resolved: resolved 1.8691 + }; 1.8692 + } 1.8693 + return null; 1.8694 + } 1.8695 + function getThis() { 1.8696 + var _this = scope.asGetPublicProperty('this'); 1.8697 + if (_this) { 1.8698 + return _this; 1.8699 + } 1.8700 + for (var p = scopeContainer; p; p = p.next) { 1.8701 + resolvedName = as2ResolveProperty(p.scope, 'this'); 1.8702 + if (resolvedName !== null) { 1.8703 + return p.scope.asGetPublicProperty(resolvedName); 1.8704 + } 1.8705 + } 1.8706 + } 1.8707 + function getVariable(variableName) { 1.8708 + if (scope.asHasProperty(undefined, variableName, 0)) { 1.8709 + return scope.asGetPublicProperty(variableName); 1.8710 + } 1.8711 + var target = resolveVariableName(variableName); 1.8712 + if (target) { 1.8713 + return target.obj.asGetPublicProperty(target.name); 1.8714 + } 1.8715 + var resolvedName, _this = getThis(); 1.8716 + for (var p = scopeContainer; p; p = p.next) { 1.8717 + resolvedName = as2ResolveProperty(p.scope, variableName); 1.8718 + if (resolvedName !== null) { 1.8719 + return p.scope.asGetPublicProperty(resolvedName); 1.8720 + } 1.8721 + } 1.8722 + if (_this && (resolvedName = as2ResolveProperty(_this, variableName))) { 1.8723 + return _this.asGetPublicProperty(resolvedName); 1.8724 + } 1.8725 + var mc = isAS2MovieClip(defaultTarget) && defaultTarget.$lookupChild(variableName); 1.8726 + if (mc) { 1.8727 + return mc; 1.8728 + } 1.8729 + } 1.8730 + function setVariable(variableName, value) { 1.8731 + if (scope.asHasProperty(undefined, variableName, 0)) { 1.8732 + scope.asSetPublicProperty(variableName, value); 1.8733 + return; 1.8734 + } 1.8735 + var target = resolveVariableName(variableName, true); 1.8736 + if (target) { 1.8737 + target.obj.asSetPublicProperty(target.name, value); 1.8738 + return; 1.8739 + } 1.8740 + var resolvedName, _this = getThis(); 1.8741 + if (_this && (resolvedName = as2ResolveProperty(_this, variableName))) { 1.8742 + return _this.asSetPublicProperty(resolvedName, value); 1.8743 + } 1.8744 + for (var p = scopeContainer; p.next; p = p.next) { 1.8745 + resolvedName = as2ResolveProperty(p.scope, variableName); 1.8746 + if (resolvedName !== null) { 1.8747 + return p.scope.asSetPublicProperty(resolvedName, value); 1.8748 + } 1.8749 + } 1.8750 + (_this || scope).asSetPublicProperty(variableName, value); 1.8751 + } 1.8752 + function getFunction(functionName) { 1.8753 + var fn = getVariable(functionName); 1.8754 + if (!(fn instanceof Function)) { 1.8755 + throw new Error('Function "' + functionName + '" is not found'); 1.8756 + } 1.8757 + return fn; 1.8758 + } 1.8759 + function getObjectByName(objectName) { 1.8760 + var obj = getVariable(objectName); 1.8761 + if (!(obj instanceof Object)) { 1.8762 + throw new Error('Object "' + objectName + '" is not found'); 1.8763 + } 1.8764 + return obj; 1.8765 + } 1.8766 + function processWith(obj, withBlock) { 1.8767 + var newScopeContainer = scopeContainer.create(Object(obj)); 1.8768 + interpretActions(withBlock, newScopeContainer, constantPool, registers); 1.8769 + } 1.8770 + function processTry(catchIsRegisterFlag, finallyBlockFlag, catchBlockFlag, catchTarget, tryBlock, catchBlock, finallyBlock) { 1.8771 + var savedTryCatchState = currentContext.isTryCatchListening; 1.8772 + try { 1.8773 + currentContext.isTryCatchListening = true; 1.8774 + interpretActions(tryBlock, scopeContainer, constantPool, registers); 1.8775 + } catch (e) { 1.8776 + currentContext.isTryCatchListening = savedTryCatchState; 1.8777 + if (!catchBlockFlag) { 1.8778 + throw e; 1.8779 + } 1.8780 + if (!(e instanceof AS2Error)) { 1.8781 + throw e; 1.8782 + } 1.8783 + if (typeof catchTarget === 'string') { 1.8784 + scope[catchTarget] = e.error; 1.8785 + } else { 1.8786 + registers[catchTarget] = e.error; 1.8787 + } 1.8788 + interpretActions(catchBlock, scopeContainer, constantPool, registers); 1.8789 + } finally { 1.8790 + currentContext.isTryCatchListening = savedTryCatchState; 1.8791 + if (finallyBlockFlag) { 1.8792 + interpretActions(finallyBlock, scopeContainer, constantPool, registers); 1.8793 + } 1.8794 + } 1.8795 + } 1.8796 + function validateArgsCount(numArgs, maxAmount) { 1.8797 + if (isNaN(numArgs) || numArgs < 0 || numArgs > maxAmount || numArgs != (0 | numArgs)) { 1.8798 + throw new Error('Invalid number of arguments: ' + numArgs); 1.8799 + } 1.8800 + } 1.8801 + function readArgs(stack) { 1.8802 + var numArgs = +stack.pop(); 1.8803 + validateArgsCount(numArgs, stack.length); 1.8804 + var args = []; 1.8805 + for (var i = 0; i < numArgs; i++) { 1.8806 + args.push(stack.pop()); 1.8807 + } 1.8808 + return args; 1.8809 + } 1.8810 + var stream = new ActionsDataStream(actionsData, currentContext.swfVersion); 1.8811 + var _global = currentContext.globals; 1.8812 + var defaultTarget = currentContext.defaultTarget; 1.8813 + var stack = []; 1.8814 + var scope = scopeContainer.scope; 1.8815 + var isSwfVersion5 = currentContext.swfVersion >= 5; 1.8816 + var actionTracer = ActionTracerFactory.get(); 1.8817 + var nextPosition; 1.8818 + if (scope.$nativeObject && scope.$nativeObject._deferScriptExecution) { 1.8819 + currentContext.deferScriptExecution = true; 1.8820 + } 1.8821 + function skipActions(count) { 1.8822 + while (count > 0 && stream.position < stream.end) { 1.8823 + var actionCode = stream.readUI8(); 1.8824 + var length = actionCode >= 128 ? stream.readUI16() : 0; 1.8825 + stream.position += length; 1.8826 + count--; 1.8827 + } 1.8828 + nextPosition = stream.position; 1.8829 + } 1.8830 + var recoveringFromError = false; 1.8831 + var stackItemsExpected; 1.8832 + while (stream.position < stream.end) { 1.8833 + try { 1.8834 + var instructionsExecuted = 0; 1.8835 + var abortExecutionAt = currentContext.abortExecutionAt; 1.8836 + while (stream.position < stream.end) { 1.8837 + if (instructionsExecuted++ % 100 === 0 && Date.now() >= abortExecutionAt) { 1.8838 + throw new AS2CriticalError('long running script -- AVM1 instruction hang timeout'); 1.8839 + } 1.8840 + var actionCode = stream.readUI8(); 1.8841 + var length = actionCode >= 128 ? stream.readUI16() : 0; 1.8842 + nextPosition = stream.position + length; 1.8843 + stackItemsExpected = 0; 1.8844 + actionTracer.print(stream.position, actionCode, stack); 1.8845 + var frame, type, count, index, target, method, constr, codeSize, offset; 1.8846 + var name, variableName, methodName, functionName, targetName; 1.8847 + var paramName, resolvedName, objectName; 1.8848 + var value, a, b, c, f, sa, sb, obj, args, fn, result, flags, i; 1.8849 + var dragParams, register; 1.8850 + switch (actionCode | 0) { 1.8851 + case 129: 1.8852 + frame = stream.readUI16(); 1.8853 + var nextActionCode = stream.readUI8(); 1.8854 + nextPosition++; 1.8855 + methodName = nextActionCode === 6 ? 'gotoAndPlay' : 'gotoAndStop'; 1.8856 + _global[methodName](frame + 1); 1.8857 + break; 1.8858 + case 131: 1.8859 + var urlString = stream.readString(); 1.8860 + var targetString = stream.readString(); 1.8861 + _global.getURL(urlString, targetString); 1.8862 + break; 1.8863 + case 4: 1.8864 + _global.nextFrame(); 1.8865 + break; 1.8866 + case 5: 1.8867 + _global.prevFrame(); 1.8868 + break; 1.8869 + case 6: 1.8870 + _global.play(); 1.8871 + break; 1.8872 + case 7: 1.8873 + _global.stop(); 1.8874 + break; 1.8875 + case 8: 1.8876 + _global.toggleHighQuality(); 1.8877 + break; 1.8878 + case 9: 1.8879 + _global.stopAllSounds(); 1.8880 + break; 1.8881 + case 138: 1.8882 + frame = stream.readUI16(); 1.8883 + count = stream.readUI8(); 1.8884 + if (!_global.ifFrameLoaded(frame)) { 1.8885 + skipActions(count); 1.8886 + } 1.8887 + break; 1.8888 + case 139: 1.8889 + targetName = stream.readString(); 1.8890 + setTarget(targetName); 1.8891 + break; 1.8892 + case 140: 1.8893 + var label = stream.readString(); 1.8894 + _global.gotoLabel(label); 1.8895 + break; 1.8896 + case 150: 1.8897 + while (stream.position < nextPosition) { 1.8898 + type = stream.readUI8(); 1.8899 + switch (type) { 1.8900 + case 0: 1.8901 + value = stream.readString(); 1.8902 + break; 1.8903 + case 1: 1.8904 + value = stream.readFloat(); 1.8905 + break; 1.8906 + case 2: 1.8907 + value = null; 1.8908 + break; 1.8909 + case 3: 1.8910 + value = void 0; 1.8911 + break; 1.8912 + case 4: 1.8913 + value = registers[stream.readUI8()]; 1.8914 + break; 1.8915 + case 5: 1.8916 + value = stream.readBoolean(); 1.8917 + break; 1.8918 + case 6: 1.8919 + value = stream.readDouble(); 1.8920 + break; 1.8921 + case 7: 1.8922 + value = stream.readInteger(); 1.8923 + break; 1.8924 + case 8: 1.8925 + value = constantPool[stream.readUI8()]; 1.8926 + break; 1.8927 + case 9: 1.8928 + value = constantPool[stream.readUI16()]; 1.8929 + break; 1.8930 + default: 1.8931 + throw new Error('Unknown value type: ' + type); 1.8932 + } 1.8933 + stack.push(value); 1.8934 + } 1.8935 + break; 1.8936 + case 23: 1.8937 + stack.pop(); 1.8938 + break; 1.8939 + case 10: 1.8940 + a = as2ToNumber(stack.pop()); 1.8941 + b = as2ToNumber(stack.pop()); 1.8942 + stack.push(a + b); 1.8943 + break; 1.8944 + case 11: 1.8945 + a = as2ToNumber(stack.pop()); 1.8946 + b = as2ToNumber(stack.pop()); 1.8947 + stack.push(b - a); 1.8948 + break; 1.8949 + case 12: 1.8950 + a = as2ToNumber(stack.pop()); 1.8951 + b = as2ToNumber(stack.pop()); 1.8952 + stack.push(a * b); 1.8953 + break; 1.8954 + case 13: 1.8955 + a = as2ToNumber(stack.pop()); 1.8956 + b = as2ToNumber(stack.pop()); 1.8957 + c = b / a; 1.8958 + stack.push(isSwfVersion5 ? c : isFinite(c) ? c : '#ERROR#'); 1.8959 + break; 1.8960 + case 14: 1.8961 + a = as2ToNumber(stack.pop()); 1.8962 + b = as2ToNumber(stack.pop()); 1.8963 + f = a == b; 1.8964 + stack.push(isSwfVersion5 ? f : f ? 1 : 0); 1.8965 + break; 1.8966 + case 15: 1.8967 + a = as2ToNumber(stack.pop()); 1.8968 + b = as2ToNumber(stack.pop()); 1.8969 + f = b < a; 1.8970 + stack.push(isSwfVersion5 ? f : f ? 1 : 0); 1.8971 + break; 1.8972 + case 16: 1.8973 + a = as2ToBoolean(stack.pop()); 1.8974 + b = as2ToBoolean(stack.pop()); 1.8975 + f = a && b; 1.8976 + stack.push(isSwfVersion5 ? f : f ? 1 : 0); 1.8977 + break; 1.8978 + case 17: 1.8979 + a = as2ToBoolean(stack.pop()); 1.8980 + b = as2ToBoolean(stack.pop()); 1.8981 + f = a || b; 1.8982 + stack.push(isSwfVersion5 ? f : f ? 1 : 0); 1.8983 + break; 1.8984 + case 18: 1.8985 + f = !as2ToBoolean(stack.pop()); 1.8986 + stack.push(isSwfVersion5 ? f : f ? 1 : 0); 1.8987 + break; 1.8988 + case 19: 1.8989 + sa = as2ToString(stack.pop()); 1.8990 + sb = as2ToString(stack.pop()); 1.8991 + f = sa == sb; 1.8992 + stack.push(isSwfVersion5 ? f : f ? 1 : 0); 1.8993 + break; 1.8994 + case 20: 1.8995 + case 49: 1.8996 + sa = as2ToString(stack.pop()); 1.8997 + stack.push(_global.length(sa)); 1.8998 + break; 1.8999 + case 33: 1.9000 + sa = as2ToString(stack.pop()); 1.9001 + sb = as2ToString(stack.pop()); 1.9002 + stack.push(sb + sa); 1.9003 + break; 1.9004 + case 21: 1.9005 + count = stack.pop(); 1.9006 + index = stack.pop(); 1.9007 + value = as2ToString(stack.pop()); 1.9008 + stack.push(_global.substring(value, index, count)); 1.9009 + break; 1.9010 + case 53: 1.9011 + count = stack.pop(); 1.9012 + index = stack.pop(); 1.9013 + value = as2ToString(stack.pop()); 1.9014 + stack.push(_global.mbsubstring(value, index, count)); 1.9015 + break; 1.9016 + case 41: 1.9017 + sa = as2ToString(stack.pop()); 1.9018 + sb = as2ToString(stack.pop()); 1.9019 + f = sb < sa; 1.9020 + stack.push(isSwfVersion5 ? f : f ? 1 : 0); 1.9021 + break; 1.9022 + case 24: 1.9023 + stack.push(_global.int(stack.pop())); 1.9024 + break; 1.9025 + case 50: 1.9026 + stack.push(_global.chr(stack.pop())); 1.9027 + break; 1.9028 + case 54: 1.9029 + stack.push(_global.mbchr(stack.pop())); 1.9030 + break; 1.9031 + case 51: 1.9032 + stack.push(_global.ord(stack.pop())); 1.9033 + break; 1.9034 + case 55: 1.9035 + stack.push(_global.mbord(stack.pop())); 1.9036 + break; 1.9037 + case 153: 1.9038 + offset = stream.readSI16(); 1.9039 + nextPosition += offset; 1.9040 + break; 1.9041 + case 157: 1.9042 + offset = stream.readSI16(); 1.9043 + f = !(!stack.pop()); 1.9044 + if (f) { 1.9045 + nextPosition += offset; 1.9046 + } 1.9047 + break; 1.9048 + case 158: 1.9049 + label = stack.pop(); 1.9050 + _global.call(label); 1.9051 + break; 1.9052 + case 28: 1.9053 + variableName = '' + stack.pop(); 1.9054 + stackItemsExpected++; 1.9055 + stack.push(getVariable(variableName)); 1.9056 + break; 1.9057 + case 29: 1.9058 + value = stack.pop(); 1.9059 + variableName = '' + stack.pop(); 1.9060 + setVariable(variableName, value); 1.9061 + break; 1.9062 + case 154: 1.9063 + flags = stream.readUI8(); 1.9064 + target = stack.pop(); 1.9065 + var url = stack.pop(); 1.9066 + var sendVarsMethod; 1.9067 + if (flags & 1) { 1.9068 + sendVarsMethod = 'GET'; 1.9069 + } else if (flags & 2) { 1.9070 + sendVarsMethod = 'POST'; 1.9071 + } 1.9072 + var loadTargetFlag = flags & 1 << 6; 1.9073 + if (!loadTargetFlag) { 1.9074 + _global.getURL(url, target, sendVarsMethod); 1.9075 + break; 1.9076 + } 1.9077 + var loadVariablesFlag = flags & 1 << 7; 1.9078 + if (loadVariablesFlag) { 1.9079 + _global.loadVariables(url, target, sendVarsMethod); 1.9080 + } else { 1.9081 + _global.loadMovie(url, target, sendVarsMethod); 1.9082 + } 1.9083 + break; 1.9084 + case 159: 1.9085 + flags = stream.readUI8(); 1.9086 + var gotoParams = [ 1.9087 + stack.pop() 1.9088 + ]; 1.9089 + if (!(!(flags & 2))) { 1.9090 + gotoParams.push(stream.readUI16()); 1.9091 + } 1.9092 + var gotoMethod = !(!(flags & 1)) ? _global.gotoAndPlay : _global.gotoAndStop; 1.9093 + gotoMethod.apply(_global, gotoParams); 1.9094 + break; 1.9095 + case 32: 1.9096 + target = stack.pop(); 1.9097 + setTarget(target); 1.9098 + break; 1.9099 + case 34: 1.9100 + index = stack.pop(); 1.9101 + target = stack.pop(); 1.9102 + stackItemsExpected++; 1.9103 + stack.push(_global.getAS2Property(target, index)); 1.9104 + break; 1.9105 + case 35: 1.9106 + value = stack.pop(); 1.9107 + index = stack.pop(); 1.9108 + target = stack.pop(); 1.9109 + _global.setAS2Property(target, index, value); 1.9110 + break; 1.9111 + case 36: 1.9112 + var depth = stack.pop(); 1.9113 + target = stack.pop(); 1.9114 + var source = stack.pop(); 1.9115 + _global.duplicateMovieClip(source, target, depth); 1.9116 + break; 1.9117 + case 37: 1.9118 + target = stack.pop(); 1.9119 + _global.removeMovieClip(target); 1.9120 + break; 1.9121 + case 39: 1.9122 + target = stack.pop(); 1.9123 + var lockcenter = stack.pop(); 1.9124 + var constrain = !stack.pop() ? null : { 1.9125 + y2: stack.pop(), 1.9126 + x2: stack.pop(), 1.9127 + y1: stack.pop(), 1.9128 + x1: stack.pop() 1.9129 + }; 1.9130 + dragParams = [ 1.9131 + target, 1.9132 + lockcenter 1.9133 + ]; 1.9134 + if (constrain) { 1.9135 + dragParams = dragParams.push(constrain.x1, constrain.y1, constrain.x2, constrain.y2); 1.9136 + } 1.9137 + _global.startDrag.apply(_global, dragParams); 1.9138 + break; 1.9139 + case 40: 1.9140 + _global.stopDrag(); 1.9141 + break; 1.9142 + case 141: 1.9143 + count = stream.readUI8(); 1.9144 + frame = stack.pop(); 1.9145 + if (!_global.ifFrameLoaded(frame)) { 1.9146 + skipActions(count); 1.9147 + } 1.9148 + break; 1.9149 + case 38: 1.9150 + value = stack.pop(); 1.9151 + _global.trace(value); 1.9152 + break; 1.9153 + case 52: 1.9154 + stack.push(_global.getTimer()); 1.9155 + break; 1.9156 + case 48: 1.9157 + stack.push(_global.random(stack.pop())); 1.9158 + break; 1.9159 + case 61: 1.9160 + functionName = stack.pop(); 1.9161 + args = readArgs(stack); 1.9162 + stackItemsExpected++; 1.9163 + fn = getFunction(functionName); 1.9164 + result = fn.apply(scope, args); 1.9165 + stack.push(result); 1.9166 + break; 1.9167 + case 82: 1.9168 + methodName = stack.pop(); 1.9169 + obj = stack.pop(); 1.9170 + args = readArgs(stack); 1.9171 + stackItemsExpected++; 1.9172 + if (methodName !== null && methodName !== undefined && methodName !== '') { 1.9173 + if (obj === null || obj === undefined) { 1.9174 + throw new Error('Cannot call method ' + methodName + ' of ' + typeof obj); 1.9175 + } else if (obj !== AS2_SUPER_STUB) { 1.9176 + target = Object(obj); 1.9177 + } else { 1.9178 + target = as2GetPrototype(getVariable('__class').__super); 1.9179 + obj = getVariable('this'); 1.9180 + } 1.9181 + resolvedName = as2ResolveProperty(target, methodName); 1.9182 + if (resolvedName === null) { 1.9183 + throw new Error('Method ' + methodName + ' is not defined.'); 1.9184 + } 1.9185 + result = target.asGetPublicProperty(resolvedName).apply(obj, args); 1.9186 + } else if (obj !== AS2_SUPER_STUB) { 1.9187 + result = obj.apply(obj, args); 1.9188 + } else { 1.9189 + result = getVariable('__class').__super.apply(getVariable('this'), args); 1.9190 + } 1.9191 + stack.push(result); 1.9192 + break; 1.9193 + case 136: 1.9194 + count = stream.readUI16(); 1.9195 + constantPool = []; 1.9196 + for (i = 0; i < count; i++) { 1.9197 + constantPool.push(stream.readString()); 1.9198 + } 1.9199 + break; 1.9200 + case 155: 1.9201 + functionName = stream.readString(); 1.9202 + count = stream.readUI16(); 1.9203 + args = []; 1.9204 + for (i = 0; i < count; i++) { 1.9205 + args.push(stream.readString()); 1.9206 + } 1.9207 + codeSize = stream.readUI16(); 1.9208 + nextPosition += codeSize; 1.9209 + fn = defineFunction(functionName, args, null, stream.readBytes(codeSize)); 1.9210 + if (functionName) { 1.9211 + scope.asSetPublicProperty(functionName, fn); 1.9212 + } else { 1.9213 + stack.push(fn); 1.9214 + } 1.9215 + break; 1.9216 + case 60: 1.9217 + value = stack.pop(); 1.9218 + name = stack.pop(); 1.9219 + scope.asSetPublicProperty(name, value); 1.9220 + break; 1.9221 + case 65: 1.9222 + name = stack.pop(); 1.9223 + scope.asSetPublicProperty(name, undefined); 1.9224 + break; 1.9225 + case 58: 1.9226 + name = stack.pop(); 1.9227 + obj = stack.pop(); 1.9228 + obj.asSetPublicProperty(name, undefined); 1.9229 + stack.push(obj.asDeleteProperty(undefined, name, 0)); 1.9230 + break; 1.9231 + case 59: 1.9232 + name = stack.pop(); 1.9233 + result = deleteProperty(name); 1.9234 + stack.push(result); 1.9235 + break; 1.9236 + case 70: 1.9237 + objectName = stack.pop(); 1.9238 + stack.push(null); 1.9239 + obj = getObjectByName(objectName); 1.9240 + forEachPublicProperty(obj, function (name) { 1.9241 + stack.push(name); 1.9242 + }); 1.9243 + break; 1.9244 + case 73: 1.9245 + a = stack.pop(); 1.9246 + b = stack.pop(); 1.9247 + stack.push(a == b); 1.9248 + break; 1.9249 + case 78: 1.9250 + name = stack.pop(); 1.9251 + obj = stack.pop(); 1.9252 + if (name === 'prototype') { 1.9253 + stack.push(as2CreatePrototypeProxy(obj)); 1.9254 + } else { 1.9255 + resolvedName = as2ResolveProperty(Object(obj), name); 1.9256 + stack.push(resolvedName === null ? undefined : obj.asGetPublicProperty(resolvedName)); 1.9257 + } 1.9258 + break; 1.9259 + case 66: 1.9260 + obj = readArgs(stack); 1.9261 + stack.push(obj); 1.9262 + break; 1.9263 + case 67: 1.9264 + count = +stack.pop(); 1.9265 + validateArgsCount(count, stack.length >> 1); 1.9266 + obj = {}; 1.9267 + for (i = 0; i < count; i++) { 1.9268 + value = stack.pop(); 1.9269 + name = stack.pop(); 1.9270 + obj.asSetPublicProperty(name, value); 1.9271 + } 1.9272 + stack.push(obj); 1.9273 + break; 1.9274 + case 83: 1.9275 + methodName = stack.pop(); 1.9276 + obj = stack.pop(); 1.9277 + args = readArgs(stack); 1.9278 + stackItemsExpected++; 1.9279 + if (methodName !== null && methodName !== undefined && methodName !== '') { 1.9280 + resolvedName = as2ResolveProperty(obj, methodName); 1.9281 + if (resolvedName === null) { 1.9282 + throw new Error('Method ' + methodName + ' is not defined.'); 1.9283 + } 1.9284 + if (obj === null || obj === undefined) { 1.9285 + throw new Error('Cannot call new using method ' + resolvedName + ' of ' + typeof obj); 1.9286 + } 1.9287 + method = obj.asGetPublicProperty(resolvedName); 1.9288 + } else { 1.9289 + if (obj === null || obj === undefined) { 1.9290 + throw new Error('Cannot call new using ' + typeof obj); 1.9291 + } 1.9292 + method = obj; 1.9293 + } 1.9294 + if (isAvm2Class(obj)) { 1.9295 + result = construct(obj, args); 1.9296 + } else { 1.9297 + result = Object.create(as2GetPrototype(method) || as2GetPrototype(Object)); 1.9298 + method.apply(result, args); 1.9299 + } 1.9300 + result.constructor = method; 1.9301 + stack.push(result); 1.9302 + break; 1.9303 + case 64: 1.9304 + objectName = stack.pop(); 1.9305 + obj = getObjectByName(objectName); 1.9306 + args = readArgs(stack); 1.9307 + stackItemsExpected++; 1.9308 + result = createBuiltinType(obj, args); 1.9309 + if (typeof result === 'undefined') { 1.9310 + if (isAvm2Class(obj)) { 1.9311 + result = construct(obj, args); 1.9312 + } else { 1.9313 + result = Object.create(as2GetPrototype(obj) || as2GetPrototype(Object)); 1.9314 + obj.apply(result, args); 1.9315 + } 1.9316 + result.constructor = obj; 1.9317 + } 1.9318 + stack.push(result); 1.9319 + break; 1.9320 + case 79: 1.9321 + value = stack.pop(); 1.9322 + name = stack.pop(); 1.9323 + obj = stack.pop(); 1.9324 + obj.asSetPublicProperty(name, value); 1.9325 + break; 1.9326 + case 69: 1.9327 + obj = stack.pop(); 1.9328 + stack.push(as2GetType(obj) === 'movieclip' ? obj._target : void 0); 1.9329 + break; 1.9330 + case 148: 1.9331 + codeSize = stream.readUI16(); 1.9332 + obj = stack.pop(); 1.9333 + nextPosition += codeSize; 1.9334 + processWith(obj, stream.readBytes(codeSize)); 1.9335 + break; 1.9336 + case 74: 1.9337 + stack.push(as2ToNumber(stack.pop())); 1.9338 + break; 1.9339 + case 75: 1.9340 + stack.push(as2ToString(stack.pop())); 1.9341 + break; 1.9342 + case 68: 1.9343 + obj = stack.pop(); 1.9344 + result = as2GetType(obj); 1.9345 + stack.push(result); 1.9346 + break; 1.9347 + case 71: 1.9348 + a = as2ToAddPrimitive(stack.pop()); 1.9349 + b = as2ToAddPrimitive(stack.pop()); 1.9350 + if (typeof a === 'string' || typeof b === 'string') { 1.9351 + stack.push(as2ToString(b) + as2ToString(a)); 1.9352 + } else { 1.9353 + stack.push(as2ToNumber(b) + as2ToNumber(a)); 1.9354 + } 1.9355 + break; 1.9356 + case 72: 1.9357 + a = stack.pop(); 1.9358 + b = stack.pop(); 1.9359 + stack.push(as2Compare(b, a)); 1.9360 + break; 1.9361 + case 63: 1.9362 + a = as2ToNumber(stack.pop()); 1.9363 + b = as2ToNumber(stack.pop()); 1.9364 + stack.push(b % a); 1.9365 + break; 1.9366 + case 96: 1.9367 + a = as2ToInt32(stack.pop()); 1.9368 + b = as2ToInt32(stack.pop()); 1.9369 + stack.push(b & a); 1.9370 + break; 1.9371 + case 99: 1.9372 + a = as2ToInt32(stack.pop()); 1.9373 + b = as2ToInt32(stack.pop()); 1.9374 + stack.push(b << a); 1.9375 + break; 1.9376 + case 97: 1.9377 + a = as2ToInt32(stack.pop()); 1.9378 + b = as2ToInt32(stack.pop()); 1.9379 + stack.push(b | a); 1.9380 + break; 1.9381 + case 100: 1.9382 + a = as2ToInt32(stack.pop()); 1.9383 + b = as2ToInt32(stack.pop()); 1.9384 + stack.push(b >> a); 1.9385 + break; 1.9386 + case 101: 1.9387 + a = as2ToInt32(stack.pop()); 1.9388 + b = as2ToInt32(stack.pop()); 1.9389 + stack.push(b >>> a); 1.9390 + break; 1.9391 + case 98: 1.9392 + a = as2ToInt32(stack.pop()); 1.9393 + b = as2ToInt32(stack.pop()); 1.9394 + stack.push(b ^ a); 1.9395 + break; 1.9396 + case 81: 1.9397 + a = as2ToNumber(stack.pop()); 1.9398 + a--; 1.9399 + stack.push(a); 1.9400 + break; 1.9401 + case 80: 1.9402 + a = as2ToNumber(stack.pop()); 1.9403 + a++; 1.9404 + stack.push(a); 1.9405 + break; 1.9406 + case 76: 1.9407 + stack.push(stack[stack.length - 1]); 1.9408 + break; 1.9409 + case 62: 1.9410 + return stack.pop(); 1.9411 + case 77: 1.9412 + stack.push(stack.pop(), stack.pop()); 1.9413 + break; 1.9414 + case 135: 1.9415 + register = stream.readUI8(); 1.9416 + registers[register] = stack[stack.length - 1]; 1.9417 + break; 1.9418 + case 84: 1.9419 + constr = stack.pop(); 1.9420 + obj = stack.pop(); 1.9421 + stack.push(as2InstanceOf(Object(obj), constr)); 1.9422 + break; 1.9423 + case 85: 1.9424 + obj = stack.pop(); 1.9425 + stack.push(null); 1.9426 + forEachPublicProperty(obj, function (name) { 1.9427 + stack.push(name); 1.9428 + }); 1.9429 + break; 1.9430 + case 102: 1.9431 + a = stack.pop(); 1.9432 + b = stack.pop(); 1.9433 + stack.push(b === a); 1.9434 + break; 1.9435 + case 103: 1.9436 + a = stack.pop(); 1.9437 + b = stack.pop(); 1.9438 + stack.push(as2Compare(a, b)); 1.9439 + break; 1.9440 + case 104: 1.9441 + sa = as2ToString(stack.pop()); 1.9442 + sb = as2ToString(stack.pop()); 1.9443 + f = sb > sa; 1.9444 + stack.push(isSwfVersion5 ? f : f ? 1 : 0); 1.9445 + break; 1.9446 + case 142: 1.9447 + functionName = stream.readString(); 1.9448 + count = stream.readUI16(); 1.9449 + var registerCount = stream.readUI8(); 1.9450 + flags = stream.readUI16(); 1.9451 + var registerAllocation = []; 1.9452 + args = []; 1.9453 + for (i = 0; i < count; i++) { 1.9454 + register = stream.readUI8(); 1.9455 + paramName = stream.readString(); 1.9456 + args.push(paramName); 1.9457 + if (register) { 1.9458 + registerAllocation[register] = { 1.9459 + type: 'param', 1.9460 + name: paramName, 1.9461 + index: i 1.9462 + }; 1.9463 + } 1.9464 + } 1.9465 + codeSize = stream.readUI16(); 1.9466 + nextPosition += codeSize; 1.9467 + var j = 1; 1.9468 + if (flags & 1) { 1.9469 + registerAllocation[j++] = { 1.9470 + type: 'var', 1.9471 + name: 'this' 1.9472 + }; 1.9473 + } 1.9474 + if (flags & 4) { 1.9475 + registerAllocation[j++] = { 1.9476 + type: 'var', 1.9477 + name: 'arguments' 1.9478 + }; 1.9479 + } 1.9480 + if (flags & 16) { 1.9481 + registerAllocation[j++] = { 1.9482 + type: 'var', 1.9483 + name: 'super' 1.9484 + }; 1.9485 + } 1.9486 + if (flags & 64) { 1.9487 + registerAllocation[j++] = { 1.9488 + type: 'var', 1.9489 + name: '_root' 1.9490 + }; 1.9491 + } 1.9492 + if (flags & 128) { 1.9493 + registerAllocation[j++] = { 1.9494 + type: 'var', 1.9495 + name: '_parent' 1.9496 + }; 1.9497 + } 1.9498 + if (flags & 256) { 1.9499 + registerAllocation[j++] = { 1.9500 + type: 'var', 1.9501 + name: '_global' 1.9502 + }; 1.9503 + } 1.9504 + fn = defineFunction(functionName, args, registerAllocation, stream.readBytes(codeSize)); 1.9505 + if (functionName) { 1.9506 + scope.asSetPublicProperty(functionName, fn); 1.9507 + } else { 1.9508 + stack.push(fn); 1.9509 + } 1.9510 + break; 1.9511 + case 105: 1.9512 + var constrSuper = stack.pop(); 1.9513 + constr = stack.pop(); 1.9514 + obj = Object.create(constrSuper.traitsPrototype || as2GetPrototype(constrSuper), { 1.9515 + constructor: { 1.9516 + value: constr, 1.9517 + enumerable: false 1.9518 + } 1.9519 + }); 1.9520 + constr.__super = constrSuper; 1.9521 + constr.prototype = obj; 1.9522 + break; 1.9523 + case 43: 1.9524 + obj = stack.pop(); 1.9525 + constr = stack.pop(); 1.9526 + stack.push(as2InstanceOf(obj, constr) ? obj : null); 1.9527 + break; 1.9528 + case 44: 1.9529 + constr = stack.pop(); 1.9530 + count = +stack.pop(); 1.9531 + validateArgsCount(count, stack.length); 1.9532 + var interfaces = []; 1.9533 + for (i = 0; i < count; i++) { 1.9534 + interfaces.push(stack.pop()); 1.9535 + } 1.9536 + constr.$interfaces = interfaces; 1.9537 + break; 1.9538 + case 143: 1.9539 + flags = stream.readUI8(); 1.9540 + var catchIsRegisterFlag = !(!(flags & 4)); 1.9541 + var finallyBlockFlag = !(!(flags & 2)); 1.9542 + var catchBlockFlag = !(!(flags & 1)); 1.9543 + var trySize = stream.readUI16(); 1.9544 + var catchSize = stream.readUI16(); 1.9545 + var finallySize = stream.readUI16(); 1.9546 + var catchTarget = catchIsRegisterFlag ? stream.readUI8() : stream.readString(); 1.9547 + nextPosition += trySize + catchSize + finallySize; 1.9548 + processTry(catchIsRegisterFlag, finallyBlockFlag, catchBlockFlag, catchTarget, stream.readBytes(trySize), stream.readBytes(catchSize), stream.readBytes(finallySize)); 1.9549 + break; 1.9550 + case 42: 1.9551 + obj = stack.pop(); 1.9552 + throw new AS2Error(obj); 1.9553 + case 45: 1.9554 + args = readArgs(stack); 1.9555 + stackItemsExpected++; 1.9556 + result = _global.fscommand.apply(null, args); 1.9557 + stack.push(result); 1.9558 + break; 1.9559 + case 137: 1.9560 + var mode = stream.readUI8(); 1.9561 + break; 1.9562 + case 0: 1.9563 + return; 1.9564 + default: 1.9565 + throw new Error('Unknown action code: ' + actionCode); 1.9566 + } 1.9567 + stream.position = nextPosition; 1.9568 + recoveringFromError = false; 1.9569 + } 1.9570 + } catch (e) { 1.9571 + if (!AVM1_ERRORS_IGNORED && !currentContext.isTryCatchListening || e instanceof AS2CriticalError) { 1.9572 + throw e; 1.9573 + } 1.9574 + if (e instanceof AS2Error) { 1.9575 + throw e; 1.9576 + } 1.9577 + var AVM1_ERROR_TYPE = 1; 1.9578 + TelemetryService.reportTelemetry({ 1.9579 + topic: 'error', 1.9580 + error: AVM1_ERROR_TYPE 1.9581 + }); 1.9582 + stream.position = nextPosition; 1.9583 + if (stackItemsExpected > 0) { 1.9584 + while (stackItemsExpected--) { 1.9585 + stack.push(undefined); 1.9586 + } 1.9587 + } 1.9588 + if (!recoveringFromError) { 1.9589 + if (currentContext.errorsIgnored++ >= MAX_AVM1_ERRORS_LIMIT) { 1.9590 + throw new AS2CriticalError('long running script -- AVM1 errors limit is reached'); 1.9591 + } 1.9592 + console.error('AVM1 error: ' + e); 1.9593 + avm2.exceptions.push({ 1.9594 + source: 'avm1', 1.9595 + message: e.message, 1.9596 + stack: e.stack 1.9597 + }); 1.9598 + recoveringFromError = true; 1.9599 + } 1.9600 + } 1.9601 + } 1.9602 +} 1.9603 +var ActionTracerFactory = function () { 1.9604 + var indentation = 0; 1.9605 + var tracer = { 1.9606 + print: function (position, actionCode, stack) { 1.9607 + var stackDump = []; 1.9608 + for (var q = 0; q < stack.length; q++) { 1.9609 + var item = stack[q]; 1.9610 + stackDump.push(item && typeof item === 'object' ? '[' + (item.constructor && item.constructor.name ? item.constructor.name : 'Object') + ']' : item); 1.9611 + } 1.9612 + var indent = new Array(indentation + 1).join('..'); 1.9613 + console.log('AVM1 trace: ' + indent + position + ': ' + ActionNamesMap[actionCode] + '(' + actionCode.toString(16) + '), ' + 'stack=' + stackDump); 1.9614 + }, 1.9615 + indent: function () { 1.9616 + indentation++; 1.9617 + }, 1.9618 + unindent: function () { 1.9619 + indentation--; 1.9620 + }, 1.9621 + message: function (str) { 1.9622 + console.log('AVM1 trace: ------- ' + str); 1.9623 + } 1.9624 + }; 1.9625 + var nullTracer = { 1.9626 + print: function () { 1.9627 + }, 1.9628 + indent: function () { 1.9629 + }, 1.9630 + unindent: function () { 1.9631 + }, 1.9632 + message: function () { 1.9633 + } 1.9634 + }; 1.9635 + function ActionTracerFactory() { 1.9636 + } 1.9637 + ActionTracerFactory.get = function () { 1.9638 + return AVM1_TRACE_ENABLED ? tracer : nullTracer; 1.9639 + }; 1.9640 + return ActionTracerFactory; 1.9641 + }(); 1.9642 +var ActionNamesMap = { 1.9643 + 0: 'EOA', 1.9644 + 4: 'ActionNextFrame', 1.9645 + 5: 'ActionPreviousFrame', 1.9646 + 6: 'ActionPlay', 1.9647 + 7: 'ActionStop', 1.9648 + 8: 'ActionToggleQuality', 1.9649 + 9: 'ActionStopSounds', 1.9650 + 10: 'ActionAdd', 1.9651 + 11: 'ActionSubtract', 1.9652 + 12: 'ActionMultiply', 1.9653 + 13: 'ActionDivide', 1.9654 + 14: 'ActionEquals', 1.9655 + 15: 'ActionLess', 1.9656 + 16: 'ActionAnd', 1.9657 + 17: 'ActionOr', 1.9658 + 18: 'ActionNot', 1.9659 + 19: 'ActionStringEquals', 1.9660 + 20: 'ActionStringLength', 1.9661 + 21: 'ActionStringExtract', 1.9662 + 23: 'ActionPop', 1.9663 + 24: 'ActionToInteger', 1.9664 + 28: 'ActionGetVariable', 1.9665 + 29: 'ActionSetVariable', 1.9666 + 32: 'ActionSetTarget2', 1.9667 + 33: 'ActionStringAdd', 1.9668 + 34: 'ActionGetProperty', 1.9669 + 35: 'ActionSetProperty', 1.9670 + 36: 'ActionCloneSprite', 1.9671 + 37: 'ActionRemoveSprite', 1.9672 + 38: 'ActionTrace', 1.9673 + 39: 'ActionStartDrag', 1.9674 + 40: 'ActionEndDrag', 1.9675 + 41: 'ActionStringLess', 1.9676 + 42: 'ActionThrow', 1.9677 + 43: 'ActionCastOp', 1.9678 + 44: 'ActionImplementsOp', 1.9679 + 45: 'ActionFSCommand2', 1.9680 + 48: 'ActionRandomNumber', 1.9681 + 49: 'ActionMBStringLength', 1.9682 + 50: 'ActionCharToAscii', 1.9683 + 51: 'ActionAsciiToChar', 1.9684 + 52: 'ActionGetTime', 1.9685 + 53: 'ActionMBStringExtrac', 1.9686 + 54: 'ActionMBCharToAscii', 1.9687 + 55: 'ActionMBAsciiToChar', 1.9688 + 58: 'ActionDelete', 1.9689 + 59: 'ActionDelete2', 1.9690 + 60: 'ActionDefineLocal', 1.9691 + 61: 'ActionCallFunction', 1.9692 + 62: 'ActionReturn', 1.9693 + 63: 'ActionModulo', 1.9694 + 64: 'ActionNewObject', 1.9695 + 65: 'ActionDefineLocal2', 1.9696 + 66: 'ActionInitArray', 1.9697 + 67: 'ActionInitObject', 1.9698 + 68: 'ActionTypeOf', 1.9699 + 69: 'ActionTargetPath', 1.9700 + 70: 'ActionEnumerate', 1.9701 + 71: 'ActionAdd2', 1.9702 + 72: 'ActionLess2', 1.9703 + 73: 'ActionEquals2', 1.9704 + 74: 'ActionToNumber', 1.9705 + 75: 'ActionToString', 1.9706 + 76: 'ActionPushDuplicate', 1.9707 + 77: 'ActionStackSwap', 1.9708 + 78: 'ActionGetMember', 1.9709 + 79: 'ActionSetMember', 1.9710 + 80: 'ActionIncrement', 1.9711 + 81: 'ActionDecrement', 1.9712 + 82: 'ActionCallMethod', 1.9713 + 83: 'ActionNewMethod', 1.9714 + 84: 'ActionInstanceOf', 1.9715 + 85: 'ActionEnumerate2', 1.9716 + 96: 'ActionBitAnd', 1.9717 + 97: 'ActionBitOr', 1.9718 + 98: 'ActionBitXor', 1.9719 + 99: 'ActionBitLShift', 1.9720 + 100: 'ActionBitRShift', 1.9721 + 101: 'ActionBitURShift', 1.9722 + 102: 'ActionStrictEquals', 1.9723 + 103: 'ActionGreater', 1.9724 + 104: 'ActionStringGreater', 1.9725 + 105: 'ActionExtends', 1.9726 + 129: 'ActionGotoFrame', 1.9727 + 131: 'ActionGetURL', 1.9728 + 135: 'ActionStoreRegister', 1.9729 + 136: 'ActionConstantPool', 1.9730 + 137: 'ActionStrictMode', 1.9731 + 138: 'ActionWaitForFrame', 1.9732 + 139: 'ActionSetTarget', 1.9733 + 140: 'ActionGoToLabel', 1.9734 + 141: 'ActionWaitForFrame2', 1.9735 + 142: 'ActionDefineFunction', 1.9736 + 143: 'ActionTry', 1.9737 + 148: 'ActionWith', 1.9738 + 150: 'ActionPush', 1.9739 + 153: 'ActionJump', 1.9740 + 154: 'ActionGetURL2', 1.9741 + 155: 'ActionDefineFunction', 1.9742 + 157: 'ActionIf', 1.9743 + 158: 'ActionCall', 1.9744 + 159: 'ActionGotoFrame2' 1.9745 + }; 1.9746 +if (typeof GLOBAL !== 'undefined') { 1.9747 + GLOBAL.createBuiltinType = createBuiltinType; 1.9748 + GLOBAL.executeActions = executeActions; 1.9749 + GLOBAL.AS2Context = AS2Context; 1.9750 +} 1.9751 +var jsGlobal = function () { 1.9752 + return this || (1, eval)('this'); 1.9753 + }(); 1.9754 +var inBrowser = typeof console != 'undefined'; 1.9755 +var release = true; 1.9756 +var debug = !true; 1.9757 +if (!jsGlobal.performance) { 1.9758 + jsGlobal.performance = {}; 1.9759 +} 1.9760 +if (!jsGlobal.performance.now) { 1.9761 + jsGlobal.performance.now = dateNow; 1.9762 +} 1.9763 +function log(message) { 1.9764 + var optionalParams = []; 1.9765 + for (var _i = 0; _i < arguments.length - 1; _i++) { 1.9766 + optionalParams[_i] = arguments[_i + 1]; 1.9767 + } 1.9768 + jsGlobal.print(message); 1.9769 +} 1.9770 +function warn(message) { 1.9771 + var optionalParams = []; 1.9772 + for (var _i = 0; _i < arguments.length - 1; _i++) { 1.9773 + optionalParams[_i] = arguments[_i + 1]; 1.9774 + } 1.9775 + if (inBrowser) { 1.9776 + console.warn(message); 1.9777 + } else { 1.9778 + jsGlobal.print(message); 1.9779 + } 1.9780 +} 1.9781 +var Shumway; 1.9782 +(function (Shumway) { 1.9783 + (function (CharacterCodes) { 1.9784 + CharacterCodes[CharacterCodes['_0'] = 48] = '_0'; 1.9785 + CharacterCodes[CharacterCodes['_1'] = 49] = '_1'; 1.9786 + CharacterCodes[CharacterCodes['_2'] = 50] = '_2'; 1.9787 + CharacterCodes[CharacterCodes['_3'] = 51] = '_3'; 1.9788 + CharacterCodes[CharacterCodes['_4'] = 52] = '_4'; 1.9789 + CharacterCodes[CharacterCodes['_5'] = 53] = '_5'; 1.9790 + CharacterCodes[CharacterCodes['_6'] = 54] = '_6'; 1.9791 + CharacterCodes[CharacterCodes['_7'] = 55] = '_7'; 1.9792 + CharacterCodes[CharacterCodes['_8'] = 56] = '_8'; 1.9793 + CharacterCodes[CharacterCodes['_9'] = 57] = '_9'; 1.9794 + }(Shumway.CharacterCodes || (Shumway.CharacterCodes = {}))); 1.9795 + var CharacterCodes = Shumway.CharacterCodes; 1.9796 + Shumway.UINT32_CHAR_BUFFER_LENGTH = 10; 1.9797 + Shumway.UINT32_MAX = 4294967295; 1.9798 + Shumway.UINT32_MAX_DIV_10 = 429496729; 1.9799 + Shumway.UINT32_MAX_MOD_10 = 5; 1.9800 + function isString(value) { 1.9801 + return typeof value === 'string'; 1.9802 + } 1.9803 + Shumway.isString = isString; 1.9804 + function isFunction(value) { 1.9805 + return typeof value === 'function'; 1.9806 + } 1.9807 + Shumway.isFunction = isFunction; 1.9808 + function isNumber(value) { 1.9809 + return typeof value === 'number'; 1.9810 + } 1.9811 + Shumway.isNumber = isNumber; 1.9812 + function isNumberOrString(value) { 1.9813 + return typeof value === 'number' || typeof value === 'string'; 1.9814 + } 1.9815 + Shumway.isNumberOrString = isNumberOrString; 1.9816 + function isObject(value) { 1.9817 + return typeof value === 'object' || typeof value === 'function'; 1.9818 + } 1.9819 + Shumway.isObject = isObject; 1.9820 + function toNumber(x) { 1.9821 + return +x; 1.9822 + } 1.9823 + Shumway.toNumber = toNumber; 1.9824 + function isNumericString(value) { 1.9825 + return String(Number(value)) === value; 1.9826 + } 1.9827 + Shumway.isNumericString = isNumericString; 1.9828 + function isNumeric(value) { 1.9829 + if (typeof value === 'number') { 1.9830 + return true; 1.9831 + } else if (typeof value === 'string') { 1.9832 + return isIndex(value) || isNumericString(value); 1.9833 + } else { 1.9834 + Debug.notImplemented(typeof value); 1.9835 + } 1.9836 + } 1.9837 + Shumway.isNumeric = isNumeric; 1.9838 + function isIndex(value) { 1.9839 + var index = 0; 1.9840 + if (typeof value === 'number') { 1.9841 + index = value | 0; 1.9842 + if (value === index && index >= 0) { 1.9843 + return true; 1.9844 + } 1.9845 + return value >>> 0 === value; 1.9846 + } 1.9847 + if (typeof value !== 'string') { 1.9848 + return false; 1.9849 + } 1.9850 + var length = value.length; 1.9851 + if (length === 0) { 1.9852 + return false; 1.9853 + } 1.9854 + if (value === '0') { 1.9855 + return true; 1.9856 + } 1.9857 + if (length > Shumway.UINT32_CHAR_BUFFER_LENGTH) { 1.9858 + return false; 1.9859 + } 1.9860 + var i = 0; 1.9861 + index = value.charCodeAt(i++) - 48; 1.9862 + if (index < 1 || index > 9) { 1.9863 + return false; 1.9864 + } 1.9865 + var oldIndex = 0; 1.9866 + var c = 0; 1.9867 + while (i < length) { 1.9868 + c = value.charCodeAt(i++) - 48; 1.9869 + if (c < 0 || c > 9) { 1.9870 + return false; 1.9871 + } 1.9872 + oldIndex = index; 1.9873 + index = 10 * index + c; 1.9874 + } 1.9875 + if (oldIndex < Shumway.UINT32_MAX_DIV_10 || oldIndex === Shumway.UINT32_MAX_DIV_10 && c <= Shumway.UINT32_MAX_MOD_10) { 1.9876 + return true; 1.9877 + } 1.9878 + return false; 1.9879 + } 1.9880 + Shumway.isIndex = isIndex; 1.9881 + function isNullOrUndefined(value) { 1.9882 + return value == undefined; 1.9883 + } 1.9884 + Shumway.isNullOrUndefined = isNullOrUndefined; 1.9885 + (function (Debug) { 1.9886 + function backtrace() { 1.9887 + try { 1.9888 + throw new Error(); 1.9889 + } catch (e) { 1.9890 + return e.stack ? e.stack.split('\n').slice(2).join('\n') : ''; 1.9891 + } 1.9892 + } 1.9893 + Debug.backtrace = backtrace; 1.9894 + function error(message) { 1.9895 + if (!inBrowser) { 1.9896 + warn(Debug.backtrace()); 1.9897 + } 1.9898 + throw new Error(message); 1.9899 + } 1.9900 + Debug.error = error; 1.9901 + function assert(condition) { 1.9902 + var args = []; 1.9903 + for (var _i = 0; _i < arguments.length - 1; _i++) { 1.9904 + args[_i] = arguments[_i + 1]; 1.9905 + } 1.9906 + if (condition === '') { 1.9907 + condition = true; 1.9908 + } 1.9909 + if (!condition) { 1.9910 + var message = Array.prototype.slice.call(arguments); 1.9911 + message.shift(); 1.9912 + Debug.error(message.join('')); 1.9913 + } 1.9914 + } 1.9915 + Debug.assert = assert; 1.9916 + function assertNotImplemented(condition, message) { 1.9917 + if (!condition) { 1.9918 + Debug.error('NotImplemented: ' + message); 1.9919 + } 1.9920 + } 1.9921 + Debug.assertNotImplemented = assertNotImplemented; 1.9922 + function warning(message) { 1.9923 + true; 1.9924 + } 1.9925 + Debug.warning = warning; 1.9926 + function notUsed(message) { 1.9927 + true; 1.9928 + } 1.9929 + Debug.notUsed = notUsed; 1.9930 + function notImplemented(message) { 1.9931 + true; 1.9932 + } 1.9933 + Debug.notImplemented = notImplemented; 1.9934 + function somewhatImplemented(message) { 1.9935 + Debug.warning('somewhatImplemented: ' + message); 1.9936 + } 1.9937 + Debug.somewhatImplemented = somewhatImplemented; 1.9938 + function unexpected(message) { 1.9939 + Debug.assert(false, 'Unexpected: ' + message); 1.9940 + } 1.9941 + Debug.unexpected = unexpected; 1.9942 + }(Shumway.Debug || (Shumway.Debug = {}))); 1.9943 + var Debug = Shumway.Debug; 1.9944 + function getTicks() { 1.9945 + return performance.now(); 1.9946 + } 1.9947 + Shumway.getTicks = getTicks; 1.9948 + (function (ArrayUtilities) { 1.9949 + function popManyInto(src, count, dst) { 1.9950 + true; 1.9951 + for (var i = count - 1; i >= 0; i--) { 1.9952 + dst[i] = src.pop(); 1.9953 + } 1.9954 + dst.length = count; 1.9955 + } 1.9956 + ArrayUtilities.popManyInto = popManyInto; 1.9957 + }(Shumway.ArrayUtilities || (Shumway.ArrayUtilities = {}))); 1.9958 + var ArrayUtilities = Shumway.ArrayUtilities; 1.9959 + (function (ObjectUtilities) { 1.9960 + function boxValue(value) { 1.9961 + if (Shumway.isNullOrUndefined(value) || Shumway.isObject(value)) { 1.9962 + return value; 1.9963 + } 1.9964 + return Object(value); 1.9965 + } 1.9966 + ObjectUtilities.boxValue = boxValue; 1.9967 + function toKeyValueArray(object) { 1.9968 + var hasOwnProperty = Object.prototype.hasOwnProperty; 1.9969 + var array = []; 1.9970 + for (var k in object) { 1.9971 + if (hasOwnProperty.call(object, k)) { 1.9972 + array.push([ 1.9973 + k, 1.9974 + object[k] 1.9975 + ]); 1.9976 + } 1.9977 + } 1.9978 + return array; 1.9979 + } 1.9980 + ObjectUtilities.toKeyValueArray = toKeyValueArray; 1.9981 + function hasOwnProperty(object, name) { 1.9982 + return Object.prototype.hasOwnProperty.call(object, name); 1.9983 + } 1.9984 + ObjectUtilities.hasOwnProperty = hasOwnProperty; 1.9985 + function createEmptyObject() { 1.9986 + return Object.create(null); 1.9987 + } 1.9988 + ObjectUtilities.createEmptyObject = createEmptyObject; 1.9989 + function createMap() { 1.9990 + return Object.create(null); 1.9991 + } 1.9992 + ObjectUtilities.createMap = createMap; 1.9993 + function createArrayMap() { 1.9994 + return []; 1.9995 + } 1.9996 + ObjectUtilities.createArrayMap = createArrayMap; 1.9997 + function defineReadOnlyProperty(object, name, value) { 1.9998 + Object.defineProperty(object, name, { 1.9999 + value: value, 1.10000 + writable: false, 1.10001 + configurable: true, 1.10002 + enumerable: false 1.10003 + }); 1.10004 + } 1.10005 + ObjectUtilities.defineReadOnlyProperty = defineReadOnlyProperty; 1.10006 + function getOwnPropertyDescriptors(object) { 1.10007 + var o = ObjectUtilities.createMap(); 1.10008 + var properties = Object.getOwnPropertyNames(object); 1.10009 + for (var i = 0; i < properties.length; i++) { 1.10010 + o[properties[i]] = Object.getOwnPropertyDescriptor(object, properties[i]); 1.10011 + } 1.10012 + return o; 1.10013 + } 1.10014 + ObjectUtilities.getOwnPropertyDescriptors = getOwnPropertyDescriptors; 1.10015 + function cloneObject(object) { 1.10016 + var clone = ObjectUtilities.createEmptyObject(); 1.10017 + for (var property in object) { 1.10018 + clone[property] = object[property]; 1.10019 + } 1.10020 + return clone; 1.10021 + } 1.10022 + ObjectUtilities.cloneObject = cloneObject; 1.10023 + function copyProperties(object, template) { 1.10024 + for (var property in template) { 1.10025 + object[property] = template[property]; 1.10026 + } 1.10027 + } 1.10028 + ObjectUtilities.copyProperties = copyProperties; 1.10029 + function getLatestGetterOrSetterPropertyDescriptor(object, name) { 1.10030 + var descriptor = {}; 1.10031 + while (object) { 1.10032 + var tmp = Object.getOwnPropertyDescriptor(object, name); 1.10033 + if (tmp) { 1.10034 + descriptor.get = descriptor.get || tmp.get; 1.10035 + descriptor.set = descriptor.set || tmp.set; 1.10036 + } 1.10037 + if (descriptor.get && descriptor.set) { 1.10038 + break; 1.10039 + } 1.10040 + object = Object.getPrototypeOf(object); 1.10041 + } 1.10042 + return descriptor; 1.10043 + } 1.10044 + ObjectUtilities.getLatestGetterOrSetterPropertyDescriptor = getLatestGetterOrSetterPropertyDescriptor; 1.10045 + function defineNonEnumerableGetterOrSetter(obj, name, value, isGetter) { 1.10046 + var descriptor = ObjectUtilities.getLatestGetterOrSetterPropertyDescriptor(obj, name); 1.10047 + descriptor.configurable = true; 1.10048 + descriptor.enumerable = false; 1.10049 + if (isGetter) { 1.10050 + descriptor.get = value; 1.10051 + } else { 1.10052 + descriptor.set = value; 1.10053 + } 1.10054 + Object.defineProperty(obj, name, descriptor); 1.10055 + } 1.10056 + ObjectUtilities.defineNonEnumerableGetterOrSetter = defineNonEnumerableGetterOrSetter; 1.10057 + function defineNonEnumerableGetter(obj, name, getter) { 1.10058 + Object.defineProperty(obj, name, { 1.10059 + get: getter, 1.10060 + configurable: true, 1.10061 + enumerable: false 1.10062 + }); 1.10063 + } 1.10064 + ObjectUtilities.defineNonEnumerableGetter = defineNonEnumerableGetter; 1.10065 + function defineNonEnumerableSetter(obj, name, setter) { 1.10066 + Object.defineProperty(obj, name, { 1.10067 + set: setter, 1.10068 + configurable: true, 1.10069 + enumerable: false 1.10070 + }); 1.10071 + } 1.10072 + ObjectUtilities.defineNonEnumerableSetter = defineNonEnumerableSetter; 1.10073 + function defineNonEnumerableProperty(obj, name, value) { 1.10074 + Object.defineProperty(obj, name, { 1.10075 + value: value, 1.10076 + writable: true, 1.10077 + configurable: true, 1.10078 + enumerable: false 1.10079 + }); 1.10080 + } 1.10081 + ObjectUtilities.defineNonEnumerableProperty = defineNonEnumerableProperty; 1.10082 + function defineNonEnumerableForwardingProperty(obj, name, otherName) { 1.10083 + Object.defineProperty(obj, name, { 1.10084 + get: FunctionUtilities.makeForwardingGetter(otherName), 1.10085 + set: FunctionUtilities.makeForwardingSetter(otherName), 1.10086 + writable: true, 1.10087 + configurable: true, 1.10088 + enumerable: false 1.10089 + }); 1.10090 + } 1.10091 + ObjectUtilities.defineNonEnumerableForwardingProperty = defineNonEnumerableForwardingProperty; 1.10092 + function defineNewNonEnumerableProperty(obj, name, value) { 1.10093 + true; 1.10094 + ObjectUtilities.defineNonEnumerableProperty(obj, name, value); 1.10095 + } 1.10096 + ObjectUtilities.defineNewNonEnumerableProperty = defineNewNonEnumerableProperty; 1.10097 + }(Shumway.ObjectUtilities || (Shumway.ObjectUtilities = {}))); 1.10098 + var ObjectUtilities = Shumway.ObjectUtilities; 1.10099 + (function (FunctionUtilities) { 1.10100 + function makeForwardingGetter(target) { 1.10101 + return new Function('return this["' + target + '"]'); 1.10102 + } 1.10103 + FunctionUtilities.makeForwardingGetter = makeForwardingGetter; 1.10104 + function makeForwardingSetter(target) { 1.10105 + return new Function('value', 'this["' + target + '"] = value;'); 1.10106 + } 1.10107 + FunctionUtilities.makeForwardingSetter = makeForwardingSetter; 1.10108 + function bindSafely(fn, object) { 1.10109 + true; 1.10110 + var f = fn.bind(object); 1.10111 + f.boundTo = object; 1.10112 + return f; 1.10113 + } 1.10114 + FunctionUtilities.bindSafely = bindSafely; 1.10115 + }(Shumway.FunctionUtilities || (Shumway.FunctionUtilities = {}))); 1.10116 + var FunctionUtilities = Shumway.FunctionUtilities; 1.10117 + (function (StringUtilities) { 1.10118 + function toSafeString(value) { 1.10119 + if (typeof value === 'string') { 1.10120 + return '"' + value + '"'; 1.10121 + } 1.10122 + if (typeof value === 'number' || typeof value === 'boolean') { 1.10123 + return String(value); 1.10124 + } 1.10125 + return typeof value; 1.10126 + } 1.10127 + StringUtilities.toSafeString = toSafeString; 1.10128 + function toSafeArrayString(array) { 1.10129 + var str = []; 1.10130 + for (var i = 0; i < array.length; i++) { 1.10131 + str.push(toSafeString(array[i])); 1.10132 + } 1.10133 + return str.join(', '); 1.10134 + } 1.10135 + StringUtilities.toSafeArrayString = toSafeArrayString; 1.10136 + function utf8decode(str) { 1.10137 + var bytes = new Uint8Array(str.length * 4); 1.10138 + var b = 0; 1.10139 + for (var i = 0, j = str.length; i < j; i++) { 1.10140 + var code = str.charCodeAt(i); 1.10141 + if (code <= 127) { 1.10142 + bytes[b++] = code; 1.10143 + continue; 1.10144 + } 1.10145 + if (55296 <= code && code <= 56319) { 1.10146 + var codeLow = str.charCodeAt(i + 1); 1.10147 + if (56320 <= codeLow && codeLow <= 57343) { 1.10148 + code = ((code & 1023) << 10) + (codeLow & 1023) + 65536; 1.10149 + ++i; 1.10150 + } 1.10151 + } 1.10152 + if ((code & 4292870144) !== 0) { 1.10153 + bytes[b++] = 248 | code >>> 24 & 3; 1.10154 + bytes[b++] = 128 | code >>> 18 & 63; 1.10155 + bytes[b++] = 128 | code >>> 12 & 63; 1.10156 + bytes[b++] = 128 | code >>> 6 & 63; 1.10157 + bytes[b++] = 128 | code & 63; 1.10158 + } else if ((code & 4294901760) !== 0) { 1.10159 + bytes[b++] = 240 | code >>> 18 & 7; 1.10160 + bytes[b++] = 128 | code >>> 12 & 63; 1.10161 + bytes[b++] = 128 | code >>> 6 & 63; 1.10162 + bytes[b++] = 128 | code & 63; 1.10163 + } else if ((code & 4294965248) !== 0) { 1.10164 + bytes[b++] = 224 | code >>> 12 & 15; 1.10165 + bytes[b++] = 128 | code >>> 6 & 63; 1.10166 + bytes[b++] = 128 | code & 63; 1.10167 + } else { 1.10168 + bytes[b++] = 192 | code >>> 6 & 31; 1.10169 + bytes[b++] = 128 | code & 63; 1.10170 + } 1.10171 + } 1.10172 + return bytes.subarray(0, b); 1.10173 + } 1.10174 + StringUtilities.utf8decode = utf8decode; 1.10175 + function utf8encode(bytes) { 1.10176 + var j = 0, str = ''; 1.10177 + while (j < bytes.length) { 1.10178 + var b1 = bytes[j++] & 255; 1.10179 + if (b1 <= 127) { 1.10180 + str += String.fromCharCode(b1); 1.10181 + } else { 1.10182 + var currentPrefix = 192; 1.10183 + var validBits = 5; 1.10184 + do { 1.10185 + var mask = currentPrefix >> 1 | 128; 1.10186 + if ((b1 & mask) === currentPrefix) 1.10187 + break; 1.10188 + currentPrefix = currentPrefix >> 1 | 128; 1.10189 + --validBits; 1.10190 + } while (validBits >= 0); 1.10191 + if (validBits <= 0) { 1.10192 + str += String.fromCharCode(b1); 1.10193 + continue; 1.10194 + } 1.10195 + var code = b1 & (1 << validBits) - 1; 1.10196 + var invalid = false; 1.10197 + for (var i = 5; i >= validBits; --i) { 1.10198 + var bi = bytes[j++]; 1.10199 + if ((bi & 192) != 128) { 1.10200 + invalid = true; 1.10201 + break; 1.10202 + } 1.10203 + code = code << 6 | bi & 63; 1.10204 + } 1.10205 + if (invalid) { 1.10206 + for (var k = j - (7 - i); k < j; ++k) { 1.10207 + str += String.fromCharCode(bytes[k] & 255); 1.10208 + } 1.10209 + continue; 1.10210 + } 1.10211 + if (code >= 65536) { 1.10212 + str += String.fromCharCode(code - 65536 >> 10 & 1023 | 55296, code & 1023 | 56320); 1.10213 + } else { 1.10214 + str += String.fromCharCode(code); 1.10215 + } 1.10216 + } 1.10217 + } 1.10218 + return str; 1.10219 + } 1.10220 + StringUtilities.utf8encode = utf8encode; 1.10221 + function base64ArrayBuffer(arrayBuffer) { 1.10222 + var base64 = ''; 1.10223 + var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; 1.10224 + var bytes = new Uint8Array(arrayBuffer); 1.10225 + var byteLength = bytes.byteLength; 1.10226 + var byteRemainder = byteLength % 3; 1.10227 + var mainLength = byteLength - byteRemainder; 1.10228 + var a, b, c, d; 1.10229 + var chunk; 1.10230 + for (var i = 0; i < mainLength; i = i + 3) { 1.10231 + chunk = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2]; 1.10232 + a = (chunk & 16515072) >> 18; 1.10233 + b = (chunk & 258048) >> 12; 1.10234 + c = (chunk & 4032) >> 6; 1.10235 + d = chunk & 63; 1.10236 + base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d]; 1.10237 + } 1.10238 + if (byteRemainder == 1) { 1.10239 + chunk = bytes[mainLength]; 1.10240 + a = (chunk & 252) >> 2; 1.10241 + b = (chunk & 3) << 4; 1.10242 + base64 += encodings[a] + encodings[b] + '=='; 1.10243 + } else if (byteRemainder == 2) { 1.10244 + chunk = bytes[mainLength] << 8 | bytes[mainLength + 1]; 1.10245 + a = (chunk & 64512) >> 10; 1.10246 + b = (chunk & 1008) >> 4; 1.10247 + c = (chunk & 15) << 2; 1.10248 + base64 += encodings[a] + encodings[b] + encodings[c] + '='; 1.10249 + } 1.10250 + return base64; 1.10251 + } 1.10252 + StringUtilities.base64ArrayBuffer = base64ArrayBuffer; 1.10253 + function escapeString(str) { 1.10254 + if (str !== undefined) { 1.10255 + str = str.replace(/[^\w$]/gi, '$'); 1.10256 + if (/^\d/.test(str)) { 1.10257 + str = '$' + str; 1.10258 + } 1.10259 + } 1.10260 + return str; 1.10261 + } 1.10262 + StringUtilities.escapeString = escapeString; 1.10263 + function fromCharCodeArray(buffer) { 1.10264 + var str = '', SLICE = 1024 * 16; 1.10265 + for (var i = 0; i < buffer.length; i += SLICE) { 1.10266 + var chunk = Math.min(buffer.length - i, SLICE); 1.10267 + str += String.fromCharCode.apply(null, buffer.subarray(i, i + chunk)); 1.10268 + } 1.10269 + return str; 1.10270 + } 1.10271 + StringUtilities.fromCharCodeArray = fromCharCodeArray; 1.10272 + var _encoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$_'; 1.10273 + function variableLengthEncodeInt32(n) { 1.10274 + var e = _encoding; 1.10275 + var bitCount = 32 - IntegerUtilities.leadingZeros(n); 1.10276 + var l = Math.ceil(bitCount / 6); 1.10277 + var s = e[l]; 1.10278 + for (var i = l - 1; i >= 0; i--) { 1.10279 + var offset = i * 6; 1.10280 + s += e[n >> offset & 63]; 1.10281 + } 1.10282 + true; 1.10283 + return s; 1.10284 + } 1.10285 + StringUtilities.variableLengthEncodeInt32 = variableLengthEncodeInt32; 1.10286 + function toEncoding(n) { 1.10287 + return _encoding[n]; 1.10288 + } 1.10289 + StringUtilities.toEncoding = toEncoding; 1.10290 + function fromEncoding(s) { 1.10291 + var c = s.charCodeAt(0); 1.10292 + var e = 0; 1.10293 + if (c >= 65 && c <= 90) { 1.10294 + return c - 65; 1.10295 + } else if (c >= 97 && c <= 122) { 1.10296 + return c - 71; 1.10297 + } else if (c >= 48 && c <= 57) { 1.10298 + return c + 4; 1.10299 + } else if (c === 36) { 1.10300 + return 62; 1.10301 + } else if (c === 95) { 1.10302 + return 63; 1.10303 + } 1.10304 + } 1.10305 + StringUtilities.fromEncoding = fromEncoding; 1.10306 + function variableLengthDecodeInt32(s) { 1.10307 + var l = StringUtilities.fromEncoding(s[0]); 1.10308 + var n = 0; 1.10309 + for (var i = 0; i < l; i++) { 1.10310 + var offset = (l - i - 1) * 6; 1.10311 + n |= StringUtilities.fromEncoding(s[1 + i]) << offset; 1.10312 + } 1.10313 + return n; 1.10314 + } 1.10315 + StringUtilities.variableLengthDecodeInt32 = variableLengthDecodeInt32; 1.10316 + }(Shumway.StringUtilities || (Shumway.StringUtilities = {}))); 1.10317 + var StringUtilities = Shumway.StringUtilities; 1.10318 + (function (HashUtilities) { 1.10319 + var _md5R = new Uint8Array([ 1.10320 + 7, 1.10321 + 12, 1.10322 + 17, 1.10323 + 22, 1.10324 + 7, 1.10325 + 12, 1.10326 + 17, 1.10327 + 22, 1.10328 + 7, 1.10329 + 12, 1.10330 + 17, 1.10331 + 22, 1.10332 + 7, 1.10333 + 12, 1.10334 + 17, 1.10335 + 22, 1.10336 + 5, 1.10337 + 9, 1.10338 + 14, 1.10339 + 20, 1.10340 + 5, 1.10341 + 9, 1.10342 + 14, 1.10343 + 20, 1.10344 + 5, 1.10345 + 9, 1.10346 + 14, 1.10347 + 20, 1.10348 + 5, 1.10349 + 9, 1.10350 + 14, 1.10351 + 20, 1.10352 + 4, 1.10353 + 11, 1.10354 + 16, 1.10355 + 23, 1.10356 + 4, 1.10357 + 11, 1.10358 + 16, 1.10359 + 23, 1.10360 + 4, 1.10361 + 11, 1.10362 + 16, 1.10363 + 23, 1.10364 + 4, 1.10365 + 11, 1.10366 + 16, 1.10367 + 23, 1.10368 + 6, 1.10369 + 10, 1.10370 + 15, 1.10371 + 21, 1.10372 + 6, 1.10373 + 10, 1.10374 + 15, 1.10375 + 21, 1.10376 + 6, 1.10377 + 10, 1.10378 + 15, 1.10379 + 21, 1.10380 + 6, 1.10381 + 10, 1.10382 + 15, 1.10383 + 21 1.10384 + ]); 1.10385 + var _md5K = new Int32Array([ 1.10386 + -680876936, 1.10387 + -389564586, 1.10388 + 606105819, 1.10389 + -1044525330, 1.10390 + -176418897, 1.10391 + 1200080426, 1.10392 + -1473231341, 1.10393 + -45705983, 1.10394 + 1770035416, 1.10395 + -1958414417, 1.10396 + -42063, 1.10397 + -1990404162, 1.10398 + 1804603682, 1.10399 + -40341101, 1.10400 + -1502002290, 1.10401 + 1236535329, 1.10402 + -165796510, 1.10403 + -1069501632, 1.10404 + 643717713, 1.10405 + -373897302, 1.10406 + -701558691, 1.10407 + 38016083, 1.10408 + -660478335, 1.10409 + -405537848, 1.10410 + 568446438, 1.10411 + -1019803690, 1.10412 + -187363961, 1.10413 + 1163531501, 1.10414 + -1444681467, 1.10415 + -51403784, 1.10416 + 1735328473, 1.10417 + -1926607734, 1.10418 + -378558, 1.10419 + -2022574463, 1.10420 + 1839030562, 1.10421 + -35309556, 1.10422 + -1530992060, 1.10423 + 1272893353, 1.10424 + -155497632, 1.10425 + -1094730640, 1.10426 + 681279174, 1.10427 + -358537222, 1.10428 + -722521979, 1.10429 + 76029189, 1.10430 + -640364487, 1.10431 + -421815835, 1.10432 + 530742520, 1.10433 + -995338651, 1.10434 + -198630844, 1.10435 + 1126891415, 1.10436 + -1416354905, 1.10437 + -57434055, 1.10438 + 1700485571, 1.10439 + -1894986606, 1.10440 + -1051523, 1.10441 + -2054922799, 1.10442 + 1873313359, 1.10443 + -30611744, 1.10444 + -1560198380, 1.10445 + 1309151649, 1.10446 + -145523070, 1.10447 + -1120210379, 1.10448 + 718787259, 1.10449 + -343485551 1.10450 + ]); 1.10451 + function hashBytesTo32BitsMD5(data, offset, length) { 1.10452 + var r = _md5R; 1.10453 + var k = _md5K; 1.10454 + var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878; 1.10455 + var paddedLength = length + 72 & ~63; 1.10456 + var padded = new Uint8Array(paddedLength); 1.10457 + var i, j, n; 1.10458 + for (i = 0; i < length; ++i) { 1.10459 + padded[i] = data[offset++]; 1.10460 + } 1.10461 + padded[i++] = 128; 1.10462 + n = paddedLength - 8; 1.10463 + while (i < n) { 1.10464 + padded[i++] = 0; 1.10465 + } 1.10466 + padded[i++] = length << 3 & 255; 1.10467 + padded[i++] = length >> 5 & 255; 1.10468 + padded[i++] = length >> 13 & 255; 1.10469 + padded[i++] = length >> 21 & 255; 1.10470 + padded[i++] = length >>> 29 & 255; 1.10471 + padded[i++] = 0; 1.10472 + padded[i++] = 0; 1.10473 + padded[i++] = 0; 1.10474 + var w = new Int32Array(16); 1.10475 + for (i = 0; i < paddedLength;) { 1.10476 + for (j = 0; j < 16; ++j, i += 4) { 1.10477 + w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24; 1.10478 + } 1.10479 + var a = h0, b = h1, c = h2, d = h3, f, g; 1.10480 + for (j = 0; j < 64; ++j) { 1.10481 + if (j < 16) { 1.10482 + f = b & c | ~b & d; 1.10483 + g = j; 1.10484 + } else if (j < 32) { 1.10485 + f = d & b | ~d & c; 1.10486 + g = 5 * j + 1 & 15; 1.10487 + } else if (j < 48) { 1.10488 + f = b ^ c ^ d; 1.10489 + g = 3 * j + 5 & 15; 1.10490 + } else { 1.10491 + f = c ^ (b | ~d); 1.10492 + g = 7 * j & 15; 1.10493 + } 1.10494 + var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j]; 1.10495 + d = c; 1.10496 + c = b; 1.10497 + b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0; 1.10498 + a = tmp; 1.10499 + } 1.10500 + h0 = h0 + a | 0; 1.10501 + h1 = h1 + b | 0; 1.10502 + h2 = h2 + c | 0; 1.10503 + h3 = h3 + d | 0; 1.10504 + } 1.10505 + return h0; 1.10506 + } 1.10507 + HashUtilities.hashBytesTo32BitsMD5 = hashBytesTo32BitsMD5; 1.10508 + function hashBytesTo32BitsAdler(data, offset, length) { 1.10509 + var a = 1; 1.10510 + var b = 0; 1.10511 + var end = offset + length; 1.10512 + for (var i = offset; i < end; ++i) { 1.10513 + a = (a + (data[i] & 255)) % 65521; 1.10514 + b = (b + a) % 65521; 1.10515 + } 1.10516 + return b << 16 | a; 1.10517 + } 1.10518 + HashUtilities.hashBytesTo32BitsAdler = hashBytesTo32BitsAdler; 1.10519 + }(Shumway.HashUtilities || (Shumway.HashUtilities = {}))); 1.10520 + var HashUtilities = Shumway.HashUtilities; 1.10521 + (function (IntegerUtilities) { 1.10522 + function bitCount(i) { 1.10523 + i = i - (i >> 1 & 1431655765); 1.10524 + i = (i & 858993459) + (i >> 2 & 858993459); 1.10525 + return (i + (i >> 4) & 252645135) * 16843009 >> 24; 1.10526 + } 1.10527 + IntegerUtilities.bitCount = bitCount; 1.10528 + function ones(i) { 1.10529 + i = i - (i >> 1 & 1431655765); 1.10530 + i = (i & 858993459) + (i >> 2 & 858993459); 1.10531 + return (i + (i >> 4) & 252645135) * 16843009 >> 24; 1.10532 + } 1.10533 + IntegerUtilities.ones = ones; 1.10534 + function leadingZeros(i) { 1.10535 + i |= i >> 1; 1.10536 + i |= i >> 2; 1.10537 + i |= i >> 4; 1.10538 + i |= i >> 8; 1.10539 + i |= i >> 16; 1.10540 + return 32 - IntegerUtilities.ones(i); 1.10541 + } 1.10542 + IntegerUtilities.leadingZeros = leadingZeros; 1.10543 + function trailingZeros(i) { 1.10544 + return IntegerUtilities.ones((i & -i) - 1); 1.10545 + } 1.10546 + IntegerUtilities.trailingZeros = trailingZeros; 1.10547 + function getFlags(i, flags) { 1.10548 + var str = ''; 1.10549 + for (var i = 0; i < flags.length; i++) { 1.10550 + if (i & 1 << i) { 1.10551 + str += flags[i] + ' '; 1.10552 + } 1.10553 + } 1.10554 + if (str.length === 0) { 1.10555 + return ''; 1.10556 + } 1.10557 + return str.trim(); 1.10558 + } 1.10559 + IntegerUtilities.getFlags = getFlags; 1.10560 + function isPowerOfTwo(x) { 1.10561 + return x && (x & x - 1) === 0; 1.10562 + } 1.10563 + IntegerUtilities.isPowerOfTwo = isPowerOfTwo; 1.10564 + }(Shumway.IntegerUtilities || (Shumway.IntegerUtilities = {}))); 1.10565 + var IntegerUtilities = Shumway.IntegerUtilities; 1.10566 + var IndentingWriter = function () { 1.10567 + function IndentingWriter(suppressOutput, outFn) { 1.10568 + if (typeof suppressOutput === 'undefined') { 1.10569 + suppressOutput = false; 1.10570 + } 1.10571 + this._tab = ' '; 1.10572 + this._padding = ''; 1.10573 + this._suppressOutput = suppressOutput; 1.10574 + this._out = outFn || IndentingWriter._consoleOutFn; 1.10575 + } 1.10576 + IndentingWriter.prototype.writeLn = function (str) { 1.10577 + if (!this._suppressOutput) { 1.10578 + this._out(this._padding + str); 1.10579 + } 1.10580 + }; 1.10581 + IndentingWriter.prototype.writeLns = function (str) { 1.10582 + var lines = str.split('\n'); 1.10583 + for (var i = 0; i < lines.length; i++) { 1.10584 + this.writeLn(lines[i]); 1.10585 + } 1.10586 + }; 1.10587 + IndentingWriter.prototype.debugLn = function (str) { 1.10588 + this.colorLn(IndentingWriter.PURPLE, str); 1.10589 + }; 1.10590 + IndentingWriter.prototype.yellowLn = function (str) { 1.10591 + this.colorLn(IndentingWriter.YELLOW, str); 1.10592 + }; 1.10593 + IndentingWriter.prototype.greenLn = function (str) { 1.10594 + this.colorLn(IndentingWriter.GREEN, str); 1.10595 + }; 1.10596 + IndentingWriter.prototype.redLn = function (str) { 1.10597 + this.colorLn(IndentingWriter.RED, str); 1.10598 + }; 1.10599 + IndentingWriter.prototype.colorLn = function (color, str) { 1.10600 + if (!this._suppressOutput) { 1.10601 + if (!inBrowser) { 1.10602 + this._out(this._padding + color + str + IndentingWriter.ENDC); 1.10603 + } else { 1.10604 + this._out(this._padding + str); 1.10605 + } 1.10606 + } 1.10607 + }; 1.10608 + IndentingWriter.prototype.enter = function (str) { 1.10609 + if (!this._suppressOutput) { 1.10610 + this._out(this._padding + str); 1.10611 + } 1.10612 + this.indent(); 1.10613 + }; 1.10614 + IndentingWriter.prototype.leaveAndEnter = function (str) { 1.10615 + this.leave(str); 1.10616 + this.indent(); 1.10617 + }; 1.10618 + IndentingWriter.prototype.leave = function (str) { 1.10619 + this.outdent(); 1.10620 + if (!this._suppressOutput) { 1.10621 + this._out(this._padding + str); 1.10622 + } 1.10623 + }; 1.10624 + IndentingWriter.prototype.indent = function () { 1.10625 + this._padding += this._tab; 1.10626 + }; 1.10627 + IndentingWriter.prototype.outdent = function () { 1.10628 + if (this._padding.length > 0) { 1.10629 + this._padding = this._padding.substring(0, this._padding.length - this._tab.length); 1.10630 + } 1.10631 + }; 1.10632 + IndentingWriter.prototype.writeArray = function (arr, detailed, noNumbers) { 1.10633 + if (typeof detailed === 'undefined') { 1.10634 + detailed = false; 1.10635 + } 1.10636 + if (typeof noNumbers === 'undefined') { 1.10637 + noNumbers = false; 1.10638 + } 1.10639 + detailed = detailed || false; 1.10640 + for (var i = 0, j = arr.length; i < j; i++) { 1.10641 + var prefix = ''; 1.10642 + if (detailed) { 1.10643 + if (arr[i] === null) { 1.10644 + prefix = 'null'; 1.10645 + } else if (arr[i] === undefined) { 1.10646 + prefix = 'undefined'; 1.10647 + } else { 1.10648 + prefix = arr[i].constructor.name; 1.10649 + } 1.10650 + prefix += ' '; 1.10651 + } 1.10652 + var number = noNumbers ? '' : ('' + i).padRight(' ', 4); 1.10653 + this.writeLn(number + prefix + arr[i]); 1.10654 + } 1.10655 + }; 1.10656 + IndentingWriter.PURPLE = '\x1b[94m'; 1.10657 + IndentingWriter.YELLOW = '\x1b[93m'; 1.10658 + IndentingWriter.GREEN = '\x1b[92m'; 1.10659 + IndentingWriter.RED = '\x1b[91m'; 1.10660 + IndentingWriter.ENDC = '\x1b[0m'; 1.10661 + IndentingWriter._consoleOutFn = inBrowser ? console.info.bind(console) : print; 1.10662 + return IndentingWriter; 1.10663 + }(); 1.10664 + Shumway.IndentingWriter = IndentingWriter; 1.10665 + var SortedListNode = function () { 1.10666 + function SortedListNode(value, next) { 1.10667 + this.value = value; 1.10668 + this.next = next; 1.10669 + } 1.10670 + return SortedListNode; 1.10671 + }(); 1.10672 + var SortedList = function () { 1.10673 + function SortedList(compare) { 1.10674 + true; 1.10675 + this._compare = compare; 1.10676 + this._head = null; 1.10677 + this._length = 0; 1.10678 + } 1.10679 + SortedList.prototype.push = function (value) { 1.10680 + true; 1.10681 + this._length++; 1.10682 + if (!this._head) { 1.10683 + this._head = new SortedListNode(value, null); 1.10684 + return; 1.10685 + } 1.10686 + var curr = this._head; 1.10687 + var prev = null; 1.10688 + var node = new SortedListNode(value, null); 1.10689 + var compare = this._compare; 1.10690 + while (curr) { 1.10691 + if (compare(curr.value, node.value) > 0) { 1.10692 + if (prev) { 1.10693 + node.next = curr; 1.10694 + prev.next = node; 1.10695 + } else { 1.10696 + node.next = this._head; 1.10697 + this._head = node; 1.10698 + } 1.10699 + return; 1.10700 + } 1.10701 + prev = curr; 1.10702 + curr = curr.next; 1.10703 + } 1.10704 + prev.next = node; 1.10705 + }; 1.10706 + SortedList.prototype.forEach = function (visitor) { 1.10707 + var curr = this._head; 1.10708 + var last = null; 1.10709 + while (curr) { 1.10710 + var result = visitor(curr.value); 1.10711 + if (result === SortedList.RETURN) { 1.10712 + return; 1.10713 + } else if (result === SortedList.DELETE) { 1.10714 + if (!last) { 1.10715 + curr = this._head = this._head.next; 1.10716 + } else { 1.10717 + curr = last.next = curr.next; 1.10718 + } 1.10719 + } else { 1.10720 + last = curr; 1.10721 + curr = curr.next; 1.10722 + } 1.10723 + } 1.10724 + }; 1.10725 + SortedList.prototype.isEmpty = function () { 1.10726 + return !this._head; 1.10727 + }; 1.10728 + SortedList.prototype.pop = function () { 1.10729 + if (!this._head) { 1.10730 + return undefined; 1.10731 + } 1.10732 + this._length--; 1.10733 + var ret = this._head; 1.10734 + this._head = this._head.next; 1.10735 + return ret.value; 1.10736 + }; 1.10737 + SortedList.prototype.contains = function (value) { 1.10738 + var curr = this._head; 1.10739 + while (curr) { 1.10740 + if (curr.value === value) { 1.10741 + return true; 1.10742 + } 1.10743 + curr = curr.next; 1.10744 + } 1.10745 + return false; 1.10746 + }; 1.10747 + SortedList.prototype.toString = function () { 1.10748 + var str = '['; 1.10749 + var curr = this._head; 1.10750 + while (curr) { 1.10751 + str += curr.value.toString(); 1.10752 + curr = curr.next; 1.10753 + if (curr) { 1.10754 + str += ','; 1.10755 + } 1.10756 + } 1.10757 + str += ']'; 1.10758 + return str; 1.10759 + }; 1.10760 + SortedList.RETURN = 1; 1.10761 + SortedList.DELETE = 2; 1.10762 + return SortedList; 1.10763 + }(); 1.10764 + Shumway.SortedList = SortedList; 1.10765 + var CIRCULAR_BUFFER_MASK = 4095; 1.10766 + var CIRCULAR_BUFFER_SIZE = 4096; 1.10767 + var CircularBuffer = function () { 1.10768 + function CircularBuffer(Type) { 1.10769 + this.index = 0; 1.10770 + this.start = 0; 1.10771 + this.array = new Type(CIRCULAR_BUFFER_SIZE); 1.10772 + } 1.10773 + CircularBuffer.prototype.get = function (i) { 1.10774 + return this.array[i]; 1.10775 + }; 1.10776 + CircularBuffer.prototype.forEachInReverse = function (visitor) { 1.10777 + if (this.isEmpty()) { 1.10778 + return; 1.10779 + } 1.10780 + var i = this.index === 0 ? CIRCULAR_BUFFER_SIZE - 1 : this.index - 1; 1.10781 + while (i !== this.start) { 1.10782 + if (visitor(this.array[i], i)) { 1.10783 + break; 1.10784 + } 1.10785 + i = i === 0 ? CIRCULAR_BUFFER_SIZE - 1 : i - 1; 1.10786 + } 1.10787 + }; 1.10788 + CircularBuffer.prototype.write = function (value) { 1.10789 + this.array[this.index] = value; 1.10790 + this.index = this.index + 1 & CIRCULAR_BUFFER_MASK; 1.10791 + if (this.index === this.start) { 1.10792 + this.start = this.start + 1 & CIRCULAR_BUFFER_MASK; 1.10793 + } 1.10794 + }; 1.10795 + CircularBuffer.prototype.isFull = function () { 1.10796 + return (this.index + 1 & CIRCULAR_BUFFER_MASK) === this.start; 1.10797 + }; 1.10798 + CircularBuffer.prototype.isEmpty = function () { 1.10799 + return this.index === this.start; 1.10800 + }; 1.10801 + return CircularBuffer; 1.10802 + }(); 1.10803 + Shumway.CircularBuffer = CircularBuffer; 1.10804 +}(Shumway || (Shumway = {}))); 1.10805 +var assert = Shumway.Debug.assert; 1.10806 +var IndentingWriter = Shumway.IndentingWriter; 1.10807 +var assert = Shumway.Debug.assert; 1.10808 +var $DEBUG; 1.10809 +var release = true; 1.10810 +var c4CoerceNonPrimitiveParameters = false; 1.10811 +var c4CoerceNonPrimitive = false; 1.10812 +var c4AsTypeLate = true; 1.10813 +var error = Shumway.Debug.error; 1.10814 +var assertNotImplemented = Shumway.Debug.assertNotImplemented; 1.10815 +var warning = Shumway.Debug.warning; 1.10816 +var notImplemented = Shumway.Debug.notImplemented; 1.10817 +var somewhatImplemented = Shumway.Debug.somewhatImplemented; 1.10818 +var unexpected = Shumway.Debug.unexpected; 1.10819 +var defineReadOnlyProperty = Shumway.ObjectUtilities.defineReadOnlyProperty; 1.10820 +var createEmptyObject = Shumway.ObjectUtilities.createEmptyObject; 1.10821 +var makeForwardingGetter = Shumway.FunctionUtilities.makeForwardingGetter; 1.10822 +var makeForwardingSetter = Shumway.FunctionUtilities.makeForwardingSetter; 1.10823 +var bindSafely = Shumway.FunctionUtilities.bindSafely; 1.10824 +var cloneObject = Shumway.ObjectUtilities.cloneObject; 1.10825 +var copyProperties = Shumway.ObjectUtilities.copyProperties; 1.10826 +var toSafeString = Shumway.StringUtilities.toSafeString; 1.10827 +var toSafeArrayString = Shumway.StringUtilities.toSafeArrayString; 1.10828 +var getLatestGetterOrSetterPropertyDescriptor = Shumway.ObjectUtilities.getLatestGetterOrSetterPropertyDescriptor; 1.10829 +var defineNonEnumerableGetterOrSetter = Shumway.ObjectUtilities.defineNonEnumerableGetterOrSetter; 1.10830 +var defineNonEnumerableGetter = Shumway.ObjectUtilities.defineNonEnumerableGetter; 1.10831 +var defineNonEnumerableSetter = Shumway.ObjectUtilities.defineNonEnumerableSetter; 1.10832 +var defineNonEnumerableProperty = Shumway.ObjectUtilities.defineNonEnumerableProperty; 1.10833 +var defineNonEnumerableForwardingProperty = Shumway.ObjectUtilities.defineNonEnumerableForwardingProperty; 1.10834 +var defineNewNonEnumerableProperty = Shumway.ObjectUtilities.defineNewNonEnumerableProperty; 1.10835 +var isNumeric = Shumway.isNumeric; 1.10836 +var isNullOrUndefined = Shumway.isNullOrUndefined; 1.10837 +var isPowerOfTwo = Shumway.IntegerUtilities.isPowerOfTwo; 1.10838 +function time(fn, count) { 1.10839 + var start = performance.now(); 1.10840 + for (var i = 0; i < count; i++) { 1.10841 + fn(); 1.10842 + } 1.10843 + var time = (performance.now() - start) / count; 1.10844 + console.info('Took: ' + time.toFixed(2) + 'ms.'); 1.10845 + return time; 1.10846 +} 1.10847 +function clamp(x, min, max) { 1.10848 + if (x < min) { 1.10849 + return min; 1.10850 + } else if (x > max) { 1.10851 + return max; 1.10852 + } 1.10853 + return x; 1.10854 +} 1.10855 +var fromCharCodeArray = Shumway.StringUtilities.fromCharCodeArray; 1.10856 +function hasOwnProperty(object, name) { 1.10857 + return Object.prototype.hasOwnProperty.call(object, name); 1.10858 +} 1.10859 +var toKeyValueArray = Shumway.ObjectUtilities.toKeyValueArray; 1.10860 +var boxValue = Shumway.ObjectUtilities.boxValue; 1.10861 +function isObject(value) { 1.10862 + return typeof value === 'object' || typeof value === 'function'; 1.10863 +} 1.10864 +function isString(value) { 1.10865 + return typeof value === 'string'; 1.10866 +} 1.10867 +function isFunction(value) { 1.10868 + return typeof value === 'function'; 1.10869 +} 1.10870 +function isNumber(value) { 1.10871 + return typeof value === 'number'; 1.10872 +} 1.10873 +function toNumber(x) { 1.10874 + return +x; 1.10875 +} 1.10876 +function setBitFlags(flags, flag, value) { 1.10877 + return value ? flags | flag : flags & ~flag; 1.10878 +} 1.10879 +function getBitFlags(flags, flag) { 1.10880 + return !(!(flags & flag)); 1.10881 +} 1.10882 +(function () { 1.10883 + function extendBuiltin(proto, prop, f) { 1.10884 + if (!proto[prop]) { 1.10885 + Object.defineProperty(proto, prop, { 1.10886 + value: f, 1.10887 + writable: true, 1.10888 + configurable: true, 1.10889 + enumerable: false 1.10890 + }); 1.10891 + } 1.10892 + } 1.10893 + var Sp = String.prototype; 1.10894 + function removeColors(s) { 1.10895 + return s.replace(/\033\[[0-9]*m/g, ''); 1.10896 + } 1.10897 + extendBuiltin(Sp, 'padRight', function (c, n) { 1.10898 + var str = this; 1.10899 + var length = removeColors(str).length; 1.10900 + if (!c || length >= n) { 1.10901 + return str; 1.10902 + } 1.10903 + var max = (n - length) / c.length; 1.10904 + for (var i = 0; i < max; i++) { 1.10905 + str += c; 1.10906 + } 1.10907 + return str; 1.10908 + }); 1.10909 + extendBuiltin(Sp, 'padLeft', function (c, n) { 1.10910 + var str = this; 1.10911 + var length = str.length; 1.10912 + if (!c || length >= n) { 1.10913 + return str; 1.10914 + } 1.10915 + var max = (n - length) / c.length; 1.10916 + for (var i = 0; i < max; i++) { 1.10917 + str = c + str; 1.10918 + } 1.10919 + return str; 1.10920 + }); 1.10921 + extendBuiltin(Sp, 'trim', function () { 1.10922 + return this.replace(/^\s+|\s+$/g, ''); 1.10923 + }); 1.10924 + extendBuiltin(Sp, 'endsWith', function (str) { 1.10925 + return this.indexOf(str, this.length - str.length) !== -1; 1.10926 + }); 1.10927 + var Ap = Array.prototype; 1.10928 + extendBuiltin(Ap, 'popMany', function (count) { 1.10929 + true; 1.10930 + var start = this.length - count; 1.10931 + var res = this.slice(start, this.length); 1.10932 + this.splice(start, count); 1.10933 + return res; 1.10934 + }); 1.10935 + extendBuiltin(Ap, 'pushMany', function (array) { 1.10936 + for (var i = 0; i < array.length; i++) { 1.10937 + this.push(array[i]); 1.10938 + } 1.10939 + }); 1.10940 + extendBuiltin(Ap, 'clone', function () { 1.10941 + return this.slice(0); 1.10942 + }); 1.10943 + extendBuiltin(Ap, 'first', function () { 1.10944 + true; 1.10945 + return this[0]; 1.10946 + }); 1.10947 + extendBuiltin(Ap, 'last', function () { 1.10948 + true; 1.10949 + return this[this.length - 1]; 1.10950 + }); 1.10951 + extendBuiltin(Ap, 'peek', function () { 1.10952 + true; 1.10953 + return this[this.length - 1]; 1.10954 + }); 1.10955 + extendBuiltin(Ap, 'empty', function () { 1.10956 + return this.length === 0; 1.10957 + }); 1.10958 + extendBuiltin(Ap, 'pushUnique', function (v) { 1.10959 + for (var i = 0, j = this.length; i < j; i++) { 1.10960 + if (this[i] === v) { 1.10961 + return; 1.10962 + } 1.10963 + } 1.10964 + this.push(v); 1.10965 + }); 1.10966 + var uniquesMap; 1.10967 + if (typeof Map !== 'undefined' && (uniquesMap = new Map()).clear) { 1.10968 + extendBuiltin(Ap, 'unique', function () { 1.10969 + var unique = []; 1.10970 + for (var i = 0; i < this.length; i++) { 1.10971 + if (uniquesMap.has(this[i])) { 1.10972 + continue; 1.10973 + } 1.10974 + unique.push(this[i]); 1.10975 + uniquesMap.set(this[i], true); 1.10976 + } 1.10977 + uniquesMap.clear(); 1.10978 + return unique; 1.10979 + }); 1.10980 + } else { 1.10981 + extendBuiltin(Ap, 'unique', function () { 1.10982 + var unique = []; 1.10983 + for (var i = 0; i < this.length; i++) { 1.10984 + unique.pushUnique(this[i]); 1.10985 + } 1.10986 + return unique; 1.10987 + }); 1.10988 + } 1.10989 + extendBuiltin(Ap, 'replace', function (x, y) { 1.10990 + if (x === y) { 1.10991 + return 0; 1.10992 + } 1.10993 + var count = 0; 1.10994 + for (var i = 0; i < this.length; i++) { 1.10995 + if (this[i] === x) { 1.10996 + this[i] = y; 1.10997 + count++; 1.10998 + } 1.10999 + } 1.11000 + return count; 1.11001 + }); 1.11002 + extendBuiltin(Ap, 'count', function (x) { 1.11003 + var count = 0; 1.11004 + for (var i = 0; i < this.length; i++) { 1.11005 + if (this[i] === x) { 1.11006 + count++; 1.11007 + } 1.11008 + } 1.11009 + return count; 1.11010 + }); 1.11011 + extendBuiltin(Ap, 'notEmpty', function () { 1.11012 + return this.length > 0; 1.11013 + }); 1.11014 + extendBuiltin(Ap, 'contains', function (val) { 1.11015 + return this.indexOf(val) >= 0; 1.11016 + }); 1.11017 + extendBuiltin(Ap, 'top', function () { 1.11018 + return this.length && this[this.length - 1]; 1.11019 + }); 1.11020 + extendBuiltin(Ap, 'mapWithIndex', function (fn) { 1.11021 + var arr = []; 1.11022 + for (var i = 0; i < this.length; i++) { 1.11023 + arr.push(fn(this[i], i)); 1.11024 + } 1.11025 + return arr; 1.11026 + }); 1.11027 +}()); 1.11028 +var utf8decode = Shumway.StringUtilities.utf8decode; 1.11029 +var utf8encode = Shumway.StringUtilities.utf8encode; 1.11030 +var escapeString = Shumway.StringUtilities.escapeString; 1.11031 +var bitCount = Shumway.IntegerUtilities.bitCount; 1.11032 +var ones = Shumway.IntegerUtilities.ones; 1.11033 +var leadingZeros = Shumway.IntegerUtilities.leadingZeros; 1.11034 +var trailingZeros = Shumway.IntegerUtilities.trailingZeros; 1.11035 +var getFlags = Shumway.IntegerUtilities.getFlags; 1.11036 +function BitSetFunctor(length) { 1.11037 + var ADDRESS_BITS_PER_WORD = 5; 1.11038 + var BITS_PER_WORD = 1 << ADDRESS_BITS_PER_WORD; 1.11039 + var BIT_INDEX_MASK = BITS_PER_WORD - 1; 1.11040 + var SIZE = length + (BITS_PER_WORD - 1) >> ADDRESS_BITS_PER_WORD << ADDRESS_BITS_PER_WORD; 1.11041 + function BitSet() { 1.11042 + this.count = 0; 1.11043 + this.dirty = 0; 1.11044 + this.size = SIZE; 1.11045 + this.bits = new Uint32Array(SIZE >> ADDRESS_BITS_PER_WORD); 1.11046 + } 1.11047 + function BitSetS() { 1.11048 + this.count = 0; 1.11049 + this.dirty = 0; 1.11050 + this.size = SIZE; 1.11051 + this.bits = 0; 1.11052 + } 1.11053 + var singleword = SIZE >> ADDRESS_BITS_PER_WORD === 1; 1.11054 + var Ctor = singleword ? BitSetS : BitSet; 1.11055 + Ctor.ADDRESS_BITS_PER_WORD = ADDRESS_BITS_PER_WORD; 1.11056 + Ctor.BITS_PER_WORD = BITS_PER_WORD; 1.11057 + Ctor.BIT_INDEX_MASK = BIT_INDEX_MASK; 1.11058 + Ctor.singleword = singleword; 1.11059 + BitSet.prototype = { 1.11060 + recount: function recount() { 1.11061 + if (!this.dirty) { 1.11062 + return; 1.11063 + } 1.11064 + var bits = this.bits; 1.11065 + var c = 0; 1.11066 + for (var i = 0, j = bits.length; i < j; i++) { 1.11067 + var v = bits[i]; 1.11068 + v = v - (v >> 1 & 1431655765); 1.11069 + v = (v & 858993459) + (v >> 2 & 858993459); 1.11070 + c += (v + (v >> 4) & 252645135) * 16843009 >> 24; 1.11071 + } 1.11072 + this.count = c; 1.11073 + this.dirty = 0; 1.11074 + }, 1.11075 + set: function set(i) { 1.11076 + var n = i >> ADDRESS_BITS_PER_WORD; 1.11077 + var old = this.bits[n]; 1.11078 + var b = old | 1 << (i & BIT_INDEX_MASK); 1.11079 + this.bits[n] = b; 1.11080 + this.dirty |= old ^ b; 1.11081 + }, 1.11082 + setAll: function setAll() { 1.11083 + var bits = this.bits; 1.11084 + for (var i = 0, j = bits.length; i < j; i++) { 1.11085 + bits[i] = 4294967295; 1.11086 + } 1.11087 + this.count = this.size; 1.11088 + this.dirty = 0; 1.11089 + }, 1.11090 + assign: function assign(set) { 1.11091 + this.count = set.count; 1.11092 + this.dirty = set.dirty; 1.11093 + this.size = set.size; 1.11094 + for (var i = 0, j = this.bits.length; i < j; i++) { 1.11095 + this.bits[i] = set.bits[i]; 1.11096 + } 1.11097 + }, 1.11098 + clear: function clear(i) { 1.11099 + var n = i >> ADDRESS_BITS_PER_WORD; 1.11100 + var old = this.bits[n]; 1.11101 + var b = old & ~(1 << (i & BIT_INDEX_MASK)); 1.11102 + this.bits[n] = b; 1.11103 + this.dirty |= old ^ b; 1.11104 + }, 1.11105 + get: function get(i) { 1.11106 + var word = this.bits[i >> ADDRESS_BITS_PER_WORD]; 1.11107 + return (word & 1 << (i & BIT_INDEX_MASK)) !== 0; 1.11108 + }, 1.11109 + clearAll: function clearAll() { 1.11110 + var bits = this.bits; 1.11111 + for (var i = 0, j = bits.length; i < j; i++) { 1.11112 + bits[i] = 0; 1.11113 + } 1.11114 + this.count = 0; 1.11115 + this.dirty = 0; 1.11116 + }, 1.11117 + _union: function _union(other) { 1.11118 + var dirty = this.dirty; 1.11119 + var bits = this.bits; 1.11120 + var otherBits = other.bits; 1.11121 + for (var i = 0, j = bits.length; i < j; i++) { 1.11122 + var old = bits[i]; 1.11123 + var b = old | otherBits[i]; 1.11124 + bits[i] = b; 1.11125 + dirty |= old ^ b; 1.11126 + } 1.11127 + this.dirty = dirty; 1.11128 + }, 1.11129 + intersect: function intersect(other) { 1.11130 + var dirty = this.dirty; 1.11131 + var bits = this.bits; 1.11132 + var otherBits = other.bits; 1.11133 + for (var i = 0, j = bits.length; i < j; i++) { 1.11134 + var old = bits[i]; 1.11135 + var b = old & otherBits[i]; 1.11136 + bits[i] = b; 1.11137 + dirty |= old ^ b; 1.11138 + } 1.11139 + this.dirty = dirty; 1.11140 + }, 1.11141 + subtract: function subtract(other) { 1.11142 + var dirty = this.dirty; 1.11143 + var bits = this.bits; 1.11144 + var otherBits = other.bits; 1.11145 + for (var i = 0, j = bits.length; i < j; i++) { 1.11146 + var old = bits[i]; 1.11147 + var b = old & ~otherBits[i]; 1.11148 + bits[i] = b; 1.11149 + dirty |= old ^ b; 1.11150 + } 1.11151 + this.dirty = dirty; 1.11152 + }, 1.11153 + negate: function negate() { 1.11154 + var dirty = this.dirty; 1.11155 + var bits = this.bits; 1.11156 + for (var i = 0, j = bits.length; i < j; i++) { 1.11157 + var old = bits[i]; 1.11158 + var b = ~old; 1.11159 + bits[i] = b; 1.11160 + dirty |= old ^ b; 1.11161 + } 1.11162 + this.dirty = dirty; 1.11163 + }, 1.11164 + forEach: function forEach(fn) { 1.11165 + true; 1.11166 + var bits = this.bits; 1.11167 + for (var i = 0, j = bits.length; i < j; i++) { 1.11168 + var word = bits[i]; 1.11169 + if (word) { 1.11170 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.11171 + if (word & 1 << k) { 1.11172 + fn(i * BITS_PER_WORD + k); 1.11173 + } 1.11174 + } 1.11175 + } 1.11176 + } 1.11177 + }, 1.11178 + toArray: function toArray() { 1.11179 + var set = []; 1.11180 + var bits = this.bits; 1.11181 + for (var i = 0, j = bits.length; i < j; i++) { 1.11182 + var word = bits[i]; 1.11183 + if (word) { 1.11184 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.11185 + if (word & 1 << k) { 1.11186 + set.push(i * BITS_PER_WORD + k); 1.11187 + } 1.11188 + } 1.11189 + } 1.11190 + } 1.11191 + return set; 1.11192 + }, 1.11193 + equals: function equals(other) { 1.11194 + if (this.size !== other.size) { 1.11195 + return false; 1.11196 + } 1.11197 + var bits = this.bits; 1.11198 + var otherBits = other.bits; 1.11199 + for (var i = 0, j = bits.length; i < j; i++) { 1.11200 + if (bits[i] !== otherBits[i]) { 1.11201 + return false; 1.11202 + } 1.11203 + } 1.11204 + return true; 1.11205 + }, 1.11206 + contains: function contains(other) { 1.11207 + if (this.size !== other.size) { 1.11208 + return false; 1.11209 + } 1.11210 + var bits = this.bits; 1.11211 + var otherBits = other.bits; 1.11212 + for (var i = 0, j = bits.length; i < j; i++) { 1.11213 + if ((bits[i] | otherBits[i]) !== bits[i]) { 1.11214 + return false; 1.11215 + } 1.11216 + } 1.11217 + return true; 1.11218 + }, 1.11219 + toBitString: function toBitString(on, off) { 1.11220 + on = on || '1'; 1.11221 + off = off || '0'; 1.11222 + var str = ''; 1.11223 + for (var i = 0; i < length; i++) { 1.11224 + str += this.get(i) ? on : off; 1.11225 + } 1.11226 + return str; 1.11227 + }, 1.11228 + length: length, 1.11229 + toString: function toString(names) { 1.11230 + var set = []; 1.11231 + for (var i = 0; i < length; i++) { 1.11232 + if (this.get(i)) { 1.11233 + set.push(names ? names[i] : i); 1.11234 + } 1.11235 + } 1.11236 + return set.join(', '); 1.11237 + }, 1.11238 + isEmpty: function isEmpty() { 1.11239 + this.recount(); 1.11240 + return this.count === 0; 1.11241 + }, 1.11242 + clone: function clone() { 1.11243 + var set = new BitSet(); 1.11244 + set._union(this); 1.11245 + return set; 1.11246 + } 1.11247 + }; 1.11248 + BitSetS.prototype = { 1.11249 + recount: function recount() { 1.11250 + if (!this.dirty) { 1.11251 + return; 1.11252 + } 1.11253 + var c = 0; 1.11254 + var v = this.bits; 1.11255 + v = v - (v >> 1 & 1431655765); 1.11256 + v = (v & 858993459) + (v >> 2 & 858993459); 1.11257 + c += (v + (v >> 4) & 252645135) * 16843009 >> 24; 1.11258 + this.count = c; 1.11259 + this.dirty = 0; 1.11260 + }, 1.11261 + set: function set(i) { 1.11262 + var old = this.bits; 1.11263 + var b = old | 1 << (i & BIT_INDEX_MASK); 1.11264 + this.bits = b; 1.11265 + this.dirty |= old ^ b; 1.11266 + }, 1.11267 + setAll: function setAll() { 1.11268 + this.bits = 4294967295; 1.11269 + this.count = this.size; 1.11270 + this.dirty = 0; 1.11271 + }, 1.11272 + assign: function assign(set) { 1.11273 + this.count = set.count; 1.11274 + this.dirty = set.dirty; 1.11275 + this.size = set.size; 1.11276 + this.bits = set.bits; 1.11277 + }, 1.11278 + clear: function clear(i) { 1.11279 + var old = this.bits; 1.11280 + var b = old & ~(1 << (i & BIT_INDEX_MASK)); 1.11281 + this.bits = b; 1.11282 + this.dirty |= old ^ b; 1.11283 + }, 1.11284 + get: function get(i) { 1.11285 + return (this.bits & 1 << (i & BIT_INDEX_MASK)) !== 0; 1.11286 + }, 1.11287 + clearAll: function clearAll() { 1.11288 + this.bits = 0; 1.11289 + this.count = 0; 1.11290 + this.dirty = 0; 1.11291 + }, 1.11292 + _union: function _union(other) { 1.11293 + var old = this.bits; 1.11294 + var b = old | other.bits; 1.11295 + this.bits = b; 1.11296 + this.dirty = old ^ b; 1.11297 + }, 1.11298 + intersect: function intersect(other) { 1.11299 + var old = this.bits; 1.11300 + var b = old & other.bits; 1.11301 + this.bits = b; 1.11302 + this.dirty = old ^ b; 1.11303 + }, 1.11304 + subtract: function subtract(other) { 1.11305 + var old = this.bits; 1.11306 + var b = old & ~other.bits; 1.11307 + this.bits = b; 1.11308 + this.dirty = old ^ b; 1.11309 + }, 1.11310 + negate: function negate() { 1.11311 + var old = this.bits; 1.11312 + var b = ~old; 1.11313 + this.bits = b; 1.11314 + this.dirty = old ^ b; 1.11315 + }, 1.11316 + forEach: function forEach(fn) { 1.11317 + true; 1.11318 + var word = this.bits; 1.11319 + if (word) { 1.11320 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.11321 + if (word & 1 << k) { 1.11322 + fn(k); 1.11323 + } 1.11324 + } 1.11325 + } 1.11326 + }, 1.11327 + toArray: function toArray() { 1.11328 + var set = []; 1.11329 + var word = this.bits; 1.11330 + if (word) { 1.11331 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.11332 + if (word & 1 << k) { 1.11333 + set.push(k); 1.11334 + } 1.11335 + } 1.11336 + } 1.11337 + return set; 1.11338 + }, 1.11339 + equals: function equals(other) { 1.11340 + return this.bits === other.bits; 1.11341 + }, 1.11342 + contains: function contains(other) { 1.11343 + var bits = this.bits; 1.11344 + return (bits | other.bits) === bits; 1.11345 + }, 1.11346 + isEmpty: function isEmpty() { 1.11347 + this.recount(); 1.11348 + return this.count === 0; 1.11349 + }, 1.11350 + clone: function clone() { 1.11351 + var set = new BitSetS(); 1.11352 + set._union(this); 1.11353 + return set; 1.11354 + }, 1.11355 + toBitString: BitSet.prototype.toBitString, 1.11356 + toString: BitSet.prototype.toString, 1.11357 + length: length 1.11358 + }; 1.11359 + return Ctor; 1.11360 +} 1.11361 +var Map = function () { 1.11362 + function map() { 1.11363 + this.elements = {}; 1.11364 + } 1.11365 + map.prototype.set = function set(k, v) { 1.11366 + this.elements[k] = v; 1.11367 + }; 1.11368 + map.prototype.get = function get(k) { 1.11369 + if (this.has(k)) { 1.11370 + return this.elements[k]; 1.11371 + } 1.11372 + return undefined; 1.11373 + }; 1.11374 + map.prototype.has = function has(k) { 1.11375 + return Object.prototype.hasOwnProperty.call(this.elements, k); 1.11376 + }; 1.11377 + map.prototype.remove = function remove(k) { 1.11378 + if (this.has(k)) { 1.11379 + delete this.elements[k]; 1.11380 + } 1.11381 + }; 1.11382 + return map; 1.11383 + }(); 1.11384 +(function checkWeakMap() { 1.11385 + if (typeof this.WeakMap === 'function') 1.11386 + return; 1.11387 + var id = 0; 1.11388 + function WeakMap() { 1.11389 + this.id = '$weakmap' + id++; 1.11390 + } 1.11391 + ; 1.11392 + WeakMap.prototype = { 1.11393 + has: function (obj) { 1.11394 + return obj.hasOwnProperty(this.id); 1.11395 + }, 1.11396 + get: function (obj, defaultValue) { 1.11397 + return obj.hasOwnProperty(this.id) ? obj[this.id] : defaultValue; 1.11398 + }, 1.11399 + set: function (obj, value) { 1.11400 + Object.defineProperty(obj, this.id, { 1.11401 + value: value, 1.11402 + enumerable: false, 1.11403 + configurable: true 1.11404 + }); 1.11405 + } 1.11406 + }; 1.11407 + this.WeakMap = WeakMap; 1.11408 +}()); 1.11409 +var Callback = function () { 1.11410 + function callback() { 1.11411 + this.queues = {}; 1.11412 + } 1.11413 + callback.prototype.register = function register(type, callback) { 1.11414 + var queue = this.queues[type]; 1.11415 + if (queue) { 1.11416 + if (queue.indexOf(callback) > -1) { 1.11417 + return; 1.11418 + } 1.11419 + } else { 1.11420 + queue = this.queues[type] = []; 1.11421 + } 1.11422 + queue.push(callback); 1.11423 + }; 1.11424 + callback.prototype.unregister = function unregister(type, callback) { 1.11425 + var queue = this.queues[type]; 1.11426 + if (!queue) { 1.11427 + return; 1.11428 + } 1.11429 + var i = queue.indexOf(callback); 1.11430 + if (i !== -1) { 1.11431 + queue.splice(i, 1); 1.11432 + } 1.11433 + if (queue.length === 0) { 1.11434 + this.queues[type] = null; 1.11435 + } 1.11436 + }; 1.11437 + callback.prototype.notify = function notify(type, args) { 1.11438 + var queue = this.queues[type]; 1.11439 + if (!queue) { 1.11440 + return; 1.11441 + } 1.11442 + queue = queue.slice(); 1.11443 + var args = sliceArguments(arguments, 0); 1.11444 + for (var i = 0; i < queue.length; i++) { 1.11445 + if (false) { 1.11446 + Counter.count('callback(' + type + ').notify'); 1.11447 + } 1.11448 + var callback = queue[i]; 1.11449 + callback.apply(null, args); 1.11450 + } 1.11451 + }; 1.11452 + callback.prototype.notify1 = function notify1(type, value) { 1.11453 + var queue = this.queues[type]; 1.11454 + if (!queue) { 1.11455 + return; 1.11456 + } 1.11457 + queue = queue.slice(); 1.11458 + for (var i = 0; i < queue.length; i++) { 1.11459 + if (false) { 1.11460 + Counter.count('callback(' + type + ').notify1'); 1.11461 + } 1.11462 + var callback = queue[i]; 1.11463 + callback(type, value); 1.11464 + } 1.11465 + }; 1.11466 + return callback; 1.11467 + }(); 1.11468 +function lazyClass(holder, name, initialize) { 1.11469 + Object.defineProperty(holder, name, { 1.11470 + get: function () { 1.11471 + var start = performance.now(); 1.11472 + var value = initialize(); 1.11473 + print('Initialized Class: ' + name + ' ' + (performance.now() - start).toFixed(4)); 1.11474 + Object.defineProperty(holder, name, { 1.11475 + value: value, 1.11476 + writable: true 1.11477 + }); 1.11478 + return value; 1.11479 + }, 1.11480 + configurable: true 1.11481 + }); 1.11482 +} 1.11483 +var hashBytesTo32BitsAdler = Shumway.HashUtilities.hashBytesTo32BitsAdler; 1.11484 +var hashBytesTo32BitsMD5 = Shumway.HashUtilities.hashBytesTo32BitsMD5; 1.11485 +var variableLengthEncodeInt32 = Shumway.StringUtilities.variableLengthEncodeInt32; 1.11486 +var fromEncoding = Shumway.StringUtilities.fromEncoding; 1.11487 +var variableLengthDecodeIdentifier = Shumway.StringUtilities.variableLengthDecodeInt32; 1.11488 +var toEncoding = Shumway.StringUtilities.toEncoding; 1.11489 +var Shumway; 1.11490 +(function (Shumway) { 1.11491 + (function (Options) { 1.11492 + var Argument = function () { 1.11493 + function Argument(shortName, longName, type, options) { 1.11494 + this.shortName = shortName; 1.11495 + this.longName = longName; 1.11496 + this.type = type; 1.11497 + options = options || {}; 1.11498 + this.positional = options.positional; 1.11499 + this.parseFn = options.parse; 1.11500 + this.value = options.defaultValue; 1.11501 + } 1.11502 + Argument.prototype.parse = function (value) { 1.11503 + if (this.type === 'boolean') { 1.11504 + true; 1.11505 + this.value = value; 1.11506 + } else if (this.type === 'number') { 1.11507 + true; 1.11508 + this.value = parseInt(value, 10); 1.11509 + } else { 1.11510 + this.value = value; 1.11511 + } 1.11512 + if (this.parseFn) { 1.11513 + this.parseFn(this.value); 1.11514 + } 1.11515 + }; 1.11516 + return Argument; 1.11517 + }(); 1.11518 + Options.Argument = Argument; 1.11519 + var ArgumentParser = function () { 1.11520 + function ArgumentParser() { 1.11521 + this.args = []; 1.11522 + } 1.11523 + ArgumentParser.prototype.addArgument = function (shortName, longName, type, options) { 1.11524 + var argument = new Argument(shortName, longName, type, options); 1.11525 + this.args.push(argument); 1.11526 + return argument; 1.11527 + }; 1.11528 + ArgumentParser.prototype.addBoundOption = function (option) { 1.11529 + var options = { 1.11530 + parse: function (x) { 1.11531 + option.value = x; 1.11532 + } 1.11533 + }; 1.11534 + this.args.push(new Argument(option.shortName, option.longName, option.type, options)); 1.11535 + }; 1.11536 + ArgumentParser.prototype.addBoundOptionSet = function (optionSet) { 1.11537 + var self = this; 1.11538 + optionSet.options.forEach(function (x) { 1.11539 + if (x instanceof OptionSet) { 1.11540 + self.addBoundOptionSet(x); 1.11541 + } else { 1.11542 + true; 1.11543 + self.addBoundOption(x); 1.11544 + } 1.11545 + }); 1.11546 + }; 1.11547 + ArgumentParser.prototype.getUsage = function () { 1.11548 + var str = ''; 1.11549 + this.args.forEach(function (x) { 1.11550 + if (!x.positional) { 1.11551 + str += '[-' + x.shortName + '|--' + x.longName + (x.type === 'boolean' ? '' : ' ' + x.type[0].toUpperCase()) + ']'; 1.11552 + } else { 1.11553 + str += x.longName; 1.11554 + } 1.11555 + str += ' '; 1.11556 + }); 1.11557 + return str; 1.11558 + }; 1.11559 + ArgumentParser.prototype.parse = function (args) { 1.11560 + var nonPositionalArgumentMap = {}; 1.11561 + var positionalArgumentList = []; 1.11562 + this.args.forEach(function (x) { 1.11563 + if (x.positional) { 1.11564 + positionalArgumentList.push(x); 1.11565 + } else { 1.11566 + nonPositionalArgumentMap['-' + x.shortName] = x; 1.11567 + nonPositionalArgumentMap['--' + x.longName] = x; 1.11568 + } 1.11569 + }); 1.11570 + var leftoverArguments = []; 1.11571 + while (args.length) { 1.11572 + var argString = args.shift(); 1.11573 + var argument = null, value = argString; 1.11574 + if (argString == '--') { 1.11575 + leftoverArguments = leftoverArguments.concat(args); 1.11576 + break; 1.11577 + } else if (argString.slice(0, 1) == '-' || argString.slice(0, 2) == '--') { 1.11578 + argument = nonPositionalArgumentMap[argString]; 1.11579 + true; 1.11580 + if (!argument) { 1.11581 + continue; 1.11582 + } 1.11583 + if (argument.type !== 'boolean') { 1.11584 + value = args.shift(); 1.11585 + true; 1.11586 + } else { 1.11587 + value = true; 1.11588 + } 1.11589 + } else if (positionalArgumentList.length) { 1.11590 + argument = positionalArgumentList.shift(); 1.11591 + } else { 1.11592 + leftoverArguments.push(value); 1.11593 + } 1.11594 + if (argument) { 1.11595 + argument.parse(value); 1.11596 + } 1.11597 + } 1.11598 + true; 1.11599 + return leftoverArguments; 1.11600 + }; 1.11601 + return ArgumentParser; 1.11602 + }(); 1.11603 + Options.ArgumentParser = ArgumentParser; 1.11604 + var OptionSet = function () { 1.11605 + function OptionSet(name) { 1.11606 + this.name = name; 1.11607 + this.options = []; 1.11608 + } 1.11609 + OptionSet.prototype.register = function (option) { 1.11610 + this.options.push(option); 1.11611 + return option; 1.11612 + }; 1.11613 + OptionSet.prototype.trace = function (writer) { 1.11614 + writer.enter(this.name + ' {'); 1.11615 + this.options.forEach(function (option) { 1.11616 + option.trace(writer); 1.11617 + }); 1.11618 + writer.leave('}'); 1.11619 + }; 1.11620 + return OptionSet; 1.11621 + }(); 1.11622 + Options.OptionSet = OptionSet; 1.11623 + var Option = function () { 1.11624 + function Option(shortName, longName, type, defaultValue, description) { 1.11625 + this.longName = longName; 1.11626 + this.shortName = shortName; 1.11627 + this.type = type; 1.11628 + this.defaultValue = defaultValue; 1.11629 + this.value = defaultValue; 1.11630 + this.description = description; 1.11631 + } 1.11632 + Option.prototype.parse = function (value) { 1.11633 + this.value = value; 1.11634 + }; 1.11635 + Option.prototype.trace = function (writer) { 1.11636 + writer.writeLn(('-' + this.shortName + '|--' + this.longName).padRight(' ', 30) + ' = ' + this.type + ' ' + this.value + ' [' + this.defaultValue + ']' + ' (' + this.description + ')'); 1.11637 + }; 1.11638 + return Option; 1.11639 + }(); 1.11640 + Options.Option = Option; 1.11641 + }(Shumway.Options || (Shumway.Options = {}))); 1.11642 + var Options = Shumway.Options; 1.11643 +}(Shumway || (Shumway = {}))); 1.11644 +if (typeof exports !== 'undefined') { 1.11645 + exports['Shumway'] = Shumway; 1.11646 +} 1.11647 +var ArgumentParser = Shumway.Options.ArgumentParser; 1.11648 +var Option = Shumway.Options.Option; 1.11649 +var OptionSet = Shumway.Options.OptionSet; 1.11650 +var ArgumentParser = Shumway.Options.ArgumentParser; 1.11651 +var Option = Shumway.Options.Option; 1.11652 +var OptionSet = Shumway.Options.OptionSet; 1.11653 +var Shumway; 1.11654 +(function (Shumway) { 1.11655 + (function (Metrics) { 1.11656 + var Timer = function () { 1.11657 + function Timer(parent, name) { 1.11658 + this._parent = parent; 1.11659 + this._timers = Shumway.ObjectUtilities.createMap(); 1.11660 + this._name = name; 1.11661 + this._begin = 0; 1.11662 + this._last = 0; 1.11663 + this._total = 0; 1.11664 + this._count = 0; 1.11665 + } 1.11666 + Timer.time = function (name, fn) { 1.11667 + Timer.start(name); 1.11668 + fn(); 1.11669 + Timer.stop(); 1.11670 + }; 1.11671 + Timer.start = function (name) { 1.11672 + Timer._top = Timer._top._timers[name] || (Timer._top._timers[name] = new Timer(Timer._top, name)); 1.11673 + Timer._top.start(); 1.11674 + var tmp = Timer._flat._timers[name] || (Timer._flat._timers[name] = new Timer(Timer._flat, name)); 1.11675 + tmp.start(); 1.11676 + Timer._flatStack.push(tmp); 1.11677 + }; 1.11678 + Timer.stop = function () { 1.11679 + Timer._top.stop(); 1.11680 + Timer._top = Timer._top._parent; 1.11681 + Timer._flatStack.pop().stop(); 1.11682 + }; 1.11683 + Timer.stopStart = function (name) { 1.11684 + Timer.stop(); 1.11685 + Timer.start(name); 1.11686 + }; 1.11687 + Timer.prototype.start = function () { 1.11688 + this._begin = Shumway.getTicks(); 1.11689 + }; 1.11690 + Timer.prototype.stop = function () { 1.11691 + this._last = Shumway.getTicks() - this._begin; 1.11692 + this._total += this._last; 1.11693 + this._count += 1; 1.11694 + }; 1.11695 + Timer.prototype.toJSON = function () { 1.11696 + return { 1.11697 + name: this._name, 1.11698 + total: this._total, 1.11699 + timers: this._timers 1.11700 + }; 1.11701 + }; 1.11702 + Timer.prototype.trace = function (writer) { 1.11703 + writer.enter(this._name + ': ' + this._total.toFixed(2) + ' ms' + ', count: ' + this._count + ', average: ' + (this._total / this._count).toFixed(2) + ' ms'); 1.11704 + for (var name in this._timers) { 1.11705 + this._timers[name].trace(writer); 1.11706 + } 1.11707 + writer.outdent(); 1.11708 + }; 1.11709 + Timer.trace = function (writer) { 1.11710 + Timer._base.trace(writer); 1.11711 + Timer._flat.trace(writer); 1.11712 + }; 1.11713 + Timer._base = new Timer(null, 'Total'); 1.11714 + Timer._top = Timer._base; 1.11715 + Timer._flat = new Timer(null, 'Flat'); 1.11716 + Timer._flatStack = []; 1.11717 + return Timer; 1.11718 + }(); 1.11719 + Metrics.Timer = Timer; 1.11720 + var Counter = function () { 1.11721 + function Counter(enabled) { 1.11722 + this._enabled = enabled; 1.11723 + this.clear(); 1.11724 + } 1.11725 + Counter.prototype.setEnabled = function (enabled) { 1.11726 + this._enabled = enabled; 1.11727 + }; 1.11728 + Counter.prototype.clear = function () { 1.11729 + this._counts = Shumway.ObjectUtilities.createMap(); 1.11730 + }; 1.11731 + Counter.prototype.toJSON = function () { 1.11732 + return { 1.11733 + counts: this._counts 1.11734 + }; 1.11735 + }; 1.11736 + Counter.prototype.count = function (name, increment) { 1.11737 + if (typeof increment === 'undefined') { 1.11738 + increment = 1; 1.11739 + } 1.11740 + if (!this._enabled) { 1.11741 + return; 1.11742 + } 1.11743 + if (this._counts[name] === undefined) { 1.11744 + this._counts[name] = 0; 1.11745 + } 1.11746 + this._counts[name] += increment; 1.11747 + return this._counts[name]; 1.11748 + }; 1.11749 + Counter.prototype.trace = function (writer) { 1.11750 + for (var name in this._counts) { 1.11751 + writer.writeLn(name + ': ' + this._counts[name]); 1.11752 + } 1.11753 + }; 1.11754 + Counter.prototype.traceSorted = function (writer) { 1.11755 + var pairs = []; 1.11756 + for (var name in this._counts) { 1.11757 + pairs.push([ 1.11758 + name, 1.11759 + this._counts[name] 1.11760 + ]); 1.11761 + } 1.11762 + pairs.sort(function (a, b) { 1.11763 + return b[1] - a[1]; 1.11764 + }); 1.11765 + pairs.forEach(function (pair) { 1.11766 + writer.writeLn(pair[0] + ': ' + pair[1]); 1.11767 + }); 1.11768 + }; 1.11769 + return Counter; 1.11770 + }(); 1.11771 + Metrics.Counter = Counter; 1.11772 + var Average = function () { 1.11773 + function Average(max) { 1.11774 + this._samples = new Float64Array(max); 1.11775 + this._count = 0; 1.11776 + this._index = 0; 1.11777 + } 1.11778 + Average.prototype.push = function (sample) { 1.11779 + if (this._count < this._samples.length) { 1.11780 + this._count++; 1.11781 + } 1.11782 + this._index++; 1.11783 + this._samples[this._index % this._samples.length] = sample; 1.11784 + }; 1.11785 + Average.prototype.average = function () { 1.11786 + var sum = 0; 1.11787 + for (var i = 0; i < this._count; i++) { 1.11788 + sum += this._samples[i]; 1.11789 + } 1.11790 + return sum / this._count; 1.11791 + }; 1.11792 + return Average; 1.11793 + }(); 1.11794 + Metrics.Average = Average; 1.11795 + }(Shumway.Metrics || (Shumway.Metrics = {}))); 1.11796 + var Metrics = Shumway.Metrics; 1.11797 +}(Shumway || (Shumway = {}))); 1.11798 +var Timer = Shumway.Metrics.Timer; 1.11799 +var Counter = new Shumway.Metrics.Counter(true); 1.11800 +var Timer = Shumway.Metrics.Timer; 1.11801 +var Counter = new Shumway.Metrics.Counter(true); 1.11802 +var FrameCounter = new Shumway.Metrics.Counter(true); 1.11803 +var systemOptions = new OptionSet('System Options'); 1.11804 +var disassemble = systemOptions.register(new Option('d', 'disassemble', 'boolean', false, 'disassemble')); 1.11805 +var traceLevel = systemOptions.register(new Option('t', 'traceLevel', 'number', 0, 'trace level')); 1.11806 +window.print = function (s) { 1.11807 + console.log(s); 1.11808 +}; 1.11809 +var CONSTANT_Undefined = 0; 1.11810 +var CONSTANT_Utf8 = 1; 1.11811 +var CONSTANT_Float = 2; 1.11812 +var CONSTANT_Int = 3; 1.11813 +var CONSTANT_UInt = 4; 1.11814 +var CONSTANT_PrivateNs = 5; 1.11815 +var CONSTANT_Double = 6; 1.11816 +var CONSTANT_QName = 7; 1.11817 +var CONSTANT_Namespace = 8; 1.11818 +var CONSTANT_Multiname = 9; 1.11819 +var CONSTANT_False = 10; 1.11820 +var CONSTANT_True = 11; 1.11821 +var CONSTANT_Null = 12; 1.11822 +var CONSTANT_QNameA = 13; 1.11823 +var CONSTANT_MultinameA = 14; 1.11824 +var CONSTANT_RTQName = 15; 1.11825 +var CONSTANT_RTQNameA = 16; 1.11826 +var CONSTANT_RTQNameL = 17; 1.11827 +var CONSTANT_RTQNameLA = 18; 1.11828 +var CONSTANT_NameL = 19; 1.11829 +var CONSTANT_NameLA = 20; 1.11830 +var CONSTANT_NamespaceSet = 21; 1.11831 +var CONSTANT_PackageNamespace = 22; 1.11832 +var CONSTANT_PackageInternalNs = 23; 1.11833 +var CONSTANT_ProtectedNamespace = 24; 1.11834 +var CONSTANT_ExplicitNamespace = 25; 1.11835 +var CONSTANT_StaticProtectedNs = 26; 1.11836 +var CONSTANT_MultinameL = 27; 1.11837 +var CONSTANT_MultinameLA = 28; 1.11838 +var CONSTANT_TypeName = 29; 1.11839 +var CONSTANT_ClassSealed = 1; 1.11840 +var CONSTANT_ClassFinal = 2; 1.11841 +var CONSTANT_ClassInterface = 4; 1.11842 +var CONSTANT_ClassProtectedNs = 8; 1.11843 +var TRAIT_Slot = 0; 1.11844 +var TRAIT_Method = 1; 1.11845 +var TRAIT_Getter = 2; 1.11846 +var TRAIT_Setter = 3; 1.11847 +var TRAIT_Class = 4; 1.11848 +var TRAIT_Function = 5; 1.11849 +var TRAIT_Const = 6; 1.11850 +var ATTR_Final = 1; 1.11851 +var ATTR_Override = 2; 1.11852 +var ATTR_Metadata = 4; 1.11853 +var SLOT_var = 0; 1.11854 +var SLOT_method = 1; 1.11855 +var SLOT_getter = 2; 1.11856 +var SLOT_setter = 3; 1.11857 +var SLOT_class = 4; 1.11858 +var SLOT_function = 6; 1.11859 +var METHOD_Arguments = 1; 1.11860 +var METHOD_Activation = 2; 1.11861 +var METHOD_Needrest = 4; 1.11862 +var METHOD_HasOptional = 8; 1.11863 +var METHOD_IgnoreRest = 16; 1.11864 +var METHOD_Native = 32; 1.11865 +var METHOD_Setsdxns = 64; 1.11866 +var METHOD_HasParamNames = 128; 1.11867 +var OP_bkpt = 1; 1.11868 +var OP_nop = 2; 1.11869 +var OP_throw = 3; 1.11870 +var OP_getsuper = 4; 1.11871 +var OP_setsuper = 5; 1.11872 +var OP_dxns = 6; 1.11873 +var OP_dxnslate = 7; 1.11874 +var OP_kill = 8; 1.11875 +var OP_label = 9; 1.11876 +var OP_lf32x4 = 10; 1.11877 +var OP_sf32x4 = 11; 1.11878 +var OP_ifnlt = 12; 1.11879 +var OP_ifnle = 13; 1.11880 +var OP_ifngt = 14; 1.11881 +var OP_ifnge = 15; 1.11882 +var OP_jump = 16; 1.11883 +var OP_iftrue = 17; 1.11884 +var OP_iffalse = 18; 1.11885 +var OP_ifeq = 19; 1.11886 +var OP_ifne = 20; 1.11887 +var OP_iflt = 21; 1.11888 +var OP_ifle = 22; 1.11889 +var OP_ifgt = 23; 1.11890 +var OP_ifge = 24; 1.11891 +var OP_ifstricteq = 25; 1.11892 +var OP_ifstrictne = 26; 1.11893 +var OP_lookupswitch = 27; 1.11894 +var OP_pushwith = 28; 1.11895 +var OP_popscope = 29; 1.11896 +var OP_nextname = 30; 1.11897 +var OP_hasnext = 31; 1.11898 +var OP_pushnull = 32; 1.11899 +var OP_pushundefined = 33; 1.11900 +var OP_pushfloat = 34; 1.11901 +var OP_nextvalue = 35; 1.11902 +var OP_pushbyte = 36; 1.11903 +var OP_pushshort = 37; 1.11904 +var OP_pushtrue = 38; 1.11905 +var OP_pushfalse = 39; 1.11906 +var OP_pushnan = 40; 1.11907 +var OP_pop = 41; 1.11908 +var OP_dup = 42; 1.11909 +var OP_swap = 43; 1.11910 +var OP_pushstring = 44; 1.11911 +var OP_pushint = 45; 1.11912 +var OP_pushuint = 46; 1.11913 +var OP_pushdouble = 47; 1.11914 +var OP_pushscope = 48; 1.11915 +var OP_pushnamespace = 49; 1.11916 +var OP_hasnext2 = 50; 1.11917 +var OP_li8 = 53; 1.11918 +var OP_li16 = 54; 1.11919 +var OP_li32 = 55; 1.11920 +var OP_lf32 = 56; 1.11921 +var OP_lf64 = 57; 1.11922 +var OP_si8 = 58; 1.11923 +var OP_si16 = 59; 1.11924 +var OP_si32 = 60; 1.11925 +var OP_sf32 = 61; 1.11926 +var OP_sf64 = 62; 1.11927 +var OP_newfunction = 64; 1.11928 +var OP_call = 65; 1.11929 +var OP_construct = 66; 1.11930 +var OP_callmethod = 67; 1.11931 +var OP_callstatic = 68; 1.11932 +var OP_callsuper = 69; 1.11933 +var OP_callproperty = 70; 1.11934 +var OP_returnvoid = 71; 1.11935 +var OP_returnvalue = 72; 1.11936 +var OP_constructsuper = 73; 1.11937 +var OP_constructprop = 74; 1.11938 +var OP_callsuperid = 75; 1.11939 +var OP_callproplex = 76; 1.11940 +var OP_callinterface = 77; 1.11941 +var OP_callsupervoid = 78; 1.11942 +var OP_callpropvoid = 79; 1.11943 +var OP_sxi1 = 80; 1.11944 +var OP_sxi8 = 81; 1.11945 +var OP_sxi16 = 82; 1.11946 +var OP_applytype = 83; 1.11947 +var OP_pushfloat4 = 84; 1.11948 +var OP_newobject = 85; 1.11949 +var OP_newarray = 86; 1.11950 +var OP_newactivation = 87; 1.11951 +var OP_newclass = 88; 1.11952 +var OP_getdescendants = 89; 1.11953 +var OP_newcatch = 90; 1.11954 +var OP_findpropstrict = 93; 1.11955 +var OP_findproperty = 94; 1.11956 +var OP_finddef = 95; 1.11957 +var OP_getlex = 96; 1.11958 +var OP_setproperty = 97; 1.11959 +var OP_getlocal = 98; 1.11960 +var OP_setlocal = 99; 1.11961 +var OP_getglobalscope = 100; 1.11962 +var OP_getscopeobject = 101; 1.11963 +var OP_getproperty = 102; 1.11964 +var OP_getouterscope = 103; 1.11965 +var OP_initproperty = 104; 1.11966 +var OP_setpropertylate = 105; 1.11967 +var OP_deleteproperty = 106; 1.11968 +var OP_deletepropertylate = 107; 1.11969 +var OP_getslot = 108; 1.11970 +var OP_setslot = 109; 1.11971 +var OP_getglobalslot = 110; 1.11972 +var OP_setglobalslot = 111; 1.11973 +var OP_convert_s = 112; 1.11974 +var OP_esc_xelem = 113; 1.11975 +var OP_esc_xattr = 114; 1.11976 +var OP_convert_i = 115; 1.11977 +var OP_convert_u = 116; 1.11978 +var OP_convert_d = 117; 1.11979 +var OP_convert_b = 118; 1.11980 +var OP_convert_o = 119; 1.11981 +var OP_checkfilter = 120; 1.11982 +var OP_convert_f = 121; 1.11983 +var OP_unplus = 122; 1.11984 +var OP_convert_f4 = 123; 1.11985 +var OP_coerce = 128; 1.11986 +var OP_coerce_b = 129; 1.11987 +var OP_coerce_a = 130; 1.11988 +var OP_coerce_i = 131; 1.11989 +var OP_coerce_d = 132; 1.11990 +var OP_coerce_s = 133; 1.11991 +var OP_astype = 134; 1.11992 +var OP_astypelate = 135; 1.11993 +var OP_coerce_u = 136; 1.11994 +var OP_coerce_o = 137; 1.11995 +var OP_negate = 144; 1.11996 +var OP_increment = 145; 1.11997 +var OP_inclocal = 146; 1.11998 +var OP_decrement = 147; 1.11999 +var OP_declocal = 148; 1.12000 +var OP_typeof = 149; 1.12001 +var OP_not = 150; 1.12002 +var OP_bitnot = 151; 1.12003 +var OP_add = 160; 1.12004 +var OP_subtract = 161; 1.12005 +var OP_multiply = 162; 1.12006 +var OP_divide = 163; 1.12007 +var OP_modulo = 164; 1.12008 +var OP_lshift = 165; 1.12009 +var OP_rshift = 166; 1.12010 +var OP_urshift = 167; 1.12011 +var OP_bitand = 168; 1.12012 +var OP_bitor = 169; 1.12013 +var OP_bitxor = 170; 1.12014 +var OP_equals = 171; 1.12015 +var OP_strictequals = 172; 1.12016 +var OP_lessthan = 173; 1.12017 +var OP_lessequals = 174; 1.12018 +var OP_greaterthan = 175; 1.12019 +var OP_greaterequals = 176; 1.12020 +var OP_instanceof = 177; 1.12021 +var OP_istype = 178; 1.12022 +var OP_istypelate = 179; 1.12023 +var OP_in = 180; 1.12024 +var OP_increment_i = 192; 1.12025 +var OP_decrement_i = 193; 1.12026 +var OP_inclocal_i = 194; 1.12027 +var OP_declocal_i = 195; 1.12028 +var OP_negate_i = 196; 1.12029 +var OP_add_i = 197; 1.12030 +var OP_subtract_i = 198; 1.12031 +var OP_multiply_i = 199; 1.12032 +var OP_getlocal0 = 208; 1.12033 +var OP_getlocal1 = 209; 1.12034 +var OP_getlocal2 = 210; 1.12035 +var OP_getlocal3 = 211; 1.12036 +var OP_setlocal0 = 212; 1.12037 +var OP_setlocal1 = 213; 1.12038 +var OP_setlocal2 = 214; 1.12039 +var OP_setlocal3 = 215; 1.12040 +var OP_invalid = 237; 1.12041 +var OP_debug = 239; 1.12042 +var OP_debugline = 240; 1.12043 +var OP_debugfile = 241; 1.12044 +var OP_bkptline = 242; 1.12045 +var OP_timestamp = 243; 1.12046 +var INT_MIN_VALUE = -2147483648; 1.12047 +var INT_MAX_VALUE = 2147483647; 1.12048 +var UINT_MIN_VALUE = 0; 1.12049 +var UINT_MAX_VALUE = 4294967295; 1.12050 +var SORT_CASEINSENSITIVE = 1; 1.12051 +var SORT_DESCENDING = 2; 1.12052 +var SORT_UNIQUESORT = 4; 1.12053 +var SORT_RETURNINDEXEDARRAY = 8; 1.12054 +var SORT_NUMERIC = 16; 1.12055 +var Shumway; 1.12056 +(function (Shumway) { 1.12057 + (function (AVM2) { 1.12058 + AVM2.Errors = { 1.12059 + CallOfNonFunctionError: { 1.12060 + code: 1006, 1.12061 + message: '%1 is not a function.' 1.12062 + }, 1.12063 + ConvertNullToObjectError: { 1.12064 + code: 1009, 1.12065 + message: 'Cannot access a property or method of a null object reference.' 1.12066 + }, 1.12067 + ConvertUndefinedToObjectError: { 1.12068 + code: 1010, 1.12069 + message: 'A term is undefined and has no properties.' 1.12070 + }, 1.12071 + ClassNotFoundError: { 1.12072 + code: 1014, 1.12073 + message: 'Class %1 could not be found.' 1.12074 + }, 1.12075 + CheckTypeFailedError: { 1.12076 + code: 1034, 1.12077 + message: 'Type Coercion failed: cannot convert %1 to %2.' 1.12078 + }, 1.12079 + WrongArgumentCountError: { 1.12080 + code: 1063, 1.12081 + message: 'Argument count mismatch on %1. Expected %2, got %3.' 1.12082 + }, 1.12083 + XMLMarkupMustBeWellFormed: { 1.12084 + code: 1088, 1.12085 + message: 'The markup in the document following the root element must be well-formed.' 1.12086 + }, 1.12087 + OutOfRangeError: { 1.12088 + code: 1125, 1.12089 + message: 'The index %1 is out of range %2.' 1.12090 + }, 1.12091 + VectorFixedError: { 1.12092 + code: 1126, 1.12093 + message: 'Cannot change the length of a fixed Vector.' 1.12094 + }, 1.12095 + InvalidParamError: { 1.12096 + code: 2004, 1.12097 + message: 'One of the parameters is invalid.' 1.12098 + }, 1.12099 + ParamRangeError: { 1.12100 + code: 2006, 1.12101 + message: 'The supplied index is out of bounds.' 1.12102 + }, 1.12103 + NullPointerError: { 1.12104 + code: 2007, 1.12105 + message: 'Parameter %1 must be non-null.' 1.12106 + }, 1.12107 + InvalidEnumError: { 1.12108 + code: 2008, 1.12109 + message: 'Parameter %1 must be one of the accepted values.' 1.12110 + }, 1.12111 + ArgumentError: { 1.12112 + code: 2015, 1.12113 + message: 'Invalid BitmapData.' 1.12114 + }, 1.12115 + CompressedDataError: { 1.12116 + code: 2058, 1.12117 + message: 'There was an error decompressing the data.' 1.12118 + }, 1.12119 + SocketConnectError: { 1.12120 + code: 2011, 1.12121 + message: 'Socket connection failed to %1:%2.' 1.12122 + }, 1.12123 + CantAddSelfError: { 1.12124 + code: 2024, 1.12125 + message: 'An object cannot be added as a child of itself.' 1.12126 + }, 1.12127 + NotAChildError: { 1.12128 + code: 2025, 1.12129 + message: 'The supplied DisplayObject must be a child of the caller.' 1.12130 + }, 1.12131 + ExternalInterfaceNotAvailableError: { 1.12132 + code: 2067, 1.12133 + message: 'The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime.' 1.12134 + } 1.12135 + }; 1.12136 + function getErrorMessage(index) { 1.12137 + if (!Shumway.AVM2.Runtime.debuggerMode.value) { 1.12138 + return 'Error #' + index; 1.12139 + } 1.12140 + for (var k in AVM2.Errors) { 1.12141 + if (AVM2.Errors[k].code == index) { 1.12142 + return 'Error #' + index + ': ' + AVM2.Errors[k].message; 1.12143 + } 1.12144 + } 1.12145 + return 'Error #' + index + ': (unknown)'; 1.12146 + } 1.12147 + AVM2.getErrorMessage = getErrorMessage; 1.12148 + function formatErrorMessage(error) { 1.12149 + var args = []; 1.12150 + for (var _i = 0; _i < arguments.length - 1; _i++) { 1.12151 + args[_i] = arguments[_i + 1]; 1.12152 + } 1.12153 + var message = error.message; 1.12154 + Array.prototype.slice.call(arguments, 1).forEach(function (x, i) { 1.12155 + message = message.replace('%' + (i + 1), x); 1.12156 + }); 1.12157 + return 'Error #' + error.code + ': ' + message; 1.12158 + } 1.12159 + AVM2.formatErrorMessage = formatErrorMessage; 1.12160 + function translateErrorMessage(error) { 1.12161 + if (error.type) { 1.12162 + switch (error.type) { 1.12163 + case 'undefined_method': 1.12164 + return formatErrorMessage(AVM2.Errors.CallOfNonFunctionError, 'value'); 1.12165 + default: 1.12166 + throw Shumway.Debug.notImplemented(error.type); 1.12167 + } 1.12168 + } else { 1.12169 + if (error.message.indexOf('is not a function') >= 0) { 1.12170 + return formatErrorMessage(AVM2.Errors.CallOfNonFunctionError, 'value'); 1.12171 + } 1.12172 + return error.message; 1.12173 + } 1.12174 + } 1.12175 + AVM2.translateErrorMessage = translateErrorMessage; 1.12176 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.12177 + var AVM2 = Shumway.AVM2; 1.12178 +}(Shumway || (Shumway = {}))); 1.12179 +var Errors = Shumway.AVM2.Errors; 1.12180 +var getErrorMessage = Shumway.AVM2.getErrorMessage; 1.12181 +var formatErrorMessage = Shumway.AVM2.formatErrorMessage; 1.12182 +var translateErrorMessage = Shumway.AVM2.translateErrorMessage; 1.12183 +var Errors = Shumway.AVM2.Errors; 1.12184 +var getErrorMessage = Shumway.AVM2.getErrorMessage; 1.12185 +var formatErrorMessage = Shumway.AVM2.formatErrorMessage; 1.12186 +var translateErrorMessage = Shumway.AVM2.translateErrorMessage; 1.12187 +var Shumway; 1.12188 +(function (Shumway) { 1.12189 + (function (AVM2) { 1.12190 + AVM2.opcodeTable = [ 1.12191 + null, 1.12192 + { 1.12193 + name: 'bkpt', 1.12194 + canThrow: false, 1.12195 + operands: [] 1.12196 + }, 1.12197 + { 1.12198 + name: 'nop', 1.12199 + canThrow: false, 1.12200 + operands: [] 1.12201 + }, 1.12202 + { 1.12203 + name: 'throw', 1.12204 + canThrow: true, 1.12205 + operands: [] 1.12206 + }, 1.12207 + { 1.12208 + name: 'getsuper', 1.12209 + canThrow: true, 1.12210 + operands: [ 1.12211 + { 1.12212 + name: 'index', 1.12213 + size: 'u30', 1.12214 + type: '' 1.12215 + } 1.12216 + ] 1.12217 + }, 1.12218 + { 1.12219 + name: 'setsuper', 1.12220 + canThrow: true, 1.12221 + operands: [ 1.12222 + { 1.12223 + name: 'index', 1.12224 + size: 'u30', 1.12225 + type: '' 1.12226 + } 1.12227 + ] 1.12228 + }, 1.12229 + { 1.12230 + name: 'dxns', 1.12231 + canThrow: true, 1.12232 + operands: [ 1.12233 + { 1.12234 + name: 'index', 1.12235 + size: 'u30', 1.12236 + type: '' 1.12237 + } 1.12238 + ] 1.12239 + }, 1.12240 + { 1.12241 + name: 'dxnslate', 1.12242 + canThrow: true, 1.12243 + operands: [] 1.12244 + }, 1.12245 + { 1.12246 + name: 'kill', 1.12247 + canThrow: false, 1.12248 + operands: [ 1.12249 + { 1.12250 + name: 'index', 1.12251 + size: 'u30', 1.12252 + type: '' 1.12253 + } 1.12254 + ] 1.12255 + }, 1.12256 + { 1.12257 + name: 'label', 1.12258 + canThrow: false, 1.12259 + operands: [] 1.12260 + }, 1.12261 + { 1.12262 + name: 'lf32x4', 1.12263 + canThrow: true, 1.12264 + operands: [] 1.12265 + }, 1.12266 + { 1.12267 + name: 'sf32x4', 1.12268 + canThrow: true, 1.12269 + operands: [] 1.12270 + }, 1.12271 + { 1.12272 + name: 'ifnlt', 1.12273 + canThrow: true, 1.12274 + operands: [ 1.12275 + { 1.12276 + name: 'offset', 1.12277 + size: 's24', 1.12278 + type: '' 1.12279 + } 1.12280 + ] 1.12281 + }, 1.12282 + { 1.12283 + name: 'ifnle', 1.12284 + canThrow: true, 1.12285 + operands: [ 1.12286 + { 1.12287 + name: 'offset', 1.12288 + size: 's24', 1.12289 + type: '' 1.12290 + } 1.12291 + ] 1.12292 + }, 1.12293 + { 1.12294 + name: 'ifngt', 1.12295 + canThrow: true, 1.12296 + operands: [ 1.12297 + { 1.12298 + name: 'offset', 1.12299 + size: 's24', 1.12300 + type: '' 1.12301 + } 1.12302 + ] 1.12303 + }, 1.12304 + { 1.12305 + name: 'ifnge', 1.12306 + canThrow: true, 1.12307 + operands: [ 1.12308 + { 1.12309 + name: 'offset', 1.12310 + size: 's24', 1.12311 + type: '' 1.12312 + } 1.12313 + ] 1.12314 + }, 1.12315 + { 1.12316 + name: 'jump', 1.12317 + canThrow: false, 1.12318 + operands: [ 1.12319 + { 1.12320 + name: 'offset', 1.12321 + size: 's24', 1.12322 + type: '' 1.12323 + } 1.12324 + ] 1.12325 + }, 1.12326 + { 1.12327 + name: 'iftrue', 1.12328 + canThrow: false, 1.12329 + operands: [ 1.12330 + { 1.12331 + name: 'offset', 1.12332 + size: 's24', 1.12333 + type: '' 1.12334 + } 1.12335 + ] 1.12336 + }, 1.12337 + { 1.12338 + name: 'iffalse', 1.12339 + canThrow: false, 1.12340 + operands: [ 1.12341 + { 1.12342 + name: 'offset', 1.12343 + size: 's24', 1.12344 + type: '' 1.12345 + } 1.12346 + ] 1.12347 + }, 1.12348 + { 1.12349 + name: 'ifeq', 1.12350 + canThrow: true, 1.12351 + operands: [ 1.12352 + { 1.12353 + name: 'offset', 1.12354 + size: 's24', 1.12355 + type: '' 1.12356 + } 1.12357 + ] 1.12358 + }, 1.12359 + { 1.12360 + name: 'ifne', 1.12361 + canThrow: true, 1.12362 + operands: [ 1.12363 + { 1.12364 + name: 'offset', 1.12365 + size: 's24', 1.12366 + type: '' 1.12367 + } 1.12368 + ] 1.12369 + }, 1.12370 + { 1.12371 + name: 'iflt', 1.12372 + canThrow: true, 1.12373 + operands: [ 1.12374 + { 1.12375 + name: 'offset', 1.12376 + size: 's24', 1.12377 + type: '' 1.12378 + } 1.12379 + ] 1.12380 + }, 1.12381 + { 1.12382 + name: 'ifle', 1.12383 + canThrow: true, 1.12384 + operands: [ 1.12385 + { 1.12386 + name: 'offset', 1.12387 + size: 's24', 1.12388 + type: '' 1.12389 + } 1.12390 + ] 1.12391 + }, 1.12392 + { 1.12393 + name: 'ifgt', 1.12394 + canThrow: true, 1.12395 + operands: [ 1.12396 + { 1.12397 + name: 'offset', 1.12398 + size: 's24', 1.12399 + type: '' 1.12400 + } 1.12401 + ] 1.12402 + }, 1.12403 + { 1.12404 + name: 'ifge', 1.12405 + canThrow: true, 1.12406 + operands: [ 1.12407 + { 1.12408 + name: 'offset', 1.12409 + size: 's24', 1.12410 + type: '' 1.12411 + } 1.12412 + ] 1.12413 + }, 1.12414 + { 1.12415 + name: 'ifstricteq', 1.12416 + canThrow: false, 1.12417 + operands: [ 1.12418 + { 1.12419 + name: 'offset', 1.12420 + size: 's24', 1.12421 + type: '' 1.12422 + } 1.12423 + ] 1.12424 + }, 1.12425 + { 1.12426 + name: 'ifstrictne', 1.12427 + canThrow: false, 1.12428 + operands: [ 1.12429 + { 1.12430 + name: 'offset', 1.12431 + size: 's24', 1.12432 + type: '' 1.12433 + } 1.12434 + ] 1.12435 + }, 1.12436 + { 1.12437 + name: 'lookupswitch', 1.12438 + canThrow: false, 1.12439 + operands: null 1.12440 + }, 1.12441 + { 1.12442 + name: 'pushwith', 1.12443 + canThrow: false, 1.12444 + operands: [] 1.12445 + }, 1.12446 + { 1.12447 + name: 'popscope', 1.12448 + canThrow: false, 1.12449 + operands: [] 1.12450 + }, 1.12451 + { 1.12452 + name: 'nextname', 1.12453 + canThrow: true, 1.12454 + operands: [] 1.12455 + }, 1.12456 + { 1.12457 + name: 'hasnext', 1.12458 + canThrow: true, 1.12459 + operands: [] 1.12460 + }, 1.12461 + { 1.12462 + name: 'pushnull', 1.12463 + canThrow: false, 1.12464 + operands: [] 1.12465 + }, 1.12466 + { 1.12467 + name: 'pushundefined', 1.12468 + canThrow: false, 1.12469 + operands: [] 1.12470 + }, 1.12471 + null, 1.12472 + { 1.12473 + name: 'nextvalue', 1.12474 + canThrow: true, 1.12475 + operands: [] 1.12476 + }, 1.12477 + { 1.12478 + name: 'pushbyte', 1.12479 + canThrow: false, 1.12480 + operands: [ 1.12481 + { 1.12482 + name: 'value', 1.12483 + size: 's08', 1.12484 + type: '' 1.12485 + } 1.12486 + ] 1.12487 + }, 1.12488 + { 1.12489 + name: 'pushshort', 1.12490 + canThrow: false, 1.12491 + operands: [ 1.12492 + { 1.12493 + name: 'value', 1.12494 + size: 's16', 1.12495 + type: '' 1.12496 + } 1.12497 + ] 1.12498 + }, 1.12499 + { 1.12500 + name: 'pushtrue', 1.12501 + canThrow: false, 1.12502 + operands: [] 1.12503 + }, 1.12504 + { 1.12505 + name: 'pushfalse', 1.12506 + canThrow: false, 1.12507 + operands: [] 1.12508 + }, 1.12509 + { 1.12510 + name: 'pushnan', 1.12511 + canThrow: false, 1.12512 + operands: [] 1.12513 + }, 1.12514 + { 1.12515 + name: 'pop', 1.12516 + canThrow: false, 1.12517 + operands: [] 1.12518 + }, 1.12519 + { 1.12520 + name: 'dup', 1.12521 + canThrow: false, 1.12522 + operands: [] 1.12523 + }, 1.12524 + { 1.12525 + name: 'swap', 1.12526 + canThrow: false, 1.12527 + operands: [] 1.12528 + }, 1.12529 + { 1.12530 + name: 'pushstring', 1.12531 + canThrow: false, 1.12532 + operands: [ 1.12533 + { 1.12534 + name: 'index', 1.12535 + size: 'u30', 1.12536 + type: 'S' 1.12537 + } 1.12538 + ] 1.12539 + }, 1.12540 + { 1.12541 + name: 'pushint', 1.12542 + canThrow: false, 1.12543 + operands: [ 1.12544 + { 1.12545 + name: 'index', 1.12546 + size: 'u30', 1.12547 + type: 'I' 1.12548 + } 1.12549 + ] 1.12550 + }, 1.12551 + { 1.12552 + name: 'pushuint', 1.12553 + canThrow: false, 1.12554 + operands: [ 1.12555 + { 1.12556 + name: 'index', 1.12557 + size: 'u30', 1.12558 + type: 'U' 1.12559 + } 1.12560 + ] 1.12561 + }, 1.12562 + { 1.12563 + name: 'pushdouble', 1.12564 + canThrow: false, 1.12565 + operands: [ 1.12566 + { 1.12567 + name: 'index', 1.12568 + size: 'u30', 1.12569 + type: 'D' 1.12570 + } 1.12571 + ] 1.12572 + }, 1.12573 + { 1.12574 + name: 'pushscope', 1.12575 + canThrow: false, 1.12576 + operands: [] 1.12577 + }, 1.12578 + { 1.12579 + name: 'pushnamespace', 1.12580 + canThrow: false, 1.12581 + operands: [ 1.12582 + { 1.12583 + name: 'index', 1.12584 + size: 'u30', 1.12585 + type: 'N' 1.12586 + } 1.12587 + ] 1.12588 + }, 1.12589 + { 1.12590 + name: 'hasnext2', 1.12591 + canThrow: true, 1.12592 + operands: [ 1.12593 + { 1.12594 + name: 'object', 1.12595 + size: 'u30', 1.12596 + type: '' 1.12597 + }, 1.12598 + { 1.12599 + name: 'index', 1.12600 + size: 'u30', 1.12601 + type: '' 1.12602 + } 1.12603 + ] 1.12604 + }, 1.12605 + { 1.12606 + name: 'lix8', 1.12607 + canThrow: true, 1.12608 + operands: null 1.12609 + }, 1.12610 + { 1.12611 + name: 'lix16', 1.12612 + canThrow: true, 1.12613 + operands: null 1.12614 + }, 1.12615 + { 1.12616 + name: 'li8', 1.12617 + canThrow: true, 1.12618 + operands: [] 1.12619 + }, 1.12620 + { 1.12621 + name: 'li16', 1.12622 + canThrow: true, 1.12623 + operands: [] 1.12624 + }, 1.12625 + { 1.12626 + name: 'li32', 1.12627 + canThrow: true, 1.12628 + operands: [] 1.12629 + }, 1.12630 + { 1.12631 + name: 'lf32', 1.12632 + canThrow: true, 1.12633 + operands: [] 1.12634 + }, 1.12635 + { 1.12636 + name: 'lf64', 1.12637 + canThrow: true, 1.12638 + operands: [] 1.12639 + }, 1.12640 + { 1.12641 + name: 'si8', 1.12642 + canThrow: true, 1.12643 + operands: [] 1.12644 + }, 1.12645 + { 1.12646 + name: 'si16', 1.12647 + canThrow: true, 1.12648 + operands: [] 1.12649 + }, 1.12650 + { 1.12651 + name: 'si32', 1.12652 + canThrow: true, 1.12653 + operands: [] 1.12654 + }, 1.12655 + { 1.12656 + name: 'sf32', 1.12657 + canThrow: true, 1.12658 + operands: [] 1.12659 + }, 1.12660 + { 1.12661 + name: 'sf64', 1.12662 + canThrow: true, 1.12663 + operands: [] 1.12664 + }, 1.12665 + null, 1.12666 + { 1.12667 + name: 'newfunction', 1.12668 + canThrow: true, 1.12669 + operands: [ 1.12670 + { 1.12671 + name: 'index', 1.12672 + size: 'u30', 1.12673 + type: 'MI' 1.12674 + } 1.12675 + ] 1.12676 + }, 1.12677 + { 1.12678 + name: 'call', 1.12679 + canThrow: true, 1.12680 + operands: [ 1.12681 + { 1.12682 + name: 'argCount', 1.12683 + size: 'u30', 1.12684 + type: '' 1.12685 + } 1.12686 + ] 1.12687 + }, 1.12688 + { 1.12689 + name: 'construct', 1.12690 + canThrow: true, 1.12691 + operands: [ 1.12692 + { 1.12693 + name: 'argCount', 1.12694 + size: 'u30', 1.12695 + type: '' 1.12696 + } 1.12697 + ] 1.12698 + }, 1.12699 + { 1.12700 + name: 'callmethod', 1.12701 + canThrow: true, 1.12702 + operands: [ 1.12703 + { 1.12704 + name: 'index', 1.12705 + size: 'u30', 1.12706 + type: '' 1.12707 + }, 1.12708 + { 1.12709 + name: 'argCount', 1.12710 + size: 'u30', 1.12711 + type: '' 1.12712 + } 1.12713 + ] 1.12714 + }, 1.12715 + { 1.12716 + name: 'callstatic', 1.12717 + canThrow: true, 1.12718 + operands: [ 1.12719 + { 1.12720 + name: 'index', 1.12721 + size: 'u30', 1.12722 + type: 'MI' 1.12723 + }, 1.12724 + { 1.12725 + name: 'argCount', 1.12726 + size: 'u30', 1.12727 + type: '' 1.12728 + } 1.12729 + ] 1.12730 + }, 1.12731 + { 1.12732 + name: 'callsuper', 1.12733 + canThrow: true, 1.12734 + operands: [ 1.12735 + { 1.12736 + name: 'index', 1.12737 + size: 'u30', 1.12738 + type: 'M' 1.12739 + }, 1.12740 + { 1.12741 + name: 'argCount', 1.12742 + size: 'u30', 1.12743 + type: '' 1.12744 + } 1.12745 + ] 1.12746 + }, 1.12747 + { 1.12748 + name: 'callproperty', 1.12749 + canThrow: true, 1.12750 + operands: [ 1.12751 + { 1.12752 + name: 'index', 1.12753 + size: 'u30', 1.12754 + type: 'M' 1.12755 + }, 1.12756 + { 1.12757 + name: 'argCount', 1.12758 + size: 'u30', 1.12759 + type: '' 1.12760 + } 1.12761 + ] 1.12762 + }, 1.12763 + { 1.12764 + name: 'returnvoid', 1.12765 + canThrow: false, 1.12766 + operands: [] 1.12767 + }, 1.12768 + { 1.12769 + name: 'returnvalue', 1.12770 + canThrow: true, 1.12771 + operands: [] 1.12772 + }, 1.12773 + { 1.12774 + name: 'constructsuper', 1.12775 + canThrow: true, 1.12776 + operands: [ 1.12777 + { 1.12778 + name: 'argCount', 1.12779 + size: 'u30', 1.12780 + type: '' 1.12781 + } 1.12782 + ] 1.12783 + }, 1.12784 + { 1.12785 + name: 'constructprop', 1.12786 + canThrow: true, 1.12787 + operands: [ 1.12788 + { 1.12789 + name: 'index', 1.12790 + size: 'u30', 1.12791 + type: 'M' 1.12792 + }, 1.12793 + { 1.12794 + name: 'argCount', 1.12795 + size: 'u30', 1.12796 + type: '' 1.12797 + } 1.12798 + ] 1.12799 + }, 1.12800 + { 1.12801 + name: 'callsuperid', 1.12802 + canThrow: true, 1.12803 + operands: null 1.12804 + }, 1.12805 + { 1.12806 + name: 'callproplex', 1.12807 + canThrow: true, 1.12808 + operands: [ 1.12809 + { 1.12810 + name: 'index', 1.12811 + size: 'u30', 1.12812 + type: 'M' 1.12813 + }, 1.12814 + { 1.12815 + name: 'argCount', 1.12816 + size: 'u30', 1.12817 + type: '' 1.12818 + } 1.12819 + ] 1.12820 + }, 1.12821 + { 1.12822 + name: 'callinterface', 1.12823 + canThrow: true, 1.12824 + operands: null 1.12825 + }, 1.12826 + { 1.12827 + name: 'callsupervoid', 1.12828 + canThrow: true, 1.12829 + operands: [ 1.12830 + { 1.12831 + name: 'index', 1.12832 + size: 'u30', 1.12833 + type: 'M' 1.12834 + }, 1.12835 + { 1.12836 + name: 'argCount', 1.12837 + size: 'u30', 1.12838 + type: '' 1.12839 + } 1.12840 + ] 1.12841 + }, 1.12842 + { 1.12843 + name: 'callpropvoid', 1.12844 + canThrow: true, 1.12845 + operands: [ 1.12846 + { 1.12847 + name: 'index', 1.12848 + size: 'u30', 1.12849 + type: 'M' 1.12850 + }, 1.12851 + { 1.12852 + name: 'argCount', 1.12853 + size: 'u30', 1.12854 + type: '' 1.12855 + } 1.12856 + ] 1.12857 + }, 1.12858 + { 1.12859 + name: 'sxi1', 1.12860 + canThrow: false, 1.12861 + operands: [] 1.12862 + }, 1.12863 + { 1.12864 + name: 'sxi8', 1.12865 + canThrow: false, 1.12866 + operands: [] 1.12867 + }, 1.12868 + { 1.12869 + name: 'sxi16', 1.12870 + canThrow: false, 1.12871 + operands: [] 1.12872 + }, 1.12873 + { 1.12874 + name: 'applytype', 1.12875 + canThrow: true, 1.12876 + operands: [ 1.12877 + { 1.12878 + name: 'argCount', 1.12879 + size: 'u30', 1.12880 + type: '' 1.12881 + } 1.12882 + ] 1.12883 + }, 1.12884 + { 1.12885 + name: 'pushfloat4', 1.12886 + canThrow: false, 1.12887 + operands: null 1.12888 + }, 1.12889 + { 1.12890 + name: 'newobject', 1.12891 + canThrow: true, 1.12892 + operands: [ 1.12893 + { 1.12894 + name: 'argCount', 1.12895 + size: 'u30', 1.12896 + type: '' 1.12897 + } 1.12898 + ] 1.12899 + }, 1.12900 + { 1.12901 + name: 'newarray', 1.12902 + canThrow: true, 1.12903 + operands: [ 1.12904 + { 1.12905 + name: 'argCount', 1.12906 + size: 'u30', 1.12907 + type: '' 1.12908 + } 1.12909 + ] 1.12910 + }, 1.12911 + { 1.12912 + name: 'newactivation', 1.12913 + canThrow: true, 1.12914 + operands: [] 1.12915 + }, 1.12916 + { 1.12917 + name: 'newclass', 1.12918 + canThrow: true, 1.12919 + operands: [ 1.12920 + { 1.12921 + name: 'index', 1.12922 + size: 'u30', 1.12923 + type: 'CI' 1.12924 + } 1.12925 + ] 1.12926 + }, 1.12927 + { 1.12928 + name: 'getdescendants', 1.12929 + canThrow: true, 1.12930 + operands: [ 1.12931 + { 1.12932 + name: 'index', 1.12933 + size: 'u30', 1.12934 + type: 'M' 1.12935 + } 1.12936 + ] 1.12937 + }, 1.12938 + { 1.12939 + name: 'newcatch', 1.12940 + canThrow: true, 1.12941 + operands: [ 1.12942 + { 1.12943 + name: 'index', 1.12944 + size: 'u30', 1.12945 + type: 'EI' 1.12946 + } 1.12947 + ] 1.12948 + }, 1.12949 + { 1.12950 + name: 'findpropglobalstrict', 1.12951 + canThrow: true, 1.12952 + operands: null 1.12953 + }, 1.12954 + { 1.12955 + name: 'findpropglobal', 1.12956 + canThrow: true, 1.12957 + operands: null 1.12958 + }, 1.12959 + { 1.12960 + name: 'findpropstrict', 1.12961 + canThrow: true, 1.12962 + operands: [ 1.12963 + { 1.12964 + name: 'index', 1.12965 + size: 'u30', 1.12966 + type: 'M' 1.12967 + } 1.12968 + ] 1.12969 + }, 1.12970 + { 1.12971 + name: 'findproperty', 1.12972 + canThrow: true, 1.12973 + operands: [ 1.12974 + { 1.12975 + name: 'index', 1.12976 + size: 'u30', 1.12977 + type: 'M' 1.12978 + } 1.12979 + ] 1.12980 + }, 1.12981 + { 1.12982 + name: 'finddef', 1.12983 + canThrow: true, 1.12984 + operands: null 1.12985 + }, 1.12986 + { 1.12987 + name: 'getlex', 1.12988 + canThrow: true, 1.12989 + operands: [ 1.12990 + { 1.12991 + name: 'index', 1.12992 + size: 'u30', 1.12993 + type: 'M' 1.12994 + } 1.12995 + ] 1.12996 + }, 1.12997 + { 1.12998 + name: 'setproperty', 1.12999 + canThrow: true, 1.13000 + operands: [ 1.13001 + { 1.13002 + name: 'index', 1.13003 + size: 'u30', 1.13004 + type: 'M' 1.13005 + } 1.13006 + ] 1.13007 + }, 1.13008 + { 1.13009 + name: 'getlocal', 1.13010 + canThrow: false, 1.13011 + operands: [ 1.13012 + { 1.13013 + name: 'index', 1.13014 + size: 'u30', 1.13015 + type: '' 1.13016 + } 1.13017 + ] 1.13018 + }, 1.13019 + { 1.13020 + name: 'setlocal', 1.13021 + canThrow: false, 1.13022 + operands: [ 1.13023 + { 1.13024 + name: 'index', 1.13025 + size: 'u30', 1.13026 + type: '' 1.13027 + } 1.13028 + ] 1.13029 + }, 1.13030 + { 1.13031 + name: 'getglobalscope', 1.13032 + canThrow: false, 1.13033 + operands: [] 1.13034 + }, 1.13035 + { 1.13036 + name: 'getscopeobject', 1.13037 + canThrow: false, 1.13038 + operands: [ 1.13039 + { 1.13040 + name: 'index', 1.13041 + size: 'u30', 1.13042 + type: '' 1.13043 + } 1.13044 + ] 1.13045 + }, 1.13046 + { 1.13047 + name: 'getproperty', 1.13048 + canThrow: true, 1.13049 + operands: [ 1.13050 + { 1.13051 + name: 'index', 1.13052 + size: 'u30', 1.13053 + type: 'M' 1.13054 + } 1.13055 + ] 1.13056 + }, 1.13057 + { 1.13058 + name: 'getouterscope', 1.13059 + canThrow: false, 1.13060 + operands: null 1.13061 + }, 1.13062 + { 1.13063 + name: 'initproperty', 1.13064 + canThrow: true, 1.13065 + operands: [ 1.13066 + { 1.13067 + name: 'index', 1.13068 + size: 'u30', 1.13069 + type: 'M' 1.13070 + } 1.13071 + ] 1.13072 + }, 1.13073 + null, 1.13074 + { 1.13075 + name: 'deleteproperty', 1.13076 + canThrow: true, 1.13077 + operands: [ 1.13078 + { 1.13079 + name: 'index', 1.13080 + size: 'u30', 1.13081 + type: 'M' 1.13082 + } 1.13083 + ] 1.13084 + }, 1.13085 + null, 1.13086 + { 1.13087 + name: 'getslot', 1.13088 + canThrow: true, 1.13089 + operands: [ 1.13090 + { 1.13091 + name: 'index', 1.13092 + size: 'u30', 1.13093 + type: '' 1.13094 + } 1.13095 + ] 1.13096 + }, 1.13097 + { 1.13098 + name: 'setslot', 1.13099 + canThrow: true, 1.13100 + operands: [ 1.13101 + { 1.13102 + name: 'index', 1.13103 + size: 'u30', 1.13104 + type: '' 1.13105 + } 1.13106 + ] 1.13107 + }, 1.13108 + { 1.13109 + name: 'getglobalslot', 1.13110 + canThrow: false, 1.13111 + operands: [ 1.13112 + { 1.13113 + name: 'index', 1.13114 + size: 'u30', 1.13115 + type: '' 1.13116 + } 1.13117 + ] 1.13118 + }, 1.13119 + { 1.13120 + name: 'setglobalslot', 1.13121 + canThrow: false, 1.13122 + operands: [ 1.13123 + { 1.13124 + name: 'index', 1.13125 + size: 'u30', 1.13126 + type: '' 1.13127 + } 1.13128 + ] 1.13129 + }, 1.13130 + { 1.13131 + name: 'convert_s', 1.13132 + canThrow: true, 1.13133 + operands: [] 1.13134 + }, 1.13135 + { 1.13136 + name: 'esc_xelem', 1.13137 + canThrow: true, 1.13138 + operands: [] 1.13139 + }, 1.13140 + { 1.13141 + name: 'esc_xattr', 1.13142 + canThrow: true, 1.13143 + operands: [] 1.13144 + }, 1.13145 + { 1.13146 + name: 'convert_i', 1.13147 + canThrow: true, 1.13148 + operands: [] 1.13149 + }, 1.13150 + { 1.13151 + name: 'convert_u', 1.13152 + canThrow: true, 1.13153 + operands: [] 1.13154 + }, 1.13155 + { 1.13156 + name: 'convert_d', 1.13157 + canThrow: true, 1.13158 + operands: [] 1.13159 + }, 1.13160 + { 1.13161 + name: 'convert_b', 1.13162 + canThrow: true, 1.13163 + operands: [] 1.13164 + }, 1.13165 + { 1.13166 + name: 'convert_o', 1.13167 + canThrow: true, 1.13168 + operands: [] 1.13169 + }, 1.13170 + { 1.13171 + name: 'checkfilter', 1.13172 + canThrow: true, 1.13173 + operands: [] 1.13174 + }, 1.13175 + { 1.13176 + name: 'convert_f', 1.13177 + canThrow: true, 1.13178 + operands: [] 1.13179 + }, 1.13180 + { 1.13181 + name: 'unplus', 1.13182 + canThrow: true, 1.13183 + operands: [] 1.13184 + }, 1.13185 + { 1.13186 + name: 'convert_f4', 1.13187 + canThrow: true, 1.13188 + operands: [] 1.13189 + }, 1.13190 + null, 1.13191 + null, 1.13192 + null, 1.13193 + null, 1.13194 + { 1.13195 + name: 'coerce', 1.13196 + canThrow: true, 1.13197 + operands: [ 1.13198 + { 1.13199 + name: 'index', 1.13200 + size: 'u30', 1.13201 + type: 'M' 1.13202 + } 1.13203 + ] 1.13204 + }, 1.13205 + { 1.13206 + name: 'coerce_b', 1.13207 + canThrow: true, 1.13208 + operands: [] 1.13209 + }, 1.13210 + { 1.13211 + name: 'coerce_a', 1.13212 + canThrow: true, 1.13213 + operands: [] 1.13214 + }, 1.13215 + { 1.13216 + name: 'coerce_i', 1.13217 + canThrow: true, 1.13218 + operands: [] 1.13219 + }, 1.13220 + { 1.13221 + name: 'coerce_d', 1.13222 + canThrow: true, 1.13223 + operands: [] 1.13224 + }, 1.13225 + { 1.13226 + name: 'coerce_s', 1.13227 + canThrow: true, 1.13228 + operands: [] 1.13229 + }, 1.13230 + { 1.13231 + name: 'astype', 1.13232 + canThrow: true, 1.13233 + operands: [ 1.13234 + { 1.13235 + name: 'index', 1.13236 + size: 'u30', 1.13237 + type: 'M' 1.13238 + } 1.13239 + ] 1.13240 + }, 1.13241 + { 1.13242 + name: 'astypelate', 1.13243 + canThrow: true, 1.13244 + operands: [] 1.13245 + }, 1.13246 + { 1.13247 + name: 'coerce_u', 1.13248 + canThrow: true, 1.13249 + operands: [] 1.13250 + }, 1.13251 + { 1.13252 + name: 'coerce_o', 1.13253 + canThrow: true, 1.13254 + operands: [] 1.13255 + }, 1.13256 + null, 1.13257 + null, 1.13258 + null, 1.13259 + null, 1.13260 + null, 1.13261 + null, 1.13262 + { 1.13263 + name: 'negate', 1.13264 + canThrow: true, 1.13265 + operands: [] 1.13266 + }, 1.13267 + { 1.13268 + name: 'increment', 1.13269 + canThrow: true, 1.13270 + operands: [] 1.13271 + }, 1.13272 + { 1.13273 + name: 'inclocal', 1.13274 + canThrow: true, 1.13275 + operands: [ 1.13276 + { 1.13277 + name: 'index', 1.13278 + size: 'u30', 1.13279 + type: '' 1.13280 + } 1.13281 + ] 1.13282 + }, 1.13283 + { 1.13284 + name: 'decrement', 1.13285 + canThrow: true, 1.13286 + operands: [] 1.13287 + }, 1.13288 + { 1.13289 + name: 'declocal', 1.13290 + canThrow: true, 1.13291 + operands: [ 1.13292 + { 1.13293 + name: 'index', 1.13294 + size: 'u30', 1.13295 + type: '' 1.13296 + } 1.13297 + ] 1.13298 + }, 1.13299 + { 1.13300 + name: 'typeof', 1.13301 + canThrow: false, 1.13302 + operands: [] 1.13303 + }, 1.13304 + { 1.13305 + name: 'not', 1.13306 + canThrow: false, 1.13307 + operands: [] 1.13308 + }, 1.13309 + { 1.13310 + name: 'bitnot', 1.13311 + canThrow: true, 1.13312 + operands: [] 1.13313 + }, 1.13314 + null, 1.13315 + null, 1.13316 + null, 1.13317 + null, 1.13318 + null, 1.13319 + null, 1.13320 + null, 1.13321 + null, 1.13322 + { 1.13323 + name: 'add', 1.13324 + canThrow: true, 1.13325 + operands: [] 1.13326 + }, 1.13327 + { 1.13328 + name: 'subtract', 1.13329 + canThrow: true, 1.13330 + operands: [] 1.13331 + }, 1.13332 + { 1.13333 + name: 'multiply', 1.13334 + canThrow: true, 1.13335 + operands: [] 1.13336 + }, 1.13337 + { 1.13338 + name: 'divide', 1.13339 + canThrow: true, 1.13340 + operands: [] 1.13341 + }, 1.13342 + { 1.13343 + name: 'modulo', 1.13344 + canThrow: true, 1.13345 + operands: [] 1.13346 + }, 1.13347 + { 1.13348 + name: 'lshift', 1.13349 + canThrow: true, 1.13350 + operands: [] 1.13351 + }, 1.13352 + { 1.13353 + name: 'rshift', 1.13354 + canThrow: true, 1.13355 + operands: [] 1.13356 + }, 1.13357 + { 1.13358 + name: 'urshift', 1.13359 + canThrow: true, 1.13360 + operands: [] 1.13361 + }, 1.13362 + { 1.13363 + name: 'bitand', 1.13364 + canThrow: true, 1.13365 + operands: [] 1.13366 + }, 1.13367 + { 1.13368 + name: 'bitor', 1.13369 + canThrow: true, 1.13370 + operands: [] 1.13371 + }, 1.13372 + { 1.13373 + name: 'bitxor', 1.13374 + canThrow: true, 1.13375 + operands: [] 1.13376 + }, 1.13377 + { 1.13378 + name: 'equals', 1.13379 + canThrow: true, 1.13380 + operands: [] 1.13381 + }, 1.13382 + { 1.13383 + name: 'strictequals', 1.13384 + canThrow: true, 1.13385 + operands: [] 1.13386 + }, 1.13387 + { 1.13388 + name: 'lessthan', 1.13389 + canThrow: true, 1.13390 + operands: [] 1.13391 + }, 1.13392 + { 1.13393 + name: 'lessequals', 1.13394 + canThrow: true, 1.13395 + operands: [] 1.13396 + }, 1.13397 + { 1.13398 + name: 'greaterthan', 1.13399 + canThrow: true, 1.13400 + operands: [] 1.13401 + }, 1.13402 + { 1.13403 + name: 'greaterequals', 1.13404 + canThrow: true, 1.13405 + operands: [] 1.13406 + }, 1.13407 + { 1.13408 + name: 'instanceof', 1.13409 + canThrow: true, 1.13410 + operands: [] 1.13411 + }, 1.13412 + { 1.13413 + name: 'istype', 1.13414 + canThrow: true, 1.13415 + operands: [ 1.13416 + { 1.13417 + name: 'index', 1.13418 + size: 'u30', 1.13419 + type: 'M' 1.13420 + } 1.13421 + ] 1.13422 + }, 1.13423 + { 1.13424 + name: 'istypelate', 1.13425 + canThrow: true, 1.13426 + operands: [] 1.13427 + }, 1.13428 + { 1.13429 + name: 'in', 1.13430 + canThrow: true, 1.13431 + operands: [] 1.13432 + }, 1.13433 + null, 1.13434 + null, 1.13435 + null, 1.13436 + null, 1.13437 + null, 1.13438 + null, 1.13439 + null, 1.13440 + null, 1.13441 + null, 1.13442 + null, 1.13443 + null, 1.13444 + { 1.13445 + name: 'increment_i', 1.13446 + canThrow: true, 1.13447 + operands: [] 1.13448 + }, 1.13449 + { 1.13450 + name: 'decrement_i', 1.13451 + canThrow: true, 1.13452 + operands: [] 1.13453 + }, 1.13454 + { 1.13455 + name: 'inclocal_i', 1.13456 + canThrow: true, 1.13457 + operands: [ 1.13458 + { 1.13459 + name: 'index', 1.13460 + size: 'u30', 1.13461 + type: '' 1.13462 + } 1.13463 + ] 1.13464 + }, 1.13465 + { 1.13466 + name: 'declocal_i', 1.13467 + canThrow: true, 1.13468 + operands: [ 1.13469 + { 1.13470 + name: 'index', 1.13471 + size: 'u30', 1.13472 + type: '' 1.13473 + } 1.13474 + ] 1.13475 + }, 1.13476 + { 1.13477 + name: 'negate_i', 1.13478 + canThrow: true, 1.13479 + operands: [] 1.13480 + }, 1.13481 + { 1.13482 + name: 'add_i', 1.13483 + canThrow: true, 1.13484 + operands: [] 1.13485 + }, 1.13486 + { 1.13487 + name: 'subtract_i', 1.13488 + canThrow: true, 1.13489 + operands: [] 1.13490 + }, 1.13491 + { 1.13492 + name: 'multiply_i', 1.13493 + canThrow: true, 1.13494 + operands: [] 1.13495 + }, 1.13496 + null, 1.13497 + null, 1.13498 + null, 1.13499 + null, 1.13500 + null, 1.13501 + null, 1.13502 + null, 1.13503 + null, 1.13504 + { 1.13505 + name: 'getlocal0', 1.13506 + canThrow: false, 1.13507 + operands: [] 1.13508 + }, 1.13509 + { 1.13510 + name: 'getlocal1', 1.13511 + canThrow: false, 1.13512 + operands: [] 1.13513 + }, 1.13514 + { 1.13515 + name: 'getlocal2', 1.13516 + canThrow: false, 1.13517 + operands: [] 1.13518 + }, 1.13519 + { 1.13520 + name: 'getlocal3', 1.13521 + canThrow: false, 1.13522 + operands: [] 1.13523 + }, 1.13524 + { 1.13525 + name: 'setlocal0', 1.13526 + canThrow: false, 1.13527 + operands: [] 1.13528 + }, 1.13529 + { 1.13530 + name: 'setlocal1', 1.13531 + canThrow: false, 1.13532 + operands: [] 1.13533 + }, 1.13534 + { 1.13535 + name: 'setlocal2', 1.13536 + canThrow: false, 1.13537 + operands: [] 1.13538 + }, 1.13539 + { 1.13540 + name: 'setlocal3', 1.13541 + canThrow: false, 1.13542 + operands: [] 1.13543 + }, 1.13544 + null, 1.13545 + null, 1.13546 + null, 1.13547 + null, 1.13548 + null, 1.13549 + null, 1.13550 + null, 1.13551 + null, 1.13552 + null, 1.13553 + null, 1.13554 + null, 1.13555 + null, 1.13556 + null, 1.13557 + null, 1.13558 + null, 1.13559 + null, 1.13560 + null, 1.13561 + null, 1.13562 + null, 1.13563 + null, 1.13564 + null, 1.13565 + { 1.13566 + name: 'invalid', 1.13567 + canThrow: false, 1.13568 + operands: [] 1.13569 + }, 1.13570 + null, 1.13571 + { 1.13572 + name: 'debug', 1.13573 + canThrow: true, 1.13574 + operands: [ 1.13575 + { 1.13576 + name: 'debugType', 1.13577 + size: 'u08', 1.13578 + type: '' 1.13579 + }, 1.13580 + { 1.13581 + name: 'index', 1.13582 + size: 'u30', 1.13583 + type: 'S' 1.13584 + }, 1.13585 + { 1.13586 + name: 'reg', 1.13587 + size: 'u08', 1.13588 + type: '' 1.13589 + }, 1.13590 + { 1.13591 + name: 'extra', 1.13592 + size: 'u30', 1.13593 + type: '' 1.13594 + } 1.13595 + ] 1.13596 + }, 1.13597 + { 1.13598 + name: 'debugline', 1.13599 + canThrow: true, 1.13600 + operands: [ 1.13601 + { 1.13602 + name: 'lineNumber', 1.13603 + size: 'u30', 1.13604 + type: '' 1.13605 + } 1.13606 + ] 1.13607 + }, 1.13608 + { 1.13609 + name: 'debugfile', 1.13610 + canThrow: true, 1.13611 + operands: [ 1.13612 + { 1.13613 + name: 'index', 1.13614 + size: 'u30', 1.13615 + type: 'S' 1.13616 + } 1.13617 + ] 1.13618 + }, 1.13619 + null, 1.13620 + null, 1.13621 + null, 1.13622 + null, 1.13623 + null, 1.13624 + null, 1.13625 + null, 1.13626 + null, 1.13627 + null, 1.13628 + null, 1.13629 + null, 1.13630 + null, 1.13631 + null, 1.13632 + null 1.13633 + ]; 1.13634 + function opcodeName(op) { 1.13635 + return AVM2.opcodeTable[op].name; 1.13636 + } 1.13637 + AVM2.opcodeName = opcodeName; 1.13638 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.13639 + var AVM2 = Shumway.AVM2; 1.13640 +}(Shumway || (Shumway = {}))); 1.13641 +var opcodeTable = Shumway.AVM2.opcodeTable; 1.13642 +var opcodeName = Shumway.AVM2.opcodeName; 1.13643 +var opcodeTable = Shumway.AVM2.opcodeTable; 1.13644 +var opcodeName = Shumway.AVM2.opcodeName; 1.13645 +var __extends = this.__extends || function (d, b) { 1.13646 + for (var p in b) 1.13647 + if (b.hasOwnProperty(p)) 1.13648 + d[p] = b[p]; 1.13649 + function __() { 1.13650 + this.constructor = d; 1.13651 + } 1.13652 + __.prototype = b.prototype; 1.13653 + d.prototype = new __(); 1.13654 + }; 1.13655 +var Shumway; 1.13656 +(function (Shumway) { 1.13657 + (function (AVM2) { 1.13658 + (function (ABC) { 1.13659 + var Timer = Shumway.Metrics.Timer; 1.13660 + var isString = Shumway.isString; 1.13661 + var isNumber = Shumway.isNumber; 1.13662 + var isNumeric = Shumway.isNumeric; 1.13663 + var isObject = Shumway.isObject; 1.13664 + var textDecoder = null; 1.13665 + if (typeof TextDecoder !== 'undefined') { 1.13666 + textDecoder = new TextDecoder(); 1.13667 + } 1.13668 + var AbcStream = function () { 1.13669 + function AbcStream(bytes) { 1.13670 + this._bytes = bytes; 1.13671 + this._view = new DataView(bytes.buffer, bytes.byteOffset); 1.13672 + this._position = 0; 1.13673 + } 1.13674 + AbcStream._getResultBuffer = function (length) { 1.13675 + if (!AbcStream._resultBuffer || AbcStream._resultBuffer.length < length) { 1.13676 + AbcStream._resultBuffer = new Int32Array(length * 2); 1.13677 + } 1.13678 + return AbcStream._resultBuffer; 1.13679 + }; 1.13680 + Object.defineProperty(AbcStream.prototype, 'position', { 1.13681 + get: function () { 1.13682 + return this._position; 1.13683 + }, 1.13684 + enumerable: true, 1.13685 + configurable: true 1.13686 + }); 1.13687 + AbcStream.prototype.remaining = function () { 1.13688 + return this._bytes.length - this._position; 1.13689 + }; 1.13690 + AbcStream.prototype.seek = function (position) { 1.13691 + this._position = position; 1.13692 + }; 1.13693 + AbcStream.prototype.readU8 = function () { 1.13694 + return this._bytes[this._position++]; 1.13695 + }; 1.13696 + AbcStream.prototype.readU8s = function (count) { 1.13697 + var b = new Uint8Array(count); 1.13698 + b.set(this._bytes.subarray(this._position, this._position + count), 0); 1.13699 + this._position += count; 1.13700 + return b; 1.13701 + }; 1.13702 + AbcStream.prototype.readS8 = function () { 1.13703 + return this._bytes[this._position++] << 24 >> 24; 1.13704 + }; 1.13705 + AbcStream.prototype.readU32 = function () { 1.13706 + return this.readS32() >>> 0; 1.13707 + }; 1.13708 + AbcStream.prototype.readU30 = function () { 1.13709 + var result = this.readU32(); 1.13710 + if (result & 3221225472) { 1.13711 + return result; 1.13712 + } 1.13713 + return result; 1.13714 + }; 1.13715 + AbcStream.prototype.readU30Unsafe = function () { 1.13716 + return this.readU32(); 1.13717 + }; 1.13718 + AbcStream.prototype.readS16 = function () { 1.13719 + return this.readU30Unsafe() << 16 >> 16; 1.13720 + }; 1.13721 + AbcStream.prototype.readS32 = function () { 1.13722 + var result = this.readU8(); 1.13723 + if (result & 128) { 1.13724 + result = result & 127 | this.readU8() << 7; 1.13725 + if (result & 16384) { 1.13726 + result = result & 16383 | this.readU8() << 14; 1.13727 + if (result & 2097152) { 1.13728 + result = result & 2097151 | this.readU8() << 21; 1.13729 + if (result & 268435456) { 1.13730 + result = result & 268435455 | this.readU8() << 28; 1.13731 + result = result & 4294967295; 1.13732 + } 1.13733 + } 1.13734 + } 1.13735 + } 1.13736 + return result; 1.13737 + }; 1.13738 + AbcStream.prototype.readWord = function () { 1.13739 + var result = this._view.getUint32(this._position, true); 1.13740 + this._position += 4; 1.13741 + return result; 1.13742 + }; 1.13743 + AbcStream.prototype.readS24 = function () { 1.13744 + var u = this.readU8() | this.readU8() << 8 | this.readU8() << 16; 1.13745 + return u << 8 >> 8; 1.13746 + }; 1.13747 + AbcStream.prototype.readDouble = function () { 1.13748 + var result = this._view.getFloat64(this._position, true); 1.13749 + this._position += 8; 1.13750 + return result; 1.13751 + }; 1.13752 + AbcStream.prototype.readUTFString = function (length) { 1.13753 + if (textDecoder) { 1.13754 + var position = this._position; 1.13755 + this._position += length; 1.13756 + return textDecoder.decode(this._bytes.subarray(position, position + length)); 1.13757 + } 1.13758 + var pos = this._position; 1.13759 + var end = pos + length; 1.13760 + var bytes = this._bytes; 1.13761 + var i = 0; 1.13762 + var result = AbcStream._getResultBuffer(length * 2); 1.13763 + while (pos < end) { 1.13764 + var c = bytes[pos++]; 1.13765 + if (c <= 127) { 1.13766 + result[i++] = c; 1.13767 + } else if (c >= 192) { 1.13768 + var code = 0; 1.13769 + if (c < 224) { 1.13770 + code = (c & 31) << 6 | bytes[pos++] & 63; 1.13771 + } else if (c < 240) { 1.13772 + code = (c & 15) << 12 | (bytes[pos++] & 63) << 6 | bytes[pos++] & 63; 1.13773 + } else { 1.13774 + code = ((c & 7) << 18 | (bytes[pos++] & 63) << 12 | (bytes[pos++] & 63) << 6 | bytes[pos++] & 63) - 65536; 1.13775 + result[i++] = ((code & 1047552) >>> 10) + 55296; 1.13776 + code = (code & 1023) + 56320; 1.13777 + } 1.13778 + result[i++] = code; 1.13779 + } 1.13780 + } 1.13781 + this._position = pos; 1.13782 + return Shumway.StringUtilities.fromCharCodeArray(result.subarray(0, i)); 1.13783 + }; 1.13784 + AbcStream._resultBuffer = new Int32Array(256); 1.13785 + return AbcStream; 1.13786 + }(); 1.13787 + ABC.AbcStream = AbcStream; 1.13788 + var Parameter = function () { 1.13789 + function Parameter(name, type, value) { 1.13790 + this.name = name; 1.13791 + this.type = type; 1.13792 + this.value = value; 1.13793 + } 1.13794 + return Parameter; 1.13795 + }(); 1.13796 + ABC.Parameter = Parameter; 1.13797 + var Trait = function () { 1.13798 + function Trait(abc, stream, holder) { 1.13799 + var constantPool = abc.constantPool; 1.13800 + var methods = abc.methods; 1.13801 + var classes = abc.classes; 1.13802 + var metadata = abc.metadata; 1.13803 + this.holder = holder; 1.13804 + this.name = constantPool.multinames[stream.readU30()]; 1.13805 + var tag = stream.readU8(); 1.13806 + this.kind = tag & 15; 1.13807 + this.attributes = tag >> 4 & 15; 1.13808 + true; 1.13809 + switch (this.kind) { 1.13810 + case 0: 1.13811 + case 6: 1.13812 + this.slotId = stream.readU30(); 1.13813 + this.typeName = constantPool.multinames[stream.readU30()]; 1.13814 + var valueIndex = stream.readU30(); 1.13815 + this.value = undefined; 1.13816 + if (valueIndex !== 0) { 1.13817 + this.hasDefaultValue = true; 1.13818 + this.value = constantPool.getValue(stream.readU8(), valueIndex); 1.13819 + } 1.13820 + break; 1.13821 + case 1: 1.13822 + case 3: 1.13823 + case 2: 1.13824 + this.dispId = stream.readU30(); 1.13825 + this.methodInfo = methods[stream.readU30()]; 1.13826 + this.methodInfo.name = this.name; 1.13827 + AbcFile.attachHolder(this.methodInfo, this.holder); 1.13828 + this.methodInfo.abc = abc; 1.13829 + break; 1.13830 + case 4: 1.13831 + this.slotId = stream.readU30(); 1.13832 + true; 1.13833 + this.classInfo = classes[stream.readU30()]; 1.13834 + break; 1.13835 + case 5: 1.13836 + true; 1.13837 + break; 1.13838 + } 1.13839 + if (this.attributes & 4) { 1.13840 + var traitMetadata; 1.13841 + for (var i = 0, j = stream.readU30(); i < j; i++) { 1.13842 + var md = metadata[stream.readU30()]; 1.13843 + if (md.name === '__go_to_definition_help' || md.name === '__go_to_ctor_definition_help') { 1.13844 + continue; 1.13845 + } 1.13846 + if (!traitMetadata) { 1.13847 + traitMetadata = {}; 1.13848 + } 1.13849 + traitMetadata[md.name] = md; 1.13850 + } 1.13851 + if (traitMetadata) { 1.13852 + if (this.isClass()) { 1.13853 + this.classInfo.metadata = traitMetadata; 1.13854 + } 1.13855 + this.metadata = traitMetadata; 1.13856 + } 1.13857 + } 1.13858 + } 1.13859 + Trait.prototype.isSlot = function () { 1.13860 + return this.kind === 0; 1.13861 + }; 1.13862 + Trait.prototype.isConst = function () { 1.13863 + return this.kind === 6; 1.13864 + }; 1.13865 + Trait.prototype.isMethod = function () { 1.13866 + return this.kind === 1; 1.13867 + }; 1.13868 + Trait.prototype.isClass = function () { 1.13869 + return this.kind === 4; 1.13870 + }; 1.13871 + Trait.prototype.isGetter = function () { 1.13872 + return this.kind === 2; 1.13873 + }; 1.13874 + Trait.prototype.isSetter = function () { 1.13875 + return this.kind === 3; 1.13876 + }; 1.13877 + Trait.prototype.isProtected = function () { 1.13878 + true; 1.13879 + return this.name.namespaces[0].isProtected(); 1.13880 + }; 1.13881 + Trait.prototype.kindName = function () { 1.13882 + switch (this.kind) { 1.13883 + case 0: 1.13884 + return 'Slot'; 1.13885 + case 6: 1.13886 + return 'Const'; 1.13887 + case 1: 1.13888 + return 'Method'; 1.13889 + case 3: 1.13890 + return 'Setter'; 1.13891 + case 2: 1.13892 + return 'Getter'; 1.13893 + case 4: 1.13894 + return 'Class'; 1.13895 + case 5: 1.13896 + return 'Function'; 1.13897 + } 1.13898 + Shumway.Debug.unexpected(); 1.13899 + }; 1.13900 + Trait.prototype.isOverride = function () { 1.13901 + return this.attributes & 2; 1.13902 + }; 1.13903 + Trait.prototype.isFinal = function () { 1.13904 + return this.attributes & 1; 1.13905 + }; 1.13906 + Trait.prototype.toString = function () { 1.13907 + var str = Shumway.IntegerUtilities.getFlags(this.attributes, 'final|override|metadata'.split('|')); 1.13908 + if (str) { 1.13909 + str += ' '; 1.13910 + } 1.13911 + str += Multiname.getQualifiedName(this.name); 1.13912 + switch (this.kind) { 1.13913 + case 0: 1.13914 + case 6: 1.13915 + return str + ', typeName: ' + this.typeName + ', slotId: ' + this.slotId + ', value: ' + this.value; 1.13916 + case 1: 1.13917 + case 3: 1.13918 + case 2: 1.13919 + return str + ', ' + this.kindName() + ': ' + this.methodInfo.name; 1.13920 + case 4: 1.13921 + return str + ', slotId: ' + this.slotId + ', class: ' + this.classInfo; 1.13922 + case 5: 1.13923 + break; 1.13924 + } 1.13925 + }; 1.13926 + Trait.parseTraits = function (abc, stream, holder) { 1.13927 + var count = stream.readU30(); 1.13928 + var traits = []; 1.13929 + for (var i = 0; i < count; i++) { 1.13930 + traits.push(new Trait(abc, stream, holder)); 1.13931 + } 1.13932 + return traits; 1.13933 + }; 1.13934 + return Trait; 1.13935 + }(); 1.13936 + ABC.Trait = Trait; 1.13937 + var Info = function () { 1.13938 + function Info(abc, index) { 1.13939 + this.abc = abc; 1.13940 + this.index = index; 1.13941 + } 1.13942 + return Info; 1.13943 + }(); 1.13944 + ABC.Info = Info; 1.13945 + var MethodInfo = function (_super) { 1.13946 + __extends(MethodInfo, _super); 1.13947 + function MethodInfo(abc, index, stream) { 1.13948 + _super.call(this, abc, index); 1.13949 + var constantPool = abc.constantPool; 1.13950 + var parameterCount = stream.readU30(); 1.13951 + this.returnType = constantPool.multinames[stream.readU30()]; 1.13952 + this.parameters = []; 1.13953 + for (var i = 0; i < parameterCount; i++) { 1.13954 + this.parameters.push(new Parameter(undefined, constantPool.multinames[stream.readU30()], undefined)); 1.13955 + } 1.13956 + this.debugName = constantPool.strings[stream.readU30()]; 1.13957 + this.flags = stream.readU8(); 1.13958 + var optionalCount = 0; 1.13959 + if (this.flags & 8) { 1.13960 + optionalCount = stream.readU30(); 1.13961 + true; 1.13962 + for (var i = parameterCount - optionalCount; i < parameterCount; i++) { 1.13963 + var valueIndex = stream.readU30(); 1.13964 + this.parameters[i].value = constantPool.getValue(stream.readU8(), valueIndex); 1.13965 + } 1.13966 + } 1.13967 + if (this.flags & 128) { 1.13968 + for (var i = 0; i < parameterCount; i++) { 1.13969 + if (false) { 1.13970 + this.parameters[i].name = constantPool.strings[stream.readU30()]; 1.13971 + } else { 1.13972 + stream.readU30(); 1.13973 + this.parameters[i].name = MethodInfo._getParameterName(i); 1.13974 + } 1.13975 + } 1.13976 + } else { 1.13977 + for (var i = 0; i < parameterCount; i++) { 1.13978 + this.parameters[i].name = MethodInfo._getParameterName(i); 1.13979 + } 1.13980 + } 1.13981 + } 1.13982 + MethodInfo._getParameterName = function (i) { 1.13983 + true; 1.13984 + return String.fromCharCode('A'.charCodeAt(0) + i); 1.13985 + }; 1.13986 + MethodInfo.prototype.toString = function () { 1.13987 + var flags = Shumway.IntegerUtilities.getFlags(this.flags, 'NEED_ARGUMENTS|NEED_ACTIVATION|NEED_REST|HAS_OPTIONAL|||SET_DXN|HAS_PARAM_NAMES'.split('|')); 1.13988 + return (flags ? flags + ' ' : '') + this.name; 1.13989 + }; 1.13990 + MethodInfo.prototype.hasOptional = function () { 1.13991 + return !(!(this.flags & 8)); 1.13992 + }; 1.13993 + MethodInfo.prototype.needsActivation = function () { 1.13994 + return !(!(this.flags & 2)); 1.13995 + }; 1.13996 + MethodInfo.prototype.needsRest = function () { 1.13997 + return !(!(this.flags & 4)); 1.13998 + }; 1.13999 + MethodInfo.prototype.needsArguments = function () { 1.14000 + return !(!(this.flags & 1)); 1.14001 + }; 1.14002 + MethodInfo.prototype.isNative = function () { 1.14003 + return !(!(this.flags & 32)); 1.14004 + }; 1.14005 + MethodInfo.prototype.isClassMember = function () { 1.14006 + return this.holder instanceof ClassInfo; 1.14007 + }; 1.14008 + MethodInfo.prototype.isInstanceMember = function () { 1.14009 + return this.holder instanceof InstanceInfo; 1.14010 + }; 1.14011 + MethodInfo.prototype.isScriptMember = function () { 1.14012 + return this.holder instanceof ScriptInfo; 1.14013 + }; 1.14014 + MethodInfo.parseException = function (abc, stream) { 1.14015 + var multinames = abc.constantPool.multinames; 1.14016 + var ex = { 1.14017 + start: stream.readU30(), 1.14018 + end: stream.readU30(), 1.14019 + target: stream.readU30(), 1.14020 + typeName: multinames[stream.readU30()], 1.14021 + varName: multinames[stream.readU30()] 1.14022 + }; 1.14023 + true; 1.14024 + true; 1.14025 + return ex; 1.14026 + }; 1.14027 + MethodInfo.parseBody = function (abc, stream) { 1.14028 + var constantPool = abc.constantPool; 1.14029 + var methods = abc.methods; 1.14030 + var index = stream.readU30(); 1.14031 + var mi = methods[index]; 1.14032 + mi.index = index; 1.14033 + mi.hasBody = true; 1.14034 + mi.hash = abc.hash + 196608 + index; 1.14035 + true; 1.14036 + mi.maxStack = stream.readU30(); 1.14037 + mi.localCount = stream.readU30(); 1.14038 + mi.initScopeDepth = stream.readU30(); 1.14039 + mi.maxScopeDepth = stream.readU30(); 1.14040 + mi.code = stream.readU8s(stream.readU30()); 1.14041 + var exceptions = []; 1.14042 + var exceptionCount = stream.readU30(); 1.14043 + for (var i = 0; i < exceptionCount; ++i) { 1.14044 + exceptions.push(MethodInfo.parseException(abc, stream)); 1.14045 + } 1.14046 + mi.exceptions = exceptions; 1.14047 + mi.traits = Trait.parseTraits(abc, stream, mi); 1.14048 + }; 1.14049 + MethodInfo.prototype.hasExceptions = function () { 1.14050 + return this.exceptions.length > 0; 1.14051 + }; 1.14052 + return MethodInfo; 1.14053 + }(Info); 1.14054 + ABC.MethodInfo = MethodInfo; 1.14055 + var InstanceInfo = function (_super) { 1.14056 + __extends(InstanceInfo, _super); 1.14057 + function InstanceInfo(abc, index, stream) { 1.14058 + _super.call(this, abc, index); 1.14059 + this.runtimeId = InstanceInfo.nextID++; 1.14060 + var constantPool = abc.constantPool; 1.14061 + var methods = abc.methods; 1.14062 + this.name = constantPool.multinames[stream.readU30()]; 1.14063 + true; 1.14064 + this.superName = constantPool.multinames[stream.readU30()]; 1.14065 + this.flags = stream.readU8(); 1.14066 + this.protectedNs = undefined; 1.14067 + if (this.flags & 8) { 1.14068 + this.protectedNs = constantPool.namespaces[stream.readU30()]; 1.14069 + } 1.14070 + var interfaceCount = stream.readU30(); 1.14071 + this.interfaces = []; 1.14072 + for (var i = 0; i < interfaceCount; i++) { 1.14073 + this.interfaces[i] = constantPool.multinames[stream.readU30()]; 1.14074 + } 1.14075 + this.init = methods[stream.readU30()]; 1.14076 + this.init.isInstanceInitializer = true; 1.14077 + this.init.name = this.name; 1.14078 + AbcFile.attachHolder(this.init, this); 1.14079 + this.traits = Trait.parseTraits(abc, stream, this); 1.14080 + } 1.14081 + InstanceInfo.prototype.toString = function () { 1.14082 + var flags = Shumway.IntegerUtilities.getFlags(this.flags & 8, 'sealed|final|interface|protected'.split('|')); 1.14083 + var str = (flags ? flags + ' ' : '') + this.name; 1.14084 + if (this.superName) { 1.14085 + str += ' extends ' + this.superName; 1.14086 + } 1.14087 + return str; 1.14088 + }; 1.14089 + InstanceInfo.prototype.isFinal = function () { 1.14090 + return !(!(this.flags & 2)); 1.14091 + }; 1.14092 + InstanceInfo.prototype.isSealed = function () { 1.14093 + return !(!(this.flags & 1)); 1.14094 + }; 1.14095 + InstanceInfo.prototype.isInterface = function () { 1.14096 + return !(!(this.flags & 4)); 1.14097 + }; 1.14098 + InstanceInfo.nextID = 1; 1.14099 + return InstanceInfo; 1.14100 + }(Info); 1.14101 + ABC.InstanceInfo = InstanceInfo; 1.14102 + var ClassInfo = function (_super) { 1.14103 + __extends(ClassInfo, _super); 1.14104 + function ClassInfo(abc, index, stream) { 1.14105 + _super.call(this, abc, index); 1.14106 + this.runtimeId = ClassInfo.nextID++; 1.14107 + this.abc = abc; 1.14108 + this.hash = abc.hash + 65536 + index; 1.14109 + this.index = index; 1.14110 + this.init = abc.methods[stream.readU30()]; 1.14111 + this.init.isClassInitializer = true; 1.14112 + AbcFile.attachHolder(this.init, this); 1.14113 + this.traits = Trait.parseTraits(abc, stream, this); 1.14114 + this.instanceInfo = abc.instances[index]; 1.14115 + this.instanceInfo.classInfo = this; 1.14116 + this.defaultValue = ClassInfo._getDefaultValue(this.instanceInfo.name); 1.14117 + } 1.14118 + ClassInfo._getDefaultValue = function (qn) { 1.14119 + if (Multiname.getQualifiedName(qn) === Multiname.Int || Multiname.getQualifiedName(qn) === Multiname.Uint) { 1.14120 + return 0; 1.14121 + } else if (Multiname.getQualifiedName(qn) === Multiname.Number) { 1.14122 + return NaN; 1.14123 + } else if (Multiname.getQualifiedName(qn) === Multiname.Boolean) { 1.14124 + return false; 1.14125 + } else { 1.14126 + return null; 1.14127 + } 1.14128 + }; 1.14129 + ClassInfo.prototype.toString = function () { 1.14130 + return this.instanceInfo.name.toString(); 1.14131 + }; 1.14132 + ClassInfo.nextID = 1; 1.14133 + return ClassInfo; 1.14134 + }(Info); 1.14135 + ABC.ClassInfo = ClassInfo; 1.14136 + var ScriptInfo = function (_super) { 1.14137 + __extends(ScriptInfo, _super); 1.14138 + function ScriptInfo(abc, index, stream) { 1.14139 + _super.call(this, abc, index); 1.14140 + this.runtimeId = ClassInfo.nextID++; 1.14141 + this.hash = abc.hash + 131072 + index; 1.14142 + this.name = abc.name + '$script' + index; 1.14143 + this.init = abc.methods[stream.readU30()]; 1.14144 + this.init.isScriptInitializer = true; 1.14145 + AbcFile.attachHolder(this.init, this); 1.14146 + this.traits = Trait.parseTraits(abc, stream, this); 1.14147 + } 1.14148 + Object.defineProperty(ScriptInfo.prototype, 'entryPoint', { 1.14149 + get: function () { 1.14150 + return this.init; 1.14151 + }, 1.14152 + enumerable: true, 1.14153 + configurable: true 1.14154 + }); 1.14155 + ScriptInfo.prototype.toString = function () { 1.14156 + return this.name; 1.14157 + }; 1.14158 + ScriptInfo.nextID = 1; 1.14159 + return ScriptInfo; 1.14160 + }(Info); 1.14161 + ABC.ScriptInfo = ScriptInfo; 1.14162 + var AbcFile = function () { 1.14163 + function AbcFile(bytes, name, hash) { 1.14164 + if (typeof hash === 'undefined') { 1.14165 + hash = 0; 1.14166 + } 1.14167 + Timer.start('Parse ABC'); 1.14168 + this.name = name; 1.14169 + this.env = {}; 1.14170 + var computedHash; 1.14171 + if (!hash || !true) { 1.14172 + Timer.start('Adler'); 1.14173 + computedHash = Shumway.HashUtilities.hashBytesTo32BitsAdler(bytes, 0, bytes.length); 1.14174 + Timer.stop(); 1.14175 + } 1.14176 + if (hash) { 1.14177 + this.hash = hash; 1.14178 + true; 1.14179 + } else { 1.14180 + this.hash = computedHash; 1.14181 + } 1.14182 + var n, i; 1.14183 + var stream = new AbcStream(bytes); 1.14184 + AbcFile._checkMagic(stream); 1.14185 + Timer.start('Parse constantPool'); 1.14186 + this.constantPool = new ConstantPool(stream, this); 1.14187 + Timer.stop(); 1.14188 + Timer.start('Parse Method Infos'); 1.14189 + this.methods = []; 1.14190 + n = stream.readU30(); 1.14191 + for (i = 0; i < n; ++i) { 1.14192 + this.methods.push(new MethodInfo(this, i, stream)); 1.14193 + } 1.14194 + Timer.stop(); 1.14195 + Timer.start('Parse MetaData Infos'); 1.14196 + this.metadata = []; 1.14197 + n = stream.readU30(); 1.14198 + for (i = 0; i < n; ++i) { 1.14199 + this.metadata.push(new MetaDataInfo(this, stream)); 1.14200 + } 1.14201 + Timer.stop(); 1.14202 + Timer.start('Parse Instance Infos'); 1.14203 + this.instances = []; 1.14204 + n = stream.readU30(); 1.14205 + for (i = 0; i < n; ++i) { 1.14206 + this.instances.push(new InstanceInfo(this, i, stream)); 1.14207 + } 1.14208 + Timer.stop(); 1.14209 + Timer.start('Parse Class Infos'); 1.14210 + this.classes = []; 1.14211 + for (i = 0; i < n; ++i) { 1.14212 + this.classes.push(new ClassInfo(this, i, stream)); 1.14213 + } 1.14214 + Timer.stop(); 1.14215 + Timer.start('Parse Script Infos'); 1.14216 + this.scripts = []; 1.14217 + n = stream.readU30(); 1.14218 + for (i = 0; i < n; ++i) { 1.14219 + this.scripts.push(new ScriptInfo(this, i, stream)); 1.14220 + } 1.14221 + Timer.stop(); 1.14222 + Timer.start('Parse Method Body Info'); 1.14223 + n = stream.readU30(); 1.14224 + for (i = 0; i < n; ++i) { 1.14225 + MethodInfo.parseBody(this, stream); 1.14226 + } 1.14227 + Timer.stop(); 1.14228 + Timer.stop(); 1.14229 + } 1.14230 + AbcFile._checkMagic = function (stream) { 1.14231 + var magic = stream.readWord(); 1.14232 + var flashPlayerBrannan = 46 << 16 | 15; 1.14233 + if (magic < flashPlayerBrannan) { 1.14234 + throw new Error('Invalid ABC File (magic = ' + Number(magic).toString(16) + ')'); 1.14235 + } 1.14236 + }; 1.14237 + Object.defineProperty(AbcFile.prototype, 'lastScript', { 1.14238 + get: function () { 1.14239 + true; 1.14240 + return this.scripts[this.scripts.length - 1]; 1.14241 + }, 1.14242 + enumerable: true, 1.14243 + configurable: true 1.14244 + }); 1.14245 + AbcFile.attachHolder = function (mi, holder) { 1.14246 + true; 1.14247 + mi.holder = holder; 1.14248 + }; 1.14249 + AbcFile.prototype.toString = function () { 1.14250 + return this.name; 1.14251 + }; 1.14252 + return AbcFile; 1.14253 + }(); 1.14254 + ABC.AbcFile = AbcFile; 1.14255 + var Namespace = function () { 1.14256 + function Namespace(kind, uri, prefix, uniqueURIHash) { 1.14257 + if (typeof uri === 'undefined') { 1.14258 + uri = ''; 1.14259 + } 1.14260 + if (uri === undefined) { 1.14261 + uri = ''; 1.14262 + } 1.14263 + if (prefix !== undefined) { 1.14264 + this.prefix = prefix; 1.14265 + } 1.14266 + this.kind = kind; 1.14267 + this.uri = uri; 1.14268 + this._buildNamespace(uniqueURIHash); 1.14269 + } 1.14270 + Namespace.prototype._buildNamespace = function (uniqueURIHash) { 1.14271 + if (this.kind === 22) { 1.14272 + this.kind = 8; 1.14273 + } 1.14274 + if (this.isPublic() && this.uri) { 1.14275 + var n = this.uri.length - 1; 1.14276 + var mark = this.uri.charCodeAt(n); 1.14277 + if (mark > Namespace._MIN_API_MARK) { 1.14278 + this.uri = this.uri.substring(0, n - 1); 1.14279 + } 1.14280 + } else if (this.isUnique()) { 1.14281 + this.uri = 'private ' + uniqueURIHash; 1.14282 + } 1.14283 + this.qualifiedName = Namespace._qualifyNamespace(this.kind, this.uri, this.prefix ? this.prefix : ''); 1.14284 + }; 1.14285 + Namespace._hashNamespace = function (kind, uri, prefix) { 1.14286 + var data = new Int32Array(1 + uri.length + prefix.length); 1.14287 + var j = 0; 1.14288 + data[j++] = kind; 1.14289 + var index = Namespace._knownURIs.indexOf(uri); 1.14290 + if (index >= 0) { 1.14291 + return kind << 2 | index; 1.14292 + } else { 1.14293 + for (var i = 0; i < uri.length; i++) { 1.14294 + data[j++] = uri.charCodeAt(i); 1.14295 + } 1.14296 + } 1.14297 + for (var i = 0; i < prefix.length; i++) { 1.14298 + data[j++] = prefix.charCodeAt(i); 1.14299 + } 1.14300 + return Shumway.HashUtilities.hashBytesTo32BitsMD5(data, 0, j); 1.14301 + }; 1.14302 + Namespace._qualifyNamespace = function (kind, uri, prefix) { 1.14303 + var key = kind + uri; 1.14304 + var mangledNamespace = Namespace._mangledNamespaceCache[key]; 1.14305 + if (mangledNamespace) { 1.14306 + return mangledNamespace; 1.14307 + } 1.14308 + mangledNamespace = Shumway.StringUtilities.variableLengthEncodeInt32(Namespace._hashNamespace(kind, uri, prefix)); 1.14309 + Namespace._mangledNamespaceMap[mangledNamespace] = { 1.14310 + kind: kind, 1.14311 + uri: uri, 1.14312 + prefix: prefix 1.14313 + }; 1.14314 + Namespace._mangledNamespaceCache[key] = mangledNamespace; 1.14315 + return mangledNamespace; 1.14316 + }; 1.14317 + Namespace.fromQualifiedName = function (qn) { 1.14318 + var length = Shumway.StringUtilities.fromEncoding(qn[0]); 1.14319 + var mangledNamespace = qn.substring(0, length + 1); 1.14320 + var ns = Namespace._mangledNamespaceMap[mangledNamespace]; 1.14321 + return new Namespace(ns.kind, ns.uri, ns.prefix); 1.14322 + }; 1.14323 + Namespace.kindFromString = function (str) { 1.14324 + for (var kind in Namespace._kinds) { 1.14325 + if (Namespace._kinds[kind] === str) { 1.14326 + return kind; 1.14327 + } 1.14328 + } 1.14329 + return true; 1.14330 + }; 1.14331 + Namespace.createNamespace = function (uri, prefix) { 1.14332 + return new Namespace(8, uri, prefix); 1.14333 + }; 1.14334 + Namespace.parse = function (constantPool, stream, hash) { 1.14335 + var kind = stream.readU8(); 1.14336 + var uri = constantPool.strings[stream.readU30()]; 1.14337 + return new Namespace(kind, uri, undefined, hash); 1.14338 + }; 1.14339 + Namespace.prototype.isPublic = function () { 1.14340 + return this.kind === 8 || this.kind === 22; 1.14341 + }; 1.14342 + Namespace.prototype.isProtected = function () { 1.14343 + return this.kind === 24; 1.14344 + }; 1.14345 + Namespace.prototype.isUnique = function () { 1.14346 + return this.kind === 5 && !this.uri; 1.14347 + }; 1.14348 + Namespace.prototype.isDynamic = function () { 1.14349 + return this.isPublic() && !this.uri; 1.14350 + }; 1.14351 + Namespace.prototype.getURI = function () { 1.14352 + return this.uri; 1.14353 + }; 1.14354 + Namespace.prototype.toString = function () { 1.14355 + return Namespace._kinds[this.kind] + (this.uri ? ' ' + this.uri : ''); 1.14356 + }; 1.14357 + Namespace.prototype.clone = function () { 1.14358 + var ns = Object.create(Namespace.prototype); 1.14359 + ns.kind = this.kind; 1.14360 + ns.uri = this.uri; 1.14361 + ns.prefix = this.prefix; 1.14362 + ns.qualifiedName = this.qualifiedName; 1.14363 + return ns; 1.14364 + }; 1.14365 + Namespace.prototype.isEqualTo = function (other) { 1.14366 + return this.qualifiedName === other.qualifiedName; 1.14367 + }; 1.14368 + Namespace.prototype.inNamespaceSet = function (set) { 1.14369 + for (var i = 0; i < set.length; i++) { 1.14370 + if (set[i].qualifiedName === this.qualifiedName) { 1.14371 + return true; 1.14372 + } 1.14373 + } 1.14374 + return false; 1.14375 + }; 1.14376 + Namespace.prototype.getAccessModifier = function () { 1.14377 + return Namespace._kinds[this.kind]; 1.14378 + }; 1.14379 + Namespace.prototype.getQualifiedName = function () { 1.14380 + return this.qualifiedName; 1.14381 + }; 1.14382 + Namespace.fromSimpleName = function (simpleName) { 1.14383 + if (simpleName in Namespace._simpleNameCache) { 1.14384 + return Namespace._simpleNameCache[simpleName]; 1.14385 + } 1.14386 + var namespaceNames; 1.14387 + if (simpleName.indexOf('[') === 0) { 1.14388 + true; 1.14389 + namespaceNames = simpleName.substring(1, simpleName.length - 1).split(','); 1.14390 + } else { 1.14391 + namespaceNames = [ 1.14392 + simpleName 1.14393 + ]; 1.14394 + } 1.14395 + return Namespace._simpleNameCache[simpleName] = namespaceNames.map(function (name) { 1.14396 + name = name.trim(); 1.14397 + var kindName, uri; 1.14398 + if (name.indexOf(' ') > 0) { 1.14399 + kindName = name.substring(0, name.indexOf(' ')).trim(); 1.14400 + uri = name.substring(name.indexOf(' ') + 1).trim(); 1.14401 + } else { 1.14402 + var kinds = Namespace._kinds; 1.14403 + if (name === kinds[8] || name === kinds[23] || name === kinds[5] || name === kinds[24] || name === kinds[25] || name === kinds[26]) { 1.14404 + kindName = name; 1.14405 + uri = ''; 1.14406 + } else { 1.14407 + kindName = Namespace._publicPrefix; 1.14408 + uri = name; 1.14409 + } 1.14410 + } 1.14411 + return new Namespace(Namespace.kindFromString(kindName), uri); 1.14412 + }); 1.14413 + }; 1.14414 + Namespace._publicPrefix = 'public'; 1.14415 + Namespace._kinds = function () { 1.14416 + var map = Shumway.ObjectUtilities.createMap(); 1.14417 + map[8] = Namespace._publicPrefix; 1.14418 + map[23] = 'packageInternal'; 1.14419 + map[5] = 'private'; 1.14420 + map[24] = 'protected'; 1.14421 + map[25] = 'explicit'; 1.14422 + map[26] = 'staticProtected'; 1.14423 + return map; 1.14424 + }(); 1.14425 + Namespace._MIN_API_MARK = 58004; 1.14426 + Namespace._MAX_API_MARK = 63743; 1.14427 + Namespace._knownURIs = [ 1.14428 + '' 1.14429 + ]; 1.14430 + Namespace._mangledNamespaceCache = Shumway.ObjectUtilities.createMap(); 1.14431 + Namespace._mangledNamespaceMap = Shumway.ObjectUtilities.createMap(); 1.14432 + Namespace.PUBLIC = new Namespace(8); 1.14433 + Namespace.PROTECTED = new Namespace(24); 1.14434 + Namespace.PROXY = new Namespace(8, 'http://www.adobe.com/2006/actionscript/flash/proxy'); 1.14435 + Namespace._simpleNameCache = Shumway.ObjectUtilities.createMap(); 1.14436 + return Namespace; 1.14437 + }(); 1.14438 + ABC.Namespace = Namespace; 1.14439 + var Multiname = function () { 1.14440 + function Multiname(namespaces, name, flags) { 1.14441 + if (typeof flags === 'undefined') { 1.14442 + flags = 0; 1.14443 + } 1.14444 + if (name !== undefined) { 1.14445 + true; 1.14446 + } 1.14447 + this.runtimeId = Multiname._nextID++; 1.14448 + this.namespaces = namespaces; 1.14449 + this.name = name; 1.14450 + this.flags = flags; 1.14451 + } 1.14452 + Multiname.parse = function (constantPool, stream, multinames, patchFactoryTypes) { 1.14453 + var index = 0; 1.14454 + var kind = stream.readU8(); 1.14455 + var name, namespaces = [], flags = 0; 1.14456 + switch (kind) { 1.14457 + case 7: 1.14458 + case 13: 1.14459 + index = stream.readU30(); 1.14460 + if (index) { 1.14461 + namespaces = [ 1.14462 + constantPool.namespaces[index] 1.14463 + ]; 1.14464 + } else { 1.14465 + flags &= ~Multiname.RUNTIME_NAME; 1.14466 + } 1.14467 + index = stream.readU30(); 1.14468 + if (index) { 1.14469 + name = constantPool.strings[index]; 1.14470 + } 1.14471 + break; 1.14472 + case 15: 1.14473 + case 16: 1.14474 + index = stream.readU30(); 1.14475 + if (index) { 1.14476 + name = constantPool.strings[index]; 1.14477 + } else { 1.14478 + flags &= ~Multiname.RUNTIME_NAME; 1.14479 + } 1.14480 + flags |= Multiname.RUNTIME_NAMESPACE; 1.14481 + break; 1.14482 + case 17: 1.14483 + case 18: 1.14484 + flags |= Multiname.RUNTIME_NAMESPACE; 1.14485 + flags |= Multiname.RUNTIME_NAME; 1.14486 + break; 1.14487 + case 9: 1.14488 + case 14: 1.14489 + index = stream.readU30(); 1.14490 + if (index) { 1.14491 + name = constantPool.strings[index]; 1.14492 + } else { 1.14493 + flags &= ~Multiname.RUNTIME_NAME; 1.14494 + } 1.14495 + index = stream.readU30(); 1.14496 + true; 1.14497 + namespaces = constantPool.namespaceSets[index]; 1.14498 + break; 1.14499 + case 27: 1.14500 + case 28: 1.14501 + flags |= Multiname.RUNTIME_NAME; 1.14502 + index = stream.readU30(); 1.14503 + true; 1.14504 + namespaces = constantPool.namespaceSets[index]; 1.14505 + break; 1.14506 + case 29: 1.14507 + var factoryTypeIndex = stream.readU32(); 1.14508 + if (multinames[factoryTypeIndex]) { 1.14509 + namespaces = multinames[factoryTypeIndex].namespaces; 1.14510 + name = multinames[factoryTypeIndex].name; 1.14511 + } 1.14512 + var typeParameterCount = stream.readU32(); 1.14513 + true; 1.14514 + var typeParameterIndex = stream.readU32(); 1.14515 + true; 1.14516 + var mn = new Multiname(namespaces, name, flags); 1.14517 + mn.typeParameter = multinames[typeParameterIndex]; 1.14518 + if (!multinames[factoryTypeIndex]) { 1.14519 + patchFactoryTypes.push({ 1.14520 + multiname: mn, 1.14521 + index: factoryTypeIndex 1.14522 + }); 1.14523 + } 1.14524 + return mn; 1.14525 + default: 1.14526 + Shumway.Debug.unexpected(); 1.14527 + break; 1.14528 + } 1.14529 + switch (kind) { 1.14530 + case 13: 1.14531 + case 16: 1.14532 + case 18: 1.14533 + case 14: 1.14534 + case 28: 1.14535 + flags |= Multiname.ATTRIBUTE; 1.14536 + break; 1.14537 + } 1.14538 + return new Multiname(namespaces, name, flags); 1.14539 + }; 1.14540 + Multiname.isMultiname = function (mn) { 1.14541 + return typeof mn === 'number' || typeof mn === 'string' || mn instanceof Multiname || mn instanceof Number; 1.14542 + }; 1.14543 + Multiname.needsResolution = function (mn) { 1.14544 + return mn instanceof Multiname && mn.namespaces.length > 1; 1.14545 + }; 1.14546 + Multiname.isQName = function (mn) { 1.14547 + if (mn instanceof Multiname) { 1.14548 + return mn.namespaces && mn.namespaces.length === 1; 1.14549 + } 1.14550 + return true; 1.14551 + }; 1.14552 + Multiname.isRuntimeName = function (mn) { 1.14553 + return mn instanceof Multiname && mn.isRuntimeName(); 1.14554 + }; 1.14555 + Multiname.isRuntimeNamespace = function (mn) { 1.14556 + return mn instanceof Multiname && mn.isRuntimeNamespace(); 1.14557 + }; 1.14558 + Multiname.isRuntime = function (mn) { 1.14559 + return mn instanceof Multiname && mn.isRuntimeName() || mn.isRuntimeNamespace(); 1.14560 + }; 1.14561 + Multiname.getQualifiedName = function (mn) { 1.14562 + true; 1.14563 + if (mn instanceof Multiname) { 1.14564 + if (mn.qualifiedName !== undefined) { 1.14565 + return mn.qualifiedName; 1.14566 + } 1.14567 + var name = String(mn.name); 1.14568 + if (isNumeric(name) && mn.namespaces[0].isPublic()) { 1.14569 + return mn.qualifiedName = name; 1.14570 + } 1.14571 + mn = mn.qualifiedName = Multiname.qualifyName(mn.namespaces[0], name); 1.14572 + } 1.14573 + return mn; 1.14574 + }; 1.14575 + Multiname.qualifyName = function (namespace, name) { 1.14576 + return '$' + namespace.qualifiedName + name; 1.14577 + }; 1.14578 + Multiname.stripPublicQualifier = function (qn) { 1.14579 + var publicQualifier = '$' + Namespace.PUBLIC.qualifiedName; 1.14580 + var index = qn.indexOf(publicQualifier); 1.14581 + if (index !== 0) { 1.14582 + return undefined; 1.14583 + } 1.14584 + return qn.substring(publicQualifier.length); 1.14585 + }; 1.14586 + Multiname.fromQualifiedName = function (qn) { 1.14587 + if (qn instanceof Multiname) { 1.14588 + return qn; 1.14589 + } 1.14590 + if (isNumeric(qn)) { 1.14591 + return new Multiname([ 1.14592 + Namespace.PUBLIC 1.14593 + ], qn); 1.14594 + } 1.14595 + if (qn[0] !== '$') { 1.14596 + return; 1.14597 + } 1.14598 + var ns = Namespace.fromQualifiedName(qn.substring(1)); 1.14599 + return new Multiname([ 1.14600 + ns 1.14601 + ], qn.substring(1 + ns.qualifiedName.length)); 1.14602 + }; 1.14603 + Multiname.getNameFromPublicQualifiedName = function (qn) { 1.14604 + var mn = Multiname.fromQualifiedName(qn); 1.14605 + true; 1.14606 + return mn.name; 1.14607 + }; 1.14608 + Multiname.getFullQualifiedName = function (mn) { 1.14609 + var qn = Multiname.getQualifiedName(mn); 1.14610 + if (mn instanceof Multiname && mn.typeParameter) { 1.14611 + qn += '$' + Multiname.getFullQualifiedName(mn.typeParameter); 1.14612 + } 1.14613 + return qn; 1.14614 + }; 1.14615 + Multiname.getPublicQualifiedName = function (name) { 1.14616 + if (isNumeric(name)) { 1.14617 + return Shumway.toNumber(name); 1.14618 + } else if (name !== null && isObject(name)) { 1.14619 + return name; 1.14620 + } 1.14621 + return Multiname.qualifyName(Namespace.PUBLIC, name); 1.14622 + }; 1.14623 + Multiname.isPublicQualifiedName = function (qn) { 1.14624 + return typeof qn === 'number' || isNumeric(qn) || qn.indexOf(Namespace.PUBLIC.qualifiedName) === 1; 1.14625 + }; 1.14626 + Multiname.getAccessModifier = function (mn) { 1.14627 + true; 1.14628 + if (typeof mn === 'number' || typeof mn === 'string' || mn instanceof Number) { 1.14629 + return 'public'; 1.14630 + } 1.14631 + true; 1.14632 + return mn.namespaces[0].getAccessModifier(); 1.14633 + }; 1.14634 + Multiname.isNumeric = function (mn) { 1.14635 + if (typeof mn === 'number') { 1.14636 + return true; 1.14637 + } else if (typeof mn === 'string') { 1.14638 + return isNumeric(mn); 1.14639 + } 1.14640 + return !isNaN(parseInt(Multiname.getName(mn), 10)); 1.14641 + }; 1.14642 + Multiname.getName = function (mn) { 1.14643 + true; 1.14644 + true; 1.14645 + return mn.getName(); 1.14646 + }; 1.14647 + Multiname.isAnyName = function (mn) { 1.14648 + return typeof mn === 'object' && !mn.isRuntimeName() && !mn.name; 1.14649 + }; 1.14650 + Multiname.fromSimpleName = function (simpleName) { 1.14651 + true; 1.14652 + if (simpleName in Multiname._simpleNameCache) { 1.14653 + return Multiname._simpleNameCache[simpleName]; 1.14654 + } 1.14655 + var nameIndex, namespaceIndex, name, namespace; 1.14656 + nameIndex = simpleName.lastIndexOf('.'); 1.14657 + if (nameIndex <= 0) { 1.14658 + nameIndex = simpleName.lastIndexOf(' '); 1.14659 + } 1.14660 + if (nameIndex > 0 && nameIndex < simpleName.length - 1) { 1.14661 + name = simpleName.substring(nameIndex + 1).trim(); 1.14662 + namespace = simpleName.substring(0, nameIndex).trim(); 1.14663 + } else { 1.14664 + name = simpleName; 1.14665 + namespace = ''; 1.14666 + } 1.14667 + return Multiname._simpleNameCache[simpleName] = new Multiname(Namespace.fromSimpleName(namespace), name); 1.14668 + }; 1.14669 + Multiname.prototype.getQName = function (index) { 1.14670 + true; 1.14671 + if (!this._qualifiedNameCache) { 1.14672 + this._qualifiedNameCache = Shumway.ObjectUtilities.createArrayMap(); 1.14673 + } 1.14674 + var name = this._qualifiedNameCache[index]; 1.14675 + if (!name) { 1.14676 + name = this._qualifiedNameCache[index] = new Multiname([ 1.14677 + this.namespaces[index] 1.14678 + ], this.name, this.flags); 1.14679 + } 1.14680 + return name; 1.14681 + }; 1.14682 + Multiname.prototype.hasQName = function (qn) { 1.14683 + true; 1.14684 + if (this.name !== qn.name) { 1.14685 + return false; 1.14686 + } 1.14687 + for (var i = 0; i < this.namespaces.length; i++) { 1.14688 + if (this.namespaces[i].isEqualTo(qn.namespaces[0])) { 1.14689 + return true; 1.14690 + } 1.14691 + } 1.14692 + return false; 1.14693 + }; 1.14694 + Multiname.prototype.isAttribute = function () { 1.14695 + return this.flags & Multiname.ATTRIBUTE; 1.14696 + }; 1.14697 + Multiname.prototype.isAnyName = function () { 1.14698 + return Multiname.isAnyName(this); 1.14699 + }; 1.14700 + Multiname.prototype.isAnyNamespace = function () { 1.14701 + return !this.isRuntimeNamespace() && (this.namespaces.length === 0 || this.isAnyName() && this.namespaces.length !== 1); 1.14702 + }; 1.14703 + Multiname.prototype.isRuntimeName = function () { 1.14704 + return !(!(this.flags & Multiname.RUNTIME_NAME)); 1.14705 + }; 1.14706 + Multiname.prototype.isRuntimeNamespace = function () { 1.14707 + return !(!(this.flags & Multiname.RUNTIME_NAMESPACE)); 1.14708 + }; 1.14709 + Multiname.prototype.isRuntime = function () { 1.14710 + return !(!(this.flags & (Multiname.RUNTIME_NAME | Multiname.RUNTIME_NAMESPACE))); 1.14711 + }; 1.14712 + Multiname.prototype.isQName = function () { 1.14713 + return this.namespaces.length === 1 && !this.isAnyName(); 1.14714 + }; 1.14715 + Multiname.prototype.hasTypeParameter = function () { 1.14716 + return !(!this.typeParameter); 1.14717 + }; 1.14718 + Multiname.prototype.getName = function () { 1.14719 + return this.name; 1.14720 + }; 1.14721 + Multiname.prototype.getOriginalName = function () { 1.14722 + true; 1.14723 + var name = this.namespaces[0].uri; 1.14724 + if (name) { 1.14725 + name += '.'; 1.14726 + } 1.14727 + return name + this.name; 1.14728 + }; 1.14729 + Multiname.prototype.getNamespace = function () { 1.14730 + true; 1.14731 + true; 1.14732 + return this.namespaces[0]; 1.14733 + }; 1.14734 + Multiname.prototype.nameToString = function () { 1.14735 + if (this.isAnyName()) { 1.14736 + return '*'; 1.14737 + } else { 1.14738 + var name = this.getName(); 1.14739 + return this.isRuntimeName() ? '[]' : name; 1.14740 + } 1.14741 + }; 1.14742 + Multiname.prototype.hasObjectName = function () { 1.14743 + return typeof this.name === 'object'; 1.14744 + }; 1.14745 + Multiname.prototype.toString = function () { 1.14746 + var str = this.isAttribute() ? '@' : ''; 1.14747 + if (this.isAnyNamespace()) { 1.14748 + str += '*::' + this.nameToString(); 1.14749 + } else if (this.isRuntimeNamespace()) { 1.14750 + str += '[]::' + this.nameToString(); 1.14751 + } else if (this.namespaces.length === 1 && this.isQName()) { 1.14752 + str += this.namespaces[0].toString() + '::'; 1.14753 + str += this.nameToString(); 1.14754 + } else { 1.14755 + str += '{'; 1.14756 + for (var i = 0, count = this.namespaces.length; i < count; i++) { 1.14757 + str += this.namespaces[i].toString(); 1.14758 + if (i + 1 < count) { 1.14759 + str += ','; 1.14760 + } 1.14761 + } 1.14762 + str += '}::' + this.nameToString(); 1.14763 + } 1.14764 + if (this.hasTypeParameter()) { 1.14765 + str += '<' + this.typeParameter.toString() + '>'; 1.14766 + } 1.14767 + return str; 1.14768 + }; 1.14769 + Multiname.ATTRIBUTE = 1; 1.14770 + Multiname.RUNTIME_NAMESPACE = 2; 1.14771 + Multiname.RUNTIME_NAME = 4; 1.14772 + Multiname._nextID = 0; 1.14773 + Multiname._simpleNameCache = Shumway.ObjectUtilities.createMap(); 1.14774 + Multiname.Int = Multiname.getPublicQualifiedName('int'); 1.14775 + Multiname.Uint = Multiname.getPublicQualifiedName('uint'); 1.14776 + Multiname.Class = Multiname.getPublicQualifiedName('Class'); 1.14777 + Multiname.Array = Multiname.getPublicQualifiedName('Array'); 1.14778 + Multiname.Object = Multiname.getPublicQualifiedName('Object'); 1.14779 + Multiname.String = Multiname.getPublicQualifiedName('String'); 1.14780 + Multiname.Number = Multiname.getPublicQualifiedName('Number'); 1.14781 + Multiname.Boolean = Multiname.getPublicQualifiedName('Boolean'); 1.14782 + Multiname.Function = Multiname.getPublicQualifiedName('Function'); 1.14783 + Multiname.XML = Multiname.getPublicQualifiedName('XML'); 1.14784 + Multiname.XMLList = Multiname.getPublicQualifiedName('XMLList'); 1.14785 + Multiname.TEMPORARY = new Multiname([], ''); 1.14786 + return Multiname; 1.14787 + }(); 1.14788 + ABC.Multiname = Multiname; 1.14789 + var MetaDataInfo = function () { 1.14790 + function MetaDataInfo(abc, stream) { 1.14791 + var strings = abc.constantPool.strings; 1.14792 + var name = this.name = strings[stream.readU30()]; 1.14793 + var itemCount = stream.readU30(); 1.14794 + var keys = []; 1.14795 + var items = []; 1.14796 + for (var i = 0; i < itemCount; i++) { 1.14797 + keys[i] = strings[stream.readU30()]; 1.14798 + } 1.14799 + for (var i = 0; i < itemCount; i++) { 1.14800 + var key = keys[i]; 1.14801 + items[i] = { 1.14802 + key: key, 1.14803 + value: strings[stream.readU30()] 1.14804 + }; 1.14805 + if (key && name === 'native') { 1.14806 + true; 1.14807 + this[key] = items[i].value; 1.14808 + } 1.14809 + } 1.14810 + this.value = items; 1.14811 + } 1.14812 + MetaDataInfo.prototype.toString = function () { 1.14813 + return '[' + this.name + ']'; 1.14814 + }; 1.14815 + return MetaDataInfo; 1.14816 + }(); 1.14817 + ABC.MetaDataInfo = MetaDataInfo; 1.14818 + (function (CONSTANT) { 1.14819 + CONSTANT[CONSTANT['Undefined'] = 0] = 'Undefined'; 1.14820 + CONSTANT[CONSTANT['Utf8'] = 1] = 'Utf8'; 1.14821 + CONSTANT[CONSTANT['Float'] = 2] = 'Float'; 1.14822 + CONSTANT[CONSTANT['Int'] = 3] = 'Int'; 1.14823 + CONSTANT[CONSTANT['UInt'] = 4] = 'UInt'; 1.14824 + CONSTANT[CONSTANT['PrivateNs'] = 5] = 'PrivateNs'; 1.14825 + CONSTANT[CONSTANT['Double'] = 6] = 'Double'; 1.14826 + CONSTANT[CONSTANT['QName'] = 7] = 'QName'; 1.14827 + CONSTANT[CONSTANT['Namespace'] = 8] = 'Namespace'; 1.14828 + CONSTANT[CONSTANT['Multiname'] = 9] = 'Multiname'; 1.14829 + CONSTANT[CONSTANT['False'] = 10] = 'False'; 1.14830 + CONSTANT[CONSTANT['True'] = 11] = 'True'; 1.14831 + CONSTANT[CONSTANT['Null'] = 12] = 'Null'; 1.14832 + CONSTANT[CONSTANT['QNameA'] = 13] = 'QNameA'; 1.14833 + CONSTANT[CONSTANT['MultinameA'] = 14] = 'MultinameA'; 1.14834 + CONSTANT[CONSTANT['RTQName'] = 15] = 'RTQName'; 1.14835 + CONSTANT[CONSTANT['RTQNameA'] = 16] = 'RTQNameA'; 1.14836 + CONSTANT[CONSTANT['RTQNameL'] = 17] = 'RTQNameL'; 1.14837 + CONSTANT[CONSTANT['RTQNameLA'] = 18] = 'RTQNameLA'; 1.14838 + CONSTANT[CONSTANT['NameL'] = 19] = 'NameL'; 1.14839 + CONSTANT[CONSTANT['NameLA'] = 20] = 'NameLA'; 1.14840 + CONSTANT[CONSTANT['NamespaceSet'] = 21] = 'NamespaceSet'; 1.14841 + CONSTANT[CONSTANT['PackageNamespace'] = 22] = 'PackageNamespace'; 1.14842 + CONSTANT[CONSTANT['PackageInternalNs'] = 23] = 'PackageInternalNs'; 1.14843 + CONSTANT[CONSTANT['ProtectedNamespace'] = 24] = 'ProtectedNamespace'; 1.14844 + CONSTANT[CONSTANT['ExplicitNamespace'] = 25] = 'ExplicitNamespace'; 1.14845 + CONSTANT[CONSTANT['StaticProtectedNs'] = 26] = 'StaticProtectedNs'; 1.14846 + CONSTANT[CONSTANT['MultinameL'] = 27] = 'MultinameL'; 1.14847 + CONSTANT[CONSTANT['MultinameLA'] = 28] = 'MultinameLA'; 1.14848 + CONSTANT[CONSTANT['TypeName'] = 29] = 'TypeName'; 1.14849 + CONSTANT[CONSTANT['ClassSealed'] = 1] = 'ClassSealed'; 1.14850 + CONSTANT[CONSTANT['ClassFinal'] = 2] = 'ClassFinal'; 1.14851 + CONSTANT[CONSTANT['ClassInterface'] = 4] = 'ClassInterface'; 1.14852 + CONSTANT[CONSTANT['ClassProtectedNs'] = 8] = 'ClassProtectedNs'; 1.14853 + }(ABC.CONSTANT || (ABC.CONSTANT = {}))); 1.14854 + var CONSTANT = ABC.CONSTANT; 1.14855 + (function (METHOD) { 1.14856 + METHOD[METHOD['Arguments'] = 1] = 'Arguments'; 1.14857 + METHOD[METHOD['Activation'] = 2] = 'Activation'; 1.14858 + METHOD[METHOD['Needrest'] = 4] = 'Needrest'; 1.14859 + METHOD[METHOD['HasOptional'] = 8] = 'HasOptional'; 1.14860 + METHOD[METHOD['IgnoreRest'] = 16] = 'IgnoreRest'; 1.14861 + METHOD[METHOD['Native'] = 32] = 'Native'; 1.14862 + METHOD[METHOD['Setsdxns'] = 64] = 'Setsdxns'; 1.14863 + METHOD[METHOD['HasParamNames'] = 128] = 'HasParamNames'; 1.14864 + }(ABC.METHOD || (ABC.METHOD = {}))); 1.14865 + var METHOD = ABC.METHOD; 1.14866 + (function (TRAIT) { 1.14867 + TRAIT[TRAIT['Slot'] = 0] = 'Slot'; 1.14868 + TRAIT[TRAIT['Method'] = 1] = 'Method'; 1.14869 + TRAIT[TRAIT['Getter'] = 2] = 'Getter'; 1.14870 + TRAIT[TRAIT['Setter'] = 3] = 'Setter'; 1.14871 + TRAIT[TRAIT['Class'] = 4] = 'Class'; 1.14872 + TRAIT[TRAIT['Function'] = 5] = 'Function'; 1.14873 + TRAIT[TRAIT['Const'] = 6] = 'Const'; 1.14874 + }(ABC.TRAIT || (ABC.TRAIT = {}))); 1.14875 + var TRAIT = ABC.TRAIT; 1.14876 + (function (ATTR) { 1.14877 + ATTR[ATTR['Final'] = 1] = 'Final'; 1.14878 + ATTR[ATTR['Override'] = 2] = 'Override'; 1.14879 + ATTR[ATTR['Metadata'] = 4] = 'Metadata'; 1.14880 + }(ABC.ATTR || (ABC.ATTR = {}))); 1.14881 + var ATTR = ABC.ATTR; 1.14882 + (function (SORT) { 1.14883 + SORT[SORT['CASEINSENSITIVE'] = 1] = 'CASEINSENSITIVE'; 1.14884 + SORT[SORT['DESCENDING'] = 2] = 'DESCENDING'; 1.14885 + SORT[SORT['UNIQUESORT'] = 4] = 'UNIQUESORT'; 1.14886 + SORT[SORT['RETURNINDEXEDARRAY'] = 8] = 'RETURNINDEXEDARRAY'; 1.14887 + SORT[SORT['NUMERIC'] = 16] = 'NUMERIC'; 1.14888 + }(ABC.SORT || (ABC.SORT = {}))); 1.14889 + var SORT = ABC.SORT; 1.14890 + (function (OP) { 1.14891 + OP[OP['bkpt'] = 1] = 'bkpt'; 1.14892 + OP[OP['nop'] = 2] = 'nop'; 1.14893 + OP[OP['throw'] = 3] = 'throw'; 1.14894 + OP[OP['getsuper'] = 4] = 'getsuper'; 1.14895 + OP[OP['setsuper'] = 5] = 'setsuper'; 1.14896 + OP[OP['dxns'] = 6] = 'dxns'; 1.14897 + OP[OP['dxnslate'] = 7] = 'dxnslate'; 1.14898 + OP[OP['kill'] = 8] = 'kill'; 1.14899 + OP[OP['label'] = 9] = 'label'; 1.14900 + OP[OP['lf32x4'] = 10] = 'lf32x4'; 1.14901 + OP[OP['sf32x4'] = 11] = 'sf32x4'; 1.14902 + OP[OP['ifnlt'] = 12] = 'ifnlt'; 1.14903 + OP[OP['ifnle'] = 13] = 'ifnle'; 1.14904 + OP[OP['ifngt'] = 14] = 'ifngt'; 1.14905 + OP[OP['ifnge'] = 15] = 'ifnge'; 1.14906 + OP[OP['jump'] = 16] = 'jump'; 1.14907 + OP[OP['iftrue'] = 17] = 'iftrue'; 1.14908 + OP[OP['iffalse'] = 18] = 'iffalse'; 1.14909 + OP[OP['ifeq'] = 19] = 'ifeq'; 1.14910 + OP[OP['ifne'] = 20] = 'ifne'; 1.14911 + OP[OP['iflt'] = 21] = 'iflt'; 1.14912 + OP[OP['ifle'] = 22] = 'ifle'; 1.14913 + OP[OP['ifgt'] = 23] = 'ifgt'; 1.14914 + OP[OP['ifge'] = 24] = 'ifge'; 1.14915 + OP[OP['ifstricteq'] = 25] = 'ifstricteq'; 1.14916 + OP[OP['ifstrictne'] = 26] = 'ifstrictne'; 1.14917 + OP[OP['lookupswitch'] = 27] = 'lookupswitch'; 1.14918 + OP[OP['pushwith'] = 28] = 'pushwith'; 1.14919 + OP[OP['popscope'] = 29] = 'popscope'; 1.14920 + OP[OP['nextname'] = 30] = 'nextname'; 1.14921 + OP[OP['hasnext'] = 31] = 'hasnext'; 1.14922 + OP[OP['pushnull'] = 32] = 'pushnull'; 1.14923 + OP[OP['c'] = 33] = 'c'; 1.14924 + OP[OP['pushundefined'] = 33] = 'pushundefined'; 1.14925 + OP[OP['pushfloat'] = 34] = 'pushfloat'; 1.14926 + OP[OP['nextvalue'] = 35] = 'nextvalue'; 1.14927 + OP[OP['pushbyte'] = 36] = 'pushbyte'; 1.14928 + OP[OP['pushshort'] = 37] = 'pushshort'; 1.14929 + OP[OP['pushtrue'] = 38] = 'pushtrue'; 1.14930 + OP[OP['pushfalse'] = 39] = 'pushfalse'; 1.14931 + OP[OP['pushnan'] = 40] = 'pushnan'; 1.14932 + OP[OP['pop'] = 41] = 'pop'; 1.14933 + OP[OP['dup'] = 42] = 'dup'; 1.14934 + OP[OP['swap'] = 43] = 'swap'; 1.14935 + OP[OP['pushstring'] = 44] = 'pushstring'; 1.14936 + OP[OP['pushint'] = 45] = 'pushint'; 1.14937 + OP[OP['pushuint'] = 46] = 'pushuint'; 1.14938 + OP[OP['pushdouble'] = 47] = 'pushdouble'; 1.14939 + OP[OP['pushscope'] = 48] = 'pushscope'; 1.14940 + OP[OP['pushnamespace'] = 49] = 'pushnamespace'; 1.14941 + OP[OP['hasnext2'] = 50] = 'hasnext2'; 1.14942 + OP[OP['li8'] = 53] = 'li8'; 1.14943 + OP[OP['li16'] = 54] = 'li16'; 1.14944 + OP[OP['li32'] = 55] = 'li32'; 1.14945 + OP[OP['lf32'] = 56] = 'lf32'; 1.14946 + OP[OP['lf64'] = 57] = 'lf64'; 1.14947 + OP[OP['si8'] = 58] = 'si8'; 1.14948 + OP[OP['si16'] = 59] = 'si16'; 1.14949 + OP[OP['si32'] = 60] = 'si32'; 1.14950 + OP[OP['sf32'] = 61] = 'sf32'; 1.14951 + OP[OP['sf64'] = 62] = 'sf64'; 1.14952 + OP[OP['newfunction'] = 64] = 'newfunction'; 1.14953 + OP[OP['call'] = 65] = 'call'; 1.14954 + OP[OP['construct'] = 66] = 'construct'; 1.14955 + OP[OP['callmethod'] = 67] = 'callmethod'; 1.14956 + OP[OP['callstatic'] = 68] = 'callstatic'; 1.14957 + OP[OP['callsuper'] = 69] = 'callsuper'; 1.14958 + OP[OP['callproperty'] = 70] = 'callproperty'; 1.14959 + OP[OP['returnvoid'] = 71] = 'returnvoid'; 1.14960 + OP[OP['returnvalue'] = 72] = 'returnvalue'; 1.14961 + OP[OP['constructsuper'] = 73] = 'constructsuper'; 1.14962 + OP[OP['constructprop'] = 74] = 'constructprop'; 1.14963 + OP[OP['callsuperid'] = 75] = 'callsuperid'; 1.14964 + OP[OP['callproplex'] = 76] = 'callproplex'; 1.14965 + OP[OP['callinterface'] = 77] = 'callinterface'; 1.14966 + OP[OP['callsupervoid'] = 78] = 'callsupervoid'; 1.14967 + OP[OP['callpropvoid'] = 79] = 'callpropvoid'; 1.14968 + OP[OP['sxi1'] = 80] = 'sxi1'; 1.14969 + OP[OP['sxi8'] = 81] = 'sxi8'; 1.14970 + OP[OP['sxi16'] = 82] = 'sxi16'; 1.14971 + OP[OP['applytype'] = 83] = 'applytype'; 1.14972 + OP[OP['pushfloat4'] = 84] = 'pushfloat4'; 1.14973 + OP[OP['newobject'] = 85] = 'newobject'; 1.14974 + OP[OP['newarray'] = 86] = 'newarray'; 1.14975 + OP[OP['newactivation'] = 87] = 'newactivation'; 1.14976 + OP[OP['newclass'] = 88] = 'newclass'; 1.14977 + OP[OP['getdescendants'] = 89] = 'getdescendants'; 1.14978 + OP[OP['newcatch'] = 90] = 'newcatch'; 1.14979 + OP[OP['findpropstrict'] = 93] = 'findpropstrict'; 1.14980 + OP[OP['findproperty'] = 94] = 'findproperty'; 1.14981 + OP[OP['finddef'] = 95] = 'finddef'; 1.14982 + OP[OP['getlex'] = 96] = 'getlex'; 1.14983 + OP[OP['setproperty'] = 97] = 'setproperty'; 1.14984 + OP[OP['getlocal'] = 98] = 'getlocal'; 1.14985 + OP[OP['setlocal'] = 99] = 'setlocal'; 1.14986 + OP[OP['getglobalscope'] = 100] = 'getglobalscope'; 1.14987 + OP[OP['getscopeobject'] = 101] = 'getscopeobject'; 1.14988 + OP[OP['getproperty'] = 102] = 'getproperty'; 1.14989 + OP[OP['getouterscope'] = 103] = 'getouterscope'; 1.14990 + OP[OP['initproperty'] = 104] = 'initproperty'; 1.14991 + OP[OP['setpropertylate'] = 105] = 'setpropertylate'; 1.14992 + OP[OP['deleteproperty'] = 106] = 'deleteproperty'; 1.14993 + OP[OP['deletepropertylate'] = 107] = 'deletepropertylate'; 1.14994 + OP[OP['getslot'] = 108] = 'getslot'; 1.14995 + OP[OP['setslot'] = 109] = 'setslot'; 1.14996 + OP[OP['getglobalslot'] = 110] = 'getglobalslot'; 1.14997 + OP[OP['setglobalslot'] = 111] = 'setglobalslot'; 1.14998 + OP[OP['convert_s'] = 112] = 'convert_s'; 1.14999 + OP[OP['esc_xelem'] = 113] = 'esc_xelem'; 1.15000 + OP[OP['esc_xattr'] = 114] = 'esc_xattr'; 1.15001 + OP[OP['convert_i'] = 115] = 'convert_i'; 1.15002 + OP[OP['convert_u'] = 116] = 'convert_u'; 1.15003 + OP[OP['convert_d'] = 117] = 'convert_d'; 1.15004 + OP[OP['convert_b'] = 118] = 'convert_b'; 1.15005 + OP[OP['convert_o'] = 119] = 'convert_o'; 1.15006 + OP[OP['checkfilter'] = 120] = 'checkfilter'; 1.15007 + OP[OP['convert_f'] = 121] = 'convert_f'; 1.15008 + OP[OP['unplus'] = 122] = 'unplus'; 1.15009 + OP[OP['convert_f4'] = 123] = 'convert_f4'; 1.15010 + OP[OP['coerce'] = 128] = 'coerce'; 1.15011 + OP[OP['coerce_b'] = 129] = 'coerce_b'; 1.15012 + OP[OP['coerce_a'] = 130] = 'coerce_a'; 1.15013 + OP[OP['coerce_i'] = 131] = 'coerce_i'; 1.15014 + OP[OP['coerce_d'] = 132] = 'coerce_d'; 1.15015 + OP[OP['coerce_s'] = 133] = 'coerce_s'; 1.15016 + OP[OP['astype'] = 134] = 'astype'; 1.15017 + OP[OP['astypelate'] = 135] = 'astypelate'; 1.15018 + OP[OP['coerce_u'] = 136] = 'coerce_u'; 1.15019 + OP[OP['coerce_o'] = 137] = 'coerce_o'; 1.15020 + OP[OP['negate'] = 144] = 'negate'; 1.15021 + OP[OP['increment'] = 145] = 'increment'; 1.15022 + OP[OP['inclocal'] = 146] = 'inclocal'; 1.15023 + OP[OP['decrement'] = 147] = 'decrement'; 1.15024 + OP[OP['declocal'] = 148] = 'declocal'; 1.15025 + OP[OP['typeof'] = 149] = 'typeof'; 1.15026 + OP[OP['not'] = 150] = 'not'; 1.15027 + OP[OP['bitnot'] = 151] = 'bitnot'; 1.15028 + OP[OP['add'] = 160] = 'add'; 1.15029 + OP[OP['subtract'] = 161] = 'subtract'; 1.15030 + OP[OP['multiply'] = 162] = 'multiply'; 1.15031 + OP[OP['divide'] = 163] = 'divide'; 1.15032 + OP[OP['modulo'] = 164] = 'modulo'; 1.15033 + OP[OP['lshift'] = 165] = 'lshift'; 1.15034 + OP[OP['rshift'] = 166] = 'rshift'; 1.15035 + OP[OP['urshift'] = 167] = 'urshift'; 1.15036 + OP[OP['bitand'] = 168] = 'bitand'; 1.15037 + OP[OP['bitor'] = 169] = 'bitor'; 1.15038 + OP[OP['bitxor'] = 170] = 'bitxor'; 1.15039 + OP[OP['equals'] = 171] = 'equals'; 1.15040 + OP[OP['strictequals'] = 172] = 'strictequals'; 1.15041 + OP[OP['lessthan'] = 173] = 'lessthan'; 1.15042 + OP[OP['lessequals'] = 174] = 'lessequals'; 1.15043 + OP[OP['greaterthan'] = 175] = 'greaterthan'; 1.15044 + OP[OP['greaterequals'] = 176] = 'greaterequals'; 1.15045 + OP[OP['instanceof'] = 177] = 'instanceof'; 1.15046 + OP[OP['istype'] = 178] = 'istype'; 1.15047 + OP[OP['istypelate'] = 179] = 'istypelate'; 1.15048 + OP[OP['in'] = 180] = 'in'; 1.15049 + OP[OP['increment_i'] = 192] = 'increment_i'; 1.15050 + OP[OP['decrement_i'] = 193] = 'decrement_i'; 1.15051 + OP[OP['inclocal_i'] = 194] = 'inclocal_i'; 1.15052 + OP[OP['declocal_i'] = 195] = 'declocal_i'; 1.15053 + OP[OP['negate_i'] = 196] = 'negate_i'; 1.15054 + OP[OP['add_i'] = 197] = 'add_i'; 1.15055 + OP[OP['subtract_i'] = 198] = 'subtract_i'; 1.15056 + OP[OP['multiply_i'] = 199] = 'multiply_i'; 1.15057 + OP[OP['getlocal0'] = 208] = 'getlocal0'; 1.15058 + OP[OP['getlocal1'] = 209] = 'getlocal1'; 1.15059 + OP[OP['getlocal2'] = 210] = 'getlocal2'; 1.15060 + OP[OP['getlocal3'] = 211] = 'getlocal3'; 1.15061 + OP[OP['setlocal0'] = 212] = 'setlocal0'; 1.15062 + OP[OP['setlocal1'] = 213] = 'setlocal1'; 1.15063 + OP[OP['setlocal2'] = 214] = 'setlocal2'; 1.15064 + OP[OP['setlocal3'] = 215] = 'setlocal3'; 1.15065 + OP[OP['invalid'] = 237] = 'invalid'; 1.15066 + OP[OP['debug'] = 239] = 'debug'; 1.15067 + OP[OP['debugline'] = 240] = 'debugline'; 1.15068 + OP[OP['debugfile'] = 241] = 'debugfile'; 1.15069 + OP[OP['bkptline'] = 242] = 'bkptline'; 1.15070 + OP[OP['timestamp'] = 243] = 'timestamp'; 1.15071 + }(ABC.OP || (ABC.OP = {}))); 1.15072 + var OP = ABC.OP; 1.15073 + var ConstantPool = function () { 1.15074 + function ConstantPool(stream, abc) { 1.15075 + var n; 1.15076 + var ints = [ 1.15077 + 0 1.15078 + ]; 1.15079 + n = stream.readU30(); 1.15080 + for (var i = 1; i < n; ++i) { 1.15081 + ints.push(stream.readS32()); 1.15082 + } 1.15083 + var uints = [ 1.15084 + 0 1.15085 + ]; 1.15086 + n = stream.readU30(); 1.15087 + for (var i = 1; i < n; ++i) { 1.15088 + uints.push(stream.readU32()); 1.15089 + } 1.15090 + var doubles = [ 1.15091 + NaN 1.15092 + ]; 1.15093 + n = stream.readU30(); 1.15094 + for (var i = 1; i < n; ++i) { 1.15095 + doubles.push(stream.readDouble()); 1.15096 + } 1.15097 + Timer.start('Parse Strings'); 1.15098 + var strings = [ 1.15099 + '' 1.15100 + ]; 1.15101 + n = stream.readU30(); 1.15102 + for (var i = 1; i < n; ++i) { 1.15103 + strings.push(stream.readUTFString(stream.readU30())); 1.15104 + } 1.15105 + this.positionAfterUTFStrings = stream.position; 1.15106 + Timer.stop(); 1.15107 + this.ints = ints; 1.15108 + this.uints = uints; 1.15109 + this.doubles = doubles; 1.15110 + this.strings = strings; 1.15111 + Timer.start('Parse Namespaces'); 1.15112 + var namespaces = [ 1.15113 + undefined 1.15114 + ]; 1.15115 + n = stream.readU30(); 1.15116 + for (var i = 1; i < n; ++i) { 1.15117 + namespaces.push(Namespace.parse(this, stream, abc.hash + i)); 1.15118 + } 1.15119 + Timer.stop(); 1.15120 + Timer.start('Parse Namespace Sets'); 1.15121 + var namespaceSets = [ 1.15122 + undefined 1.15123 + ]; 1.15124 + n = stream.readU30(); 1.15125 + for (var i = 1; i < n; ++i) { 1.15126 + var count = stream.readU30(); 1.15127 + var set = []; 1.15128 + set.runtimeId = ConstantPool._nextNamespaceSetID++; 1.15129 + for (var j = 0; j < count; ++j) { 1.15130 + set.push(namespaces[stream.readU30()]); 1.15131 + } 1.15132 + namespaceSets.push(set); 1.15133 + } 1.15134 + Timer.stop(); 1.15135 + this.namespaces = namespaces; 1.15136 + this.namespaceSets = namespaceSets; 1.15137 + Timer.start('Parse Multinames'); 1.15138 + var multinames = [ 1.15139 + undefined 1.15140 + ]; 1.15141 + var patchFactoryTypes = []; 1.15142 + n = stream.readU30(); 1.15143 + for (var i = 1; i < n; ++i) { 1.15144 + multinames.push(Multiname.parse(this, stream, multinames, patchFactoryTypes)); 1.15145 + } 1.15146 + Timer.stop(); 1.15147 + this.multinames = multinames; 1.15148 + } 1.15149 + ConstantPool.prototype.getValue = function (kind, index) { 1.15150 + switch (kind) { 1.15151 + case 3: 1.15152 + return this.ints[index]; 1.15153 + case 4: 1.15154 + return this.uints[index]; 1.15155 + case 6: 1.15156 + return this.doubles[index]; 1.15157 + case 1: 1.15158 + return this.strings[index]; 1.15159 + case 11: 1.15160 + return true; 1.15161 + case 10: 1.15162 + return false; 1.15163 + case 12: 1.15164 + return null; 1.15165 + case 0: 1.15166 + return undefined; 1.15167 + case 8: 1.15168 + case 23: 1.15169 + return this.namespaces[index]; 1.15170 + case 7: 1.15171 + case 14: 1.15172 + case 15: 1.15173 + case 16: 1.15174 + case 17: 1.15175 + case 18: 1.15176 + case 19: 1.15177 + case 20: 1.15178 + return this.multinames[index]; 1.15179 + case 2: 1.15180 + Shumway.Debug.warning('TODO: CONSTANT.Float may be deprecated?'); 1.15181 + break; 1.15182 + default: 1.15183 + true; 1.15184 + } 1.15185 + }; 1.15186 + ConstantPool._nextNamespaceSetID = 1; 1.15187 + return ConstantPool; 1.15188 + }(); 1.15189 + ABC.ConstantPool = ConstantPool; 1.15190 + }(AVM2.ABC || (AVM2.ABC = {}))); 1.15191 + var ABC = AVM2.ABC; 1.15192 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.15193 + var AVM2 = Shumway.AVM2; 1.15194 +}(Shumway || (Shumway = {}))); 1.15195 +var AbcFile = Shumway.AVM2.ABC.AbcFile; 1.15196 +var AbcStream = Shumway.AVM2.ABC.AbcStream; 1.15197 +var ConstantPool = Shumway.AVM2.ABC.ConstantPool; 1.15198 +var ClassInfo = Shumway.AVM2.ABC.ClassInfo; 1.15199 +var MetaDataInfo = Shumway.AVM2.ABC.MetaDataInfo; 1.15200 +var InstanceInfo = Shumway.AVM2.ABC.InstanceInfo; 1.15201 +var ScriptInfo = Shumway.AVM2.ABC.ScriptInfo; 1.15202 +var Trait = Shumway.AVM2.ABC.Trait; 1.15203 +var MethodInfo = Shumway.AVM2.ABC.MethodInfo; 1.15204 +var Multiname = Shumway.AVM2.ABC.Multiname; 1.15205 +var ASNamespace = Shumway.AVM2.ABC.Namespace; 1.15206 +var AbcFile = Shumway.AVM2.ABC.AbcFile; 1.15207 +var AbcStream = Shumway.AVM2.ABC.AbcStream; 1.15208 +var ConstantPool = Shumway.AVM2.ABC.ConstantPool; 1.15209 +var ClassInfo = Shumway.AVM2.ABC.ClassInfo; 1.15210 +var MetaDataInfo = Shumway.AVM2.ABC.MetaDataInfo; 1.15211 +var InstanceInfo = Shumway.AVM2.ABC.InstanceInfo; 1.15212 +var ScriptInfo = Shumway.AVM2.ABC.ScriptInfo; 1.15213 +var Trait = Shumway.AVM2.ABC.Trait; 1.15214 +var MethodInfo = Shumway.AVM2.ABC.MethodInfo; 1.15215 +var Multiname = Shumway.AVM2.ABC.Multiname; 1.15216 +var ASNamespace = Shumway.AVM2.ABC.Namespace; 1.15217 +var Bytecode = function () { 1.15218 + function Bytecode(code) { 1.15219 + var op = code.readU8(); 1.15220 + this.op = op; 1.15221 + this.originalPosition = code.position; 1.15222 + var opdesc = Shumway.AVM2.opcodeTable[op]; 1.15223 + if (!opdesc) { 1.15224 + unexpected('Unknown Op ' + op); 1.15225 + } 1.15226 + this.canThrow = opdesc.canThrow; 1.15227 + var i, n; 1.15228 + switch (op) { 1.15229 + case OP_lookupswitch: 1.15230 + var defaultOffset = code.readS24(); 1.15231 + this.offsets = []; 1.15232 + var n = code.readU30() + 1; 1.15233 + for (i = 0; i < n; i++) { 1.15234 + this.offsets.push(code.readS24()); 1.15235 + } 1.15236 + this.offsets.push(defaultOffset); 1.15237 + break; 1.15238 + default: 1.15239 + for (i = 0, n = opdesc.operands.length; i < n; i++) { 1.15240 + var operand = opdesc.operands[i]; 1.15241 + switch (operand.size) { 1.15242 + case 'u08': 1.15243 + this[operand.name] = code.readU8(); 1.15244 + break; 1.15245 + case 's08': 1.15246 + this[operand.name] = code.readS8(); 1.15247 + break; 1.15248 + case 's16': 1.15249 + this[operand.name] = code.readS16(); 1.15250 + break; 1.15251 + case 's24': 1.15252 + this[operand.name] = code.readS24(); 1.15253 + break; 1.15254 + case 'u30': 1.15255 + this[operand.name] = code.readU30(); 1.15256 + break; 1.15257 + case 'u32': 1.15258 + this[operand.name] = code.readU32(); 1.15259 + break; 1.15260 + default: 1.15261 + unexpected(); 1.15262 + } 1.15263 + } 1.15264 + } 1.15265 + } 1.15266 + Bytecode.prototype = { 1.15267 + makeBlockHead: function makeBlockHead(id) { 1.15268 + if (this.succs) { 1.15269 + return id; 1.15270 + } 1.15271 + this.bid = id; 1.15272 + this.succs = []; 1.15273 + this.preds = []; 1.15274 + this.dominatees = []; 1.15275 + return id + 1; 1.15276 + }, 1.15277 + trace: function trace(writer) { 1.15278 + if (!this.succs) { 1.15279 + return; 1.15280 + } 1.15281 + writer.writeLn('#' + this.bid); 1.15282 + }, 1.15283 + toString: function toString(abc) { 1.15284 + var opDescription = Shumway.AVM2.opcodeTable[this.op]; 1.15285 + var str = opDescription.name.padRight(' ', 20); 1.15286 + var i, j; 1.15287 + if (this.op === OP_lookupswitch) { 1.15288 + str += 'targets:'; 1.15289 + for (i = 0, j = this.targets.length; i < j; i++) { 1.15290 + str += (i > 0 ? ',' : '') + this.targets[i].position; 1.15291 + } 1.15292 + } else { 1.15293 + for (i = 0, j = opDescription.operands.length; i < j; i++) { 1.15294 + var operand = opDescription.operands[i]; 1.15295 + if (operand.name === 'offset') { 1.15296 + str += 'target:' + this.target.position; 1.15297 + } else { 1.15298 + str += operand.name + ': '; 1.15299 + var value = this[operand.name]; 1.15300 + if (abc) { 1.15301 + switch (operand.type) { 1.15302 + case '': 1.15303 + str += value; 1.15304 + break; 1.15305 + case 'I': 1.15306 + str += abc.constantPool.ints[value]; 1.15307 + break; 1.15308 + case 'U': 1.15309 + str += abc.constantPool.uints[value]; 1.15310 + break; 1.15311 + case 'D': 1.15312 + str += abc.constantPool.doubles[value]; 1.15313 + break; 1.15314 + case 'S': 1.15315 + str += abc.constantPool.strings[value]; 1.15316 + break; 1.15317 + case 'N': 1.15318 + str += abc.constantPool.namespaces[value]; 1.15319 + break; 1.15320 + case 'CI': 1.15321 + str += abc.classes[value]; 1.15322 + break; 1.15323 + case 'M': 1.15324 + str += abc.constantPool.multinames[value]; 1.15325 + break; 1.15326 + default: 1.15327 + str += '?'; 1.15328 + break; 1.15329 + } 1.15330 + } else { 1.15331 + str += value; 1.15332 + } 1.15333 + } 1.15334 + if (i < j - 1) { 1.15335 + str += ', '; 1.15336 + } 1.15337 + } 1.15338 + } 1.15339 + return str; 1.15340 + } 1.15341 + }; 1.15342 + return Bytecode; 1.15343 + }(); 1.15344 +var Analysis = function () { 1.15345 + function blockSetClass(length, blockById) { 1.15346 + var BlockSet = BitSetFunctor(length); 1.15347 + var ADDRESS_BITS_PER_WORD = BlockSet.ADDRESS_BITS_PER_WORD; 1.15348 + var BITS_PER_WORD = BlockSet.BITS_PER_WORD; 1.15349 + var BIT_INDEX_MASK = BlockSet.BIT_INDEX_MASK; 1.15350 + BlockSet.singleton = function singleton(b) { 1.15351 + var bs = new BlockSet(); 1.15352 + bs.set(b.bid); 1.15353 + bs.count = 1; 1.15354 + bs.dirty = 0; 1.15355 + return bs; 1.15356 + }; 1.15357 + BlockSet.fromBlocks = function fromArray(other) { 1.15358 + var bs = new BlockSet(); 1.15359 + bs.setBlocks(other); 1.15360 + return bs; 1.15361 + }; 1.15362 + var Bsp = BlockSet.prototype; 1.15363 + if (BlockSet.singleword) { 1.15364 + Bsp.forEachBlock = function forEach(fn) { 1.15365 + true; 1.15366 + var byId = blockById; 1.15367 + var word = this.bits; 1.15368 + if (word) { 1.15369 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.15370 + if (word & 1 << k) { 1.15371 + fn(byId[k]); 1.15372 + } 1.15373 + } 1.15374 + } 1.15375 + }; 1.15376 + Bsp.choose = function choose() { 1.15377 + var byId = blockById; 1.15378 + var word = this.bits; 1.15379 + if (word) { 1.15380 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.15381 + if (word & 1 << k) { 1.15382 + return byId[k]; 1.15383 + } 1.15384 + } 1.15385 + } 1.15386 + }; 1.15387 + Bsp.members = function members() { 1.15388 + var byId = blockById; 1.15389 + var set = []; 1.15390 + var word = this.bits; 1.15391 + if (word) { 1.15392 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.15393 + if (word & 1 << k) { 1.15394 + set.push(byId[k]); 1.15395 + } 1.15396 + } 1.15397 + } 1.15398 + return set; 1.15399 + }; 1.15400 + Bsp.setBlocks = function setBlocks(bs) { 1.15401 + var bits = this.bits; 1.15402 + for (var i = 0, j = bs.length; i < j; i++) { 1.15403 + var id = bs[i].bid; 1.15404 + bits |= 1 << (id & BIT_INDEX_MASK); 1.15405 + } 1.15406 + this.bits = bits; 1.15407 + }; 1.15408 + } else { 1.15409 + Bsp.forEachBlock = function forEach(fn) { 1.15410 + true; 1.15411 + var byId = blockById; 1.15412 + var bits = this.bits; 1.15413 + for (var i = 0, j = bits.length; i < j; i++) { 1.15414 + var word = bits[i]; 1.15415 + if (word) { 1.15416 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.15417 + if (word & 1 << k) { 1.15418 + fn(byId[i * BITS_PER_WORD + k]); 1.15419 + } 1.15420 + } 1.15421 + } 1.15422 + } 1.15423 + }; 1.15424 + Bsp.choose = function choose() { 1.15425 + var byId = blockById; 1.15426 + var bits = this.bits; 1.15427 + for (var i = 0, j = bits.length; i < j; i++) { 1.15428 + var word = bits[i]; 1.15429 + if (word) { 1.15430 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.15431 + if (word & 1 << k) { 1.15432 + return byId[i * BITS_PER_WORD + k]; 1.15433 + } 1.15434 + } 1.15435 + } 1.15436 + } 1.15437 + }; 1.15438 + Bsp.members = function members() { 1.15439 + var byId = blockById; 1.15440 + var set = []; 1.15441 + var bits = this.bits; 1.15442 + for (var i = 0, j = bits.length; i < j; i++) { 1.15443 + var word = bits[i]; 1.15444 + if (word) { 1.15445 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.15446 + if (word & 1 << k) { 1.15447 + set.push(byId[i * BITS_PER_WORD + k]); 1.15448 + } 1.15449 + } 1.15450 + } 1.15451 + } 1.15452 + return set; 1.15453 + }; 1.15454 + Bsp.setBlocks = function setBlocks(bs) { 1.15455 + var bits = this.bits; 1.15456 + for (var i = 0, j = bs.length; i < j; i++) { 1.15457 + var id = bs[i].bid; 1.15458 + bits[id >> ADDRESS_BITS_PER_WORD] |= 1 << (id & BIT_INDEX_MASK); 1.15459 + } 1.15460 + }; 1.15461 + } 1.15462 + return BlockSet; 1.15463 + } 1.15464 + function Analysis(method) { 1.15465 + Counter.count('Analysis'); 1.15466 + this.method = method; 1.15467 + if (this.method.code) { 1.15468 + Timer.start('Normalize'); 1.15469 + this.normalizeBytecode(); 1.15470 + Timer.stop(); 1.15471 + } 1.15472 + } 1.15473 + Analysis.prototype = { 1.15474 + normalizeBytecode: function normalizeBytecode() { 1.15475 + function getInvalidTarget(cache, offset) { 1.15476 + if (cache && cache[offset]) { 1.15477 + return cache[offset]; 1.15478 + } 1.15479 + var code = Object.create(Bytecode.prototype); 1.15480 + code.op = OP_invalid; 1.15481 + code.position = offset; 1.15482 + cache && (cache[offset] = code); 1.15483 + return code; 1.15484 + } 1.15485 + var method = this.method; 1.15486 + function accessLocal(index) { 1.15487 + if (index-- === 0) 1.15488 + return; 1.15489 + if (index < method.parameters.length) { 1.15490 + method.parameters[index].isUsed = true; 1.15491 + } 1.15492 + } 1.15493 + var bytecodesOffset = []; 1.15494 + var bytecodes = []; 1.15495 + var codeStream = new AbcStream(this.method.code); 1.15496 + var code; 1.15497 + while (codeStream.remaining() > 0) { 1.15498 + var pos = codeStream.position; 1.15499 + code = new Bytecode(codeStream); 1.15500 + switch (code.op) { 1.15501 + case OP_nop: 1.15502 + case OP_label: 1.15503 + bytecodesOffset[pos] = bytecodes.length; 1.15504 + continue; 1.15505 + case OP_lookupswitch: 1.15506 + this.method.hasLookupSwitches = true; 1.15507 + code.targets = []; 1.15508 + var offsets = code.offsets; 1.15509 + for (var i = 0, j = offsets.length; i < j; i++) { 1.15510 + offsets[i] += pos; 1.15511 + } 1.15512 + break; 1.15513 + case OP_jump: 1.15514 + case OP_iflt: 1.15515 + case OP_ifnlt: 1.15516 + case OP_ifle: 1.15517 + case OP_ifnle: 1.15518 + case OP_ifgt: 1.15519 + case OP_ifngt: 1.15520 + case OP_ifge: 1.15521 + case OP_ifnge: 1.15522 + case OP_ifeq: 1.15523 + case OP_ifne: 1.15524 + case OP_ifstricteq: 1.15525 + case OP_ifstrictne: 1.15526 + case OP_iftrue: 1.15527 + case OP_iffalse: 1.15528 + code.offset += codeStream.position; 1.15529 + break; 1.15530 + case OP_getlocal0: 1.15531 + case OP_getlocal1: 1.15532 + case OP_getlocal2: 1.15533 + case OP_getlocal3: 1.15534 + accessLocal(code.op - OP_getlocal0); 1.15535 + break; 1.15536 + case OP_getlocal: 1.15537 + accessLocal(code.index); 1.15538 + break; 1.15539 + default: 1.15540 + break; 1.15541 + } 1.15542 + code.position = bytecodes.length; 1.15543 + bytecodesOffset[pos] = bytecodes.length; 1.15544 + bytecodes.push(code); 1.15545 + } 1.15546 + var invalidJumps = {}; 1.15547 + var newOffset; 1.15548 + for (var pc = 0, end = bytecodes.length; pc < end; pc++) { 1.15549 + code = bytecodes[pc]; 1.15550 + switch (code.op) { 1.15551 + case OP_lookupswitch: 1.15552 + var offsets = code.offsets; 1.15553 + for (var i = 0, j = offsets.length; i < j; i++) { 1.15554 + newOffset = bytecodesOffset[offsets[i]]; 1.15555 + code.targets.push(bytecodes[newOffset] || getInvalidTarget(invalidJumps, offsets[i])); 1.15556 + offsets[i] = newOffset; 1.15557 + } 1.15558 + break; 1.15559 + case OP_jump: 1.15560 + case OP_iflt: 1.15561 + case OP_ifnlt: 1.15562 + case OP_ifle: 1.15563 + case OP_ifnle: 1.15564 + case OP_ifgt: 1.15565 + case OP_ifngt: 1.15566 + case OP_ifge: 1.15567 + case OP_ifnge: 1.15568 + case OP_ifeq: 1.15569 + case OP_ifne: 1.15570 + case OP_ifstricteq: 1.15571 + case OP_ifstrictne: 1.15572 + case OP_iftrue: 1.15573 + case OP_iffalse: 1.15574 + newOffset = bytecodesOffset[code.offset]; 1.15575 + code.target = bytecodes[newOffset] || getInvalidTarget(invalidJumps, code.offset); 1.15576 + code.offset = newOffset; 1.15577 + break; 1.15578 + default: 1.15579 + } 1.15580 + } 1.15581 + this.bytecodes = bytecodes; 1.15582 + var exceptions = this.method.exceptions; 1.15583 + for (var i = 0, j = exceptions.length; i < j; i++) { 1.15584 + var ex = exceptions[i]; 1.15585 + ex.start = bytecodesOffset[ex.start]; 1.15586 + ex.end = bytecodesOffset[ex.end]; 1.15587 + ex.offset = bytecodesOffset[ex.target]; 1.15588 + ex.target = bytecodes[ex.offset]; 1.15589 + ex.target.exception = ex; 1.15590 + } 1.15591 + }, 1.15592 + detectBasicBlocks: function detectBasicBlocks() { 1.15593 + var bytecodes = this.bytecodes; 1.15594 + var exceptions = this.method.exceptions; 1.15595 + var hasExceptions = exceptions.length > 0; 1.15596 + var blockById = {}; 1.15597 + var code; 1.15598 + var pc, end; 1.15599 + var id = 0; 1.15600 + function tryTargets(block) { 1.15601 + var targets = []; 1.15602 + for (var i = 0, j = exceptions.length; i < j; i++) { 1.15603 + var ex = exceptions[i]; 1.15604 + if (block.position >= ex.start && block.end.position <= ex.end) { 1.15605 + targets.push(ex.target); 1.15606 + } 1.15607 + } 1.15608 + return targets; 1.15609 + } 1.15610 + id = bytecodes[0].makeBlockHead(id); 1.15611 + for (pc = 0, end = bytecodes.length - 1; pc < end; pc++) { 1.15612 + code = bytecodes[pc]; 1.15613 + switch (code.op) { 1.15614 + case OP_returnvoid: 1.15615 + case OP_returnvalue: 1.15616 + case OP_throw: 1.15617 + id = bytecodes[pc + 1].makeBlockHead(id); 1.15618 + break; 1.15619 + case OP_lookupswitch: 1.15620 + var targets = code.targets; 1.15621 + for (var i = 0, j = targets.length; i < j; i++) { 1.15622 + id = targets[i].makeBlockHead(id); 1.15623 + } 1.15624 + id = bytecodes[pc + 1].makeBlockHead(id); 1.15625 + break; 1.15626 + case OP_jump: 1.15627 + case OP_iflt: 1.15628 + case OP_ifnlt: 1.15629 + case OP_ifle: 1.15630 + case OP_ifnle: 1.15631 + case OP_ifgt: 1.15632 + case OP_ifngt: 1.15633 + case OP_ifge: 1.15634 + case OP_ifnge: 1.15635 + case OP_ifeq: 1.15636 + case OP_ifne: 1.15637 + case OP_ifstricteq: 1.15638 + case OP_ifstrictne: 1.15639 + case OP_iftrue: 1.15640 + case OP_iffalse: 1.15641 + id = code.target.makeBlockHead(id); 1.15642 + id = bytecodes[pc + 1].makeBlockHead(id); 1.15643 + break; 1.15644 + default: 1.15645 + } 1.15646 + } 1.15647 + code = bytecodes[end]; 1.15648 + switch (code.op) { 1.15649 + case OP_returnvoid: 1.15650 + case OP_returnvalue: 1.15651 + case OP_throw: 1.15652 + break; 1.15653 + case OP_lookupswitch: 1.15654 + var targets = code.targets; 1.15655 + for (var i = 0, j = targets.length; i < j; i++) { 1.15656 + id = targets[i].makeBlockHead(id); 1.15657 + } 1.15658 + break; 1.15659 + case OP_jump: 1.15660 + id = code.target.makeBlockHead(id); 1.15661 + break; 1.15662 + case OP_iflt: 1.15663 + case OP_ifnlt: 1.15664 + case OP_ifle: 1.15665 + case OP_ifnle: 1.15666 + case OP_ifgt: 1.15667 + case OP_ifngt: 1.15668 + case OP_ifge: 1.15669 + case OP_ifnge: 1.15670 + case OP_ifeq: 1.15671 + case OP_ifne: 1.15672 + case OP_ifstricteq: 1.15673 + case OP_ifstrictne: 1.15674 + case OP_iftrue: 1.15675 + case OP_iffalse: 1.15676 + id = code.target.makeBlockHead(id); 1.15677 + bytecodes[pc + 1] = getInvalidTarget(null, pc + 1); 1.15678 + id = bytecodes[pc + 1].makeBlockHead(id); 1.15679 + break; 1.15680 + default: 1.15681 + } 1.15682 + if (hasExceptions) { 1.15683 + for (var i = 0, j = exceptions.length; i < j; i++) { 1.15684 + var ex = exceptions[i]; 1.15685 + var tryStart = bytecodes[ex.start]; 1.15686 + var afterTry = bytecodes[ex.end + 1]; 1.15687 + id = tryStart.makeBlockHead(id); 1.15688 + if (afterTry) { 1.15689 + id = afterTry.makeBlockHead(id); 1.15690 + } 1.15691 + id = ex.target.makeBlockHead(id); 1.15692 + } 1.15693 + } 1.15694 + var currentBlock = bytecodes[0]; 1.15695 + for (pc = 1, end = bytecodes.length; pc < end; pc++) { 1.15696 + if (!bytecodes[pc].succs) { 1.15697 + continue; 1.15698 + } 1.15699 + true; 1.15700 + blockById[currentBlock.bid] = currentBlock; 1.15701 + code = bytecodes[pc - 1]; 1.15702 + currentBlock.end = code; 1.15703 + var nextBlock = bytecodes[pc]; 1.15704 + switch (code.op) { 1.15705 + case OP_returnvoid: 1.15706 + case OP_returnvalue: 1.15707 + case OP_throw: 1.15708 + break; 1.15709 + case OP_lookupswitch: 1.15710 + for (var i = 0, j = code.targets.length; i < j; i++) { 1.15711 + currentBlock.succs.push(code.targets[i]); 1.15712 + } 1.15713 + break; 1.15714 + case OP_jump: 1.15715 + currentBlock.succs.push(code.target); 1.15716 + break; 1.15717 + case OP_iflt: 1.15718 + case OP_ifnlt: 1.15719 + case OP_ifle: 1.15720 + case OP_ifnle: 1.15721 + case OP_ifgt: 1.15722 + case OP_ifngt: 1.15723 + case OP_ifge: 1.15724 + case OP_ifnge: 1.15725 + case OP_ifeq: 1.15726 + case OP_ifne: 1.15727 + case OP_ifstricteq: 1.15728 + case OP_ifstrictne: 1.15729 + case OP_iftrue: 1.15730 + case OP_iffalse: 1.15731 + currentBlock.succs.push(code.target); 1.15732 + if (code.target !== nextBlock) { 1.15733 + currentBlock.succs.push(nextBlock); 1.15734 + } 1.15735 + break; 1.15736 + default: 1.15737 + currentBlock.succs.push(nextBlock); 1.15738 + } 1.15739 + if (hasExceptions) { 1.15740 + var targets = tryTargets(currentBlock); 1.15741 + currentBlock.hasCatches = targets.length > 0; 1.15742 + currentBlock.succs.push.apply(currentBlock.succs, targets); 1.15743 + } 1.15744 + currentBlock = nextBlock; 1.15745 + } 1.15746 + blockById[currentBlock.bid] = currentBlock; 1.15747 + code = bytecodes[end - 1]; 1.15748 + switch (code.op) { 1.15749 + case OP_lookupswitch: 1.15750 + for (var i = 0, j = code.targets.length; i < j; i++) { 1.15751 + currentBlock.succs.push(code.targets[i]); 1.15752 + } 1.15753 + break; 1.15754 + case OP_jump: 1.15755 + currentBlock.succs.push(code.target); 1.15756 + break; 1.15757 + default: 1.15758 + } 1.15759 + currentBlock.end = code; 1.15760 + this.BlockSet = blockSetClass(id, blockById); 1.15761 + }, 1.15762 + normalizeReachableBlocks: function normalizeReachableBlocks() { 1.15763 + var root = this.bytecodes[0]; 1.15764 + true; 1.15765 + var ONCE = 1; 1.15766 + var BUNCH_OF_TIMES = 2; 1.15767 + var BlockSet = this.BlockSet; 1.15768 + var blocks = []; 1.15769 + var visited = {}; 1.15770 + var ancestors = {}; 1.15771 + var worklist = [ 1.15772 + root 1.15773 + ]; 1.15774 + var node; 1.15775 + ancestors[root.bid] = true; 1.15776 + while (node = worklist.top()) { 1.15777 + if (visited[node.bid]) { 1.15778 + if (visited[node.bid] === ONCE) { 1.15779 + visited[node.bid] = BUNCH_OF_TIMES; 1.15780 + blocks.push(node); 1.15781 + var succs = node.succs; 1.15782 + for (var i = 0, j = succs.length; i < j; i++) { 1.15783 + succs[i].preds.push(node); 1.15784 + } 1.15785 + } 1.15786 + ancestors[node.bid] = false; 1.15787 + worklist.pop(); 1.15788 + continue; 1.15789 + } 1.15790 + visited[node.bid] = ONCE; 1.15791 + ancestors[node.bid] = true; 1.15792 + var succs = node.succs; 1.15793 + for (var i = 0, j = succs.length; i < j; i++) { 1.15794 + var s = succs[i]; 1.15795 + if (ancestors[s.bid]) { 1.15796 + if (!node.spbacks) { 1.15797 + node.spbacks = new BlockSet(); 1.15798 + } 1.15799 + node.spbacks.set(s.bid); 1.15800 + } 1.15801 + !visited[s.bid] && worklist.push(s); 1.15802 + } 1.15803 + } 1.15804 + this.blocks = blocks.reverse(); 1.15805 + }, 1.15806 + computeDominance: function computeDominance() { 1.15807 + function intersectDominators(doms, b1, b2) { 1.15808 + var finger1 = b1; 1.15809 + var finger2 = b2; 1.15810 + while (finger1 !== finger2) { 1.15811 + while (finger1 > finger2) { 1.15812 + finger1 = doms[finger1]; 1.15813 + } 1.15814 + while (finger2 > finger1) { 1.15815 + finger2 = doms[finger2]; 1.15816 + } 1.15817 + } 1.15818 + return finger1; 1.15819 + } 1.15820 + var blocks = this.blocks; 1.15821 + var n = blocks.length; 1.15822 + var doms = new Array(n); 1.15823 + doms[0] = 0; 1.15824 + var rpo = {}; 1.15825 + for (var b = 0; b < n; b++) { 1.15826 + rpo[blocks[b].bid] = b; 1.15827 + } 1.15828 + var changed = true; 1.15829 + while (changed) { 1.15830 + changed = false; 1.15831 + for (var b = 1; b < n; b++) { 1.15832 + var preds = blocks[b].preds; 1.15833 + var j = preds.length; 1.15834 + var newIdom = rpo[preds[0].bid]; 1.15835 + if (!(newIdom in doms)) { 1.15836 + for (var i = 1; i < j; i++) { 1.15837 + newIdom = rpo[preds[i].bid]; 1.15838 + if (newIdom in doms) { 1.15839 + break; 1.15840 + } 1.15841 + } 1.15842 + } 1.15843 + true; 1.15844 + for (var i = 0; i < j; i++) { 1.15845 + var p = rpo[preds[i].bid]; 1.15846 + if (p === newIdom) { 1.15847 + continue; 1.15848 + } 1.15849 + if (p in doms) { 1.15850 + newIdom = intersectDominators(doms, p, newIdom); 1.15851 + } 1.15852 + } 1.15853 + if (doms[b] !== newIdom) { 1.15854 + doms[b] = newIdom; 1.15855 + changed = true; 1.15856 + } 1.15857 + } 1.15858 + } 1.15859 + blocks[0].dominator = blocks[0]; 1.15860 + var block; 1.15861 + for (var b = 1; b < n; b++) { 1.15862 + block = blocks[b]; 1.15863 + var idom = blocks[doms[b]]; 1.15864 + block.dominator = idom; 1.15865 + idom.dominatees.push(block); 1.15866 + block.npreds = block.preds.length; 1.15867 + } 1.15868 + var worklist = [ 1.15869 + blocks[0] 1.15870 + ]; 1.15871 + blocks[0].level || (blocks[0].level = 0); 1.15872 + while (block = worklist.shift()) { 1.15873 + var dominatees = block.dominatees; 1.15874 + for (var i = 0, j = dominatees.length; i < j; i++) { 1.15875 + dominatees[i].level = block.level + 1; 1.15876 + } 1.15877 + worklist.push.apply(worklist, dominatees); 1.15878 + } 1.15879 + }, 1.15880 + analyzeControlFlow: function analyzeControlFlow() { 1.15881 + true; 1.15882 + this.detectBasicBlocks(); 1.15883 + this.normalizeReachableBlocks(); 1.15884 + this.computeDominance(); 1.15885 + this.analyzedControlFlow = true; 1.15886 + return true; 1.15887 + }, 1.15888 + markLoops: function markLoops() { 1.15889 + if (!this.analyzedControlFlow && !this.analyzeControlFlow()) { 1.15890 + return false; 1.15891 + } 1.15892 + var BlockSet = this.BlockSet; 1.15893 + function findSCCs(root) { 1.15894 + var preorderId = 1; 1.15895 + var preorder = {}; 1.15896 + var assigned = {}; 1.15897 + var unconnectedNodes = []; 1.15898 + var pendingNodes = []; 1.15899 + var sccs = []; 1.15900 + var level = root.level + 1; 1.15901 + var worklist = [ 1.15902 + root 1.15903 + ]; 1.15904 + var node; 1.15905 + var u, s; 1.15906 + while (node = worklist.top()) { 1.15907 + if (preorder[node.bid]) { 1.15908 + if (pendingNodes.peek() === node) { 1.15909 + pendingNodes.pop(); 1.15910 + var scc = []; 1.15911 + do { 1.15912 + u = unconnectedNodes.pop(); 1.15913 + assigned[u.bid] = true; 1.15914 + scc.push(u); 1.15915 + } while (u !== node); 1.15916 + if (scc.length > 1 || u.spbacks && u.spbacks.get(u.bid)) { 1.15917 + sccs.push(scc); 1.15918 + } 1.15919 + } 1.15920 + worklist.pop(); 1.15921 + continue; 1.15922 + } 1.15923 + preorder[node.bid] = preorderId++; 1.15924 + unconnectedNodes.push(node); 1.15925 + pendingNodes.push(node); 1.15926 + var succs = node.succs; 1.15927 + for (var i = 0, j = succs.length; i < j; i++) { 1.15928 + s = succs[i]; 1.15929 + if (s.level < level) { 1.15930 + continue; 1.15931 + } 1.15932 + var sid = s.bid; 1.15933 + if (!preorder[sid]) { 1.15934 + worklist.push(s); 1.15935 + } else if (!assigned[sid]) { 1.15936 + while (preorder[pendingNodes.peek().bid] > preorder[sid]) { 1.15937 + pendingNodes.pop(); 1.15938 + } 1.15939 + } 1.15940 + } 1.15941 + } 1.15942 + return sccs; 1.15943 + } 1.15944 + function findLoopHeads(blocks) { 1.15945 + var heads = new BlockSet(); 1.15946 + for (var i = 0, j = blocks.length; i < j; i++) { 1.15947 + var block = blocks[i]; 1.15948 + var spbacks = block.spbacks; 1.15949 + if (!spbacks) { 1.15950 + continue; 1.15951 + } 1.15952 + var succs = block.succs; 1.15953 + for (var k = 0, l = succs.length; k < l; k++) { 1.15954 + var s = succs[k]; 1.15955 + if (spbacks.get(s.bid)) { 1.15956 + heads.set(s.dominator.bid); 1.15957 + } 1.15958 + } 1.15959 + } 1.15960 + return heads.members(); 1.15961 + } 1.15962 + function LoopInfo(scc, loopId) { 1.15963 + var body = new BlockSet(); 1.15964 + body.setBlocks(scc); 1.15965 + body.recount(); 1.15966 + this.id = loopId; 1.15967 + this.body = body; 1.15968 + this.exit = new BlockSet(); 1.15969 + this.save = {}; 1.15970 + this.head = new BlockSet(); 1.15971 + this.npreds = 0; 1.15972 + } 1.15973 + var heads = findLoopHeads(this.blocks); 1.15974 + if (heads.length <= 0) { 1.15975 + this.markedLoops = true; 1.15976 + return true; 1.15977 + } 1.15978 + var worklist = heads.sort(function (a, b) { 1.15979 + return a.level - b.level; 1.15980 + }); 1.15981 + var loopId = 0; 1.15982 + for (var n = worklist.length - 1; n >= 0; n--) { 1.15983 + var top = worklist[n]; 1.15984 + var sccs = findSCCs(top); 1.15985 + if (sccs.length === 0) { 1.15986 + continue; 1.15987 + } 1.15988 + for (var i = 0, j = sccs.length; i < j; i++) { 1.15989 + var scc = sccs[i]; 1.15990 + var loop = new LoopInfo(scc, loopId++); 1.15991 + for (var k = 0, l = scc.length; k < l; k++) { 1.15992 + var h = scc[k]; 1.15993 + if (h.level === top.level + 1 && !h.loop) { 1.15994 + h.loop = loop; 1.15995 + loop.head.set(h.bid); 1.15996 + var preds = h.preds; 1.15997 + for (var pi = 0, pj = preds.length; pi < pj; pi++) { 1.15998 + loop.body.get(preds[pi].bid) && h.npreds--; 1.15999 + } 1.16000 + loop.npreds += h.npreds; 1.16001 + } 1.16002 + } 1.16003 + for (var k = 0, l = scc.length; k < l; k++) { 1.16004 + var h = scc[k]; 1.16005 + if (h.level === top.level + 1) { 1.16006 + h.npreds = loop.npreds; 1.16007 + } 1.16008 + } 1.16009 + loop.head.recount(); 1.16010 + } 1.16011 + } 1.16012 + this.markedLoops = true; 1.16013 + return true; 1.16014 + } 1.16015 + }; 1.16016 + return Analysis; 1.16017 + }(); 1.16018 +(function (exports) { 1.16019 + var lang = exports.lang = { 1.16020 + Node: {}, 1.16021 + Program: { 1.16022 + extends: 'Node', 1.16023 + fields: [ 1.16024 + '@body' 1.16025 + ] 1.16026 + }, 1.16027 + Statement: { 1.16028 + extends: 'Node' 1.16029 + }, 1.16030 + EmptyStatement: { 1.16031 + extends: 'Statement' 1.16032 + }, 1.16033 + BlockStatement: { 1.16034 + extends: 'Statement', 1.16035 + fields: [ 1.16036 + '@body' 1.16037 + ] 1.16038 + }, 1.16039 + ExpressionStatement: { 1.16040 + extends: 'Statement', 1.16041 + fields: [ 1.16042 + '@expression' 1.16043 + ] 1.16044 + }, 1.16045 + IfStatement: { 1.16046 + extends: 'Statement', 1.16047 + fields: [ 1.16048 + '@test', 1.16049 + '@consequent', 1.16050 + '@alternate' 1.16051 + ] 1.16052 + }, 1.16053 + LabeledStatement: { 1.16054 + extends: 'Statement', 1.16055 + fields: [ 1.16056 + '@label', 1.16057 + '@body' 1.16058 + ] 1.16059 + }, 1.16060 + BreakStatement: { 1.16061 + extends: 'Statement', 1.16062 + fields: [ 1.16063 + '@label' 1.16064 + ] 1.16065 + }, 1.16066 + ContinueStatement: { 1.16067 + extends: 'Statement', 1.16068 + fields: [ 1.16069 + '@label' 1.16070 + ] 1.16071 + }, 1.16072 + WithStatement: { 1.16073 + extends: 'Statement', 1.16074 + fields: [ 1.16075 + '@object', 1.16076 + '@body' 1.16077 + ] 1.16078 + }, 1.16079 + SwitchStatement: { 1.16080 + extends: 'Statement', 1.16081 + fields: [ 1.16082 + '@discriminant', 1.16083 + '@cases', 1.16084 + 'lexical' 1.16085 + ] 1.16086 + }, 1.16087 + ReturnStatement: { 1.16088 + extends: 'Statement', 1.16089 + fields: [ 1.16090 + '@argument' 1.16091 + ] 1.16092 + }, 1.16093 + ThrowStatement: { 1.16094 + extends: 'Statement', 1.16095 + fields: [ 1.16096 + '@argument' 1.16097 + ] 1.16098 + }, 1.16099 + TryStatement: { 1.16100 + extends: 'Statement', 1.16101 + fields: [ 1.16102 + '@block', 1.16103 + '@handlers', 1.16104 + '@finalizer' 1.16105 + ] 1.16106 + }, 1.16107 + WhileStatement: { 1.16108 + extends: 'Statement', 1.16109 + fields: [ 1.16110 + '@test', 1.16111 + '@body' 1.16112 + ] 1.16113 + }, 1.16114 + DoWhileStatement: { 1.16115 + extends: 'Statement', 1.16116 + fields: [ 1.16117 + '@body', 1.16118 + '@test' 1.16119 + ] 1.16120 + }, 1.16121 + ForStatement: { 1.16122 + extends: 'Statement', 1.16123 + fields: [ 1.16124 + '@init', 1.16125 + '@test', 1.16126 + '@update', 1.16127 + '@body' 1.16128 + ] 1.16129 + }, 1.16130 + ForInStatement: { 1.16131 + extends: 'Statement', 1.16132 + fields: [ 1.16133 + '@left', 1.16134 + '@right', 1.16135 + '@body', 1.16136 + 'each' 1.16137 + ] 1.16138 + }, 1.16139 + LetStatement: { 1.16140 + extends: 'Statement', 1.16141 + fields: [ 1.16142 + '@head', 1.16143 + '@body' 1.16144 + ] 1.16145 + }, 1.16146 + DebuggerStatement: { 1.16147 + extends: 'Statement' 1.16148 + }, 1.16149 + Declaration: { 1.16150 + extends: 'Statement' 1.16151 + }, 1.16152 + FunctionDeclaration: { 1.16153 + extends: 'Declaration', 1.16154 + fields: [ 1.16155 + '@id', 1.16156 + '@params', 1.16157 + '@body', 1.16158 + '@decltype', 1.16159 + 'generator', 1.16160 + 'expression', 1.16161 + '@modifiers' 1.16162 + ] 1.16163 + }, 1.16164 + VariableDeclaration: { 1.16165 + extends: 'Declaration', 1.16166 + fields: [ 1.16167 + 'kind', 1.16168 + '@declarations' 1.16169 + ] 1.16170 + }, 1.16171 + VariableDeclarator: { 1.16172 + extends: 'Node', 1.16173 + fields: [ 1.16174 + '@id', 1.16175 + '@init', 1.16176 + '@decltype', 1.16177 + '@arguments' 1.16178 + ] 1.16179 + }, 1.16180 + Expression: { 1.16181 + extends: 'Pattern' 1.16182 + }, 1.16183 + ThisExpression: { 1.16184 + extends: 'Expression' 1.16185 + }, 1.16186 + ArrayExpression: { 1.16187 + extends: 'Expression', 1.16188 + fields: [ 1.16189 + '@elements' 1.16190 + ] 1.16191 + }, 1.16192 + ObjectExpression: { 1.16193 + extends: 'Expression', 1.16194 + fields: [ 1.16195 + '@properties' 1.16196 + ] 1.16197 + }, 1.16198 + Property: { 1.16199 + extends: 'Node', 1.16200 + fields: [ 1.16201 + '@key', 1.16202 + '@value', 1.16203 + 'kind' 1.16204 + ] 1.16205 + }, 1.16206 + FunctionExpression: { 1.16207 + extends: 'Expression', 1.16208 + fields: [ 1.16209 + '@id', 1.16210 + '@params', 1.16211 + '@body', 1.16212 + '@decltype', 1.16213 + 'generator', 1.16214 + 'expression' 1.16215 + ] 1.16216 + }, 1.16217 + SequenceExpression: { 1.16218 + extends: 'Expression', 1.16219 + fields: [ 1.16220 + '@expressions' 1.16221 + ] 1.16222 + }, 1.16223 + UnaryExpression: { 1.16224 + extends: 'Expression', 1.16225 + fields: [ 1.16226 + 'operator', 1.16227 + '@argument', 1.16228 + 'prefix' 1.16229 + ] 1.16230 + }, 1.16231 + BinaryExpression: { 1.16232 + extends: 'Expression', 1.16233 + fields: [ 1.16234 + 'operator', 1.16235 + '@left', 1.16236 + '@right' 1.16237 + ] 1.16238 + }, 1.16239 + AssignmentExpression: { 1.16240 + extends: 'Expression', 1.16241 + fields: [ 1.16242 + '@left', 1.16243 + 'operator', 1.16244 + '@right' 1.16245 + ] 1.16246 + }, 1.16247 + UpdateExpression: { 1.16248 + extends: 'Expression', 1.16249 + fields: [ 1.16250 + 'operator', 1.16251 + '@argument', 1.16252 + 'prefix' 1.16253 + ] 1.16254 + }, 1.16255 + LogicalExpression: { 1.16256 + extends: 'Expression', 1.16257 + fields: [ 1.16258 + 'operator', 1.16259 + '@left', 1.16260 + '@right' 1.16261 + ] 1.16262 + }, 1.16263 + ConditionalExpression: { 1.16264 + extends: 'Expression', 1.16265 + fields: [ 1.16266 + '@test', 1.16267 + '@consequent', 1.16268 + '@alternate' 1.16269 + ] 1.16270 + }, 1.16271 + NewExpression: { 1.16272 + extends: 'Expression', 1.16273 + fields: [ 1.16274 + '@callee', 1.16275 + '@arguments' 1.16276 + ] 1.16277 + }, 1.16278 + CallExpression: { 1.16279 + extends: 'Expression', 1.16280 + fields: [ 1.16281 + '@callee', 1.16282 + '@arguments' 1.16283 + ] 1.16284 + }, 1.16285 + MemberExpression: { 1.16286 + extends: 'Expression', 1.16287 + fields: [ 1.16288 + '@object', 1.16289 + '@property', 1.16290 + 'computed', 1.16291 + 'kind' 1.16292 + ] 1.16293 + }, 1.16294 + YieldExpression: { 1.16295 + extends: 'Expression', 1.16296 + fields: [ 1.16297 + '@argument' 1.16298 + ] 1.16299 + }, 1.16300 + ComprehensionExpression: { 1.16301 + extends: 'Expression', 1.16302 + fields: [ 1.16303 + '@blocks', 1.16304 + '@filter' 1.16305 + ] 1.16306 + }, 1.16307 + GeneratorExpression: { 1.16308 + extends: 'Expression', 1.16309 + fields: [ 1.16310 + '@blocks', 1.16311 + '@filter' 1.16312 + ] 1.16313 + }, 1.16314 + LetExpression: { 1.16315 + extends: 'Expression', 1.16316 + fields: [ 1.16317 + '@head', 1.16318 + '@body' 1.16319 + ] 1.16320 + }, 1.16321 + Pattern: { 1.16322 + extends: 'Node' 1.16323 + }, 1.16324 + ObjectPattern: { 1.16325 + extends: 'Pattern', 1.16326 + fields: [ 1.16327 + '@properties' 1.16328 + ] 1.16329 + }, 1.16330 + ArrayPattern: { 1.16331 + extends: 'Pattern', 1.16332 + fields: [ 1.16333 + '@elements' 1.16334 + ] 1.16335 + }, 1.16336 + SwitchCase: { 1.16337 + extends: 'Node', 1.16338 + fields: [ 1.16339 + '@test', 1.16340 + '@consequent' 1.16341 + ] 1.16342 + }, 1.16343 + CatchClause: { 1.16344 + extends: 'Node', 1.16345 + fields: [ 1.16346 + '@param', 1.16347 + '@guard', 1.16348 + '@body' 1.16349 + ] 1.16350 + }, 1.16351 + Identifier: { 1.16352 + extends: 'Expression', 1.16353 + fields: [ 1.16354 + 'name', 1.16355 + 'kind' 1.16356 + ] 1.16357 + }, 1.16358 + Literal: { 1.16359 + extends: 'Expression', 1.16360 + fields: [ 1.16361 + 'value' 1.16362 + ] 1.16363 + }, 1.16364 + Type: { 1.16365 + extends: 'Node' 1.16366 + }, 1.16367 + PointerType: { 1.16368 + extends: 'Type', 1.16369 + fields: [ 1.16370 + '@base' 1.16371 + ] 1.16372 + }, 1.16373 + ArrayType: { 1.16374 + extends: 'PointerType', 1.16375 + fields: [ 1.16376 + 'length' 1.16377 + ] 1.16378 + }, 1.16379 + StructType: { 1.16380 + extends: 'Type', 1.16381 + fields: [ 1.16382 + '@id', 1.16383 + '@members', 1.16384 + 'isUnion' 1.16385 + ] 1.16386 + }, 1.16387 + MemberDeclarator: { 1.16388 + extends: 'Node', 1.16389 + fields: [ 1.16390 + 'modifiers', 1.16391 + '@declarator' 1.16392 + ] 1.16393 + }, 1.16394 + ArrowType: { 1.16395 + extends: 'Type', 1.16396 + fields: [ 1.16397 + '@params', 1.16398 + '@return' 1.16399 + ] 1.16400 + }, 1.16401 + TypeIdentifier: { 1.16402 + extends: 'Type', 1.16403 + fields: [ 1.16404 + 'name' 1.16405 + ] 1.16406 + }, 1.16407 + TypeAliasDirective: { 1.16408 + extends: 'Node', 1.16409 + fields: [ 1.16410 + '@original', 1.16411 + '@alias' 1.16412 + ] 1.16413 + }, 1.16414 + CastExpression: { 1.16415 + extends: 'Expression', 1.16416 + fields: [ 1.16417 + '@as', 1.16418 + '@argument' 1.16419 + ] 1.16420 + } 1.16421 + }; 1.16422 + function allFields(spec) { 1.16423 + var fields = [ 1.16424 + 'leadingComments', 1.16425 + 'loc' 1.16426 + ]; 1.16427 + while (spec) { 1.16428 + if (spec.fields) { 1.16429 + fields = spec.fields.concat(fields); 1.16430 + } 1.16431 + spec = spec.extends ? lang[spec.extends] : null; 1.16432 + } 1.16433 + return fields; 1.16434 + } 1.16435 + ; 1.16436 + exports.allFields = allFields; 1.16437 + function prefixUnderscore(s) { 1.16438 + return '_' + s; 1.16439 + } 1.16440 + function ensureConstructor(name, spec) { 1.16441 + if (!exports[name]) { 1.16442 + var fields = allFields(spec); 1.16443 + var children = []; 1.16444 + var body = [ 1.16445 + 'this.type = "' + name + '";' 1.16446 + ]; 1.16447 + for (var i = 0, j = fields.length; i < j; i++) { 1.16448 + var fname = fields[i]; 1.16449 + if (fname.charAt(0) === '@') { 1.16450 + fields[i] = fname = fname.substr(1); 1.16451 + children.push(fname); 1.16452 + } 1.16453 + body.push('this.' + fname + ' = _' + fname + ';'); 1.16454 + } 1.16455 + var node = new Function(fields.map(prefixUnderscore), body.join('\n')); 1.16456 + if (spec.extends) { 1.16457 + var pnode = ensureConstructor(spec.extends, lang[spec.extends]); 1.16458 + node.prototype = Object.create(pnode.prototype); 1.16459 + } 1.16460 + Object.defineProperty(node.prototype, '_children', { 1.16461 + value: children, 1.16462 + writable: true, 1.16463 + configurable: true, 1.16464 + enumerable: false 1.16465 + }); 1.16466 + exports[name] = node; 1.16467 + } 1.16468 + return exports[name]; 1.16469 + } 1.16470 + for (var name in lang) { 1.16471 + ensureConstructor(name, lang[name]); 1.16472 + } 1.16473 + exports.makePass = function makePass(name, prop) { 1.16474 + return function (o) { 1.16475 + var trans, arr; 1.16476 + var child, children = this._children; 1.16477 + for (var i = 0, j = children.length; i < j; i++) { 1.16478 + if (!(child = this[children[i]])) { 1.16479 + continue; 1.16480 + } 1.16481 + if (child instanceof Array) { 1.16482 + arr = this[children[i]] = []; 1.16483 + for (var k = 0, l = child.length; k < l; k++) { 1.16484 + if (!child[k]) { 1.16485 + arr.push(child[k]); 1.16486 + } else if (typeof child[k][name] === 'function') { 1.16487 + trans = child[k][name](o); 1.16488 + if (trans !== null) { 1.16489 + arr.push(trans); 1.16490 + } 1.16491 + } 1.16492 + } 1.16493 + } else if (typeof child[name] === 'function') { 1.16494 + trans = child[name](o); 1.16495 + if (trans === null) { 1.16496 + this[children[i]] = undefined; 1.16497 + } else { 1.16498 + this[children[i]] = trans; 1.16499 + } 1.16500 + } 1.16501 + } 1.16502 + if (typeof this[prop] === 'function') { 1.16503 + if (o.logger && typeof this.loc !== 'undefined') { 1.16504 + o.logger.push(this); 1.16505 + trans = this[prop](o); 1.16506 + o.logger.pop(); 1.16507 + } else { 1.16508 + trans = this[prop](o); 1.16509 + } 1.16510 + if (trans === null) { 1.16511 + return null; 1.16512 + } 1.16513 + return trans ? trans : this; 1.16514 + } 1.16515 + return this; 1.16516 + }; 1.16517 + }; 1.16518 + exports.makePass = function makePass(name, prop, backward) { 1.16519 + return function (o) { 1.16520 + var trans, arr; 1.16521 + var child, children = this._children; 1.16522 + var i, k; 1.16523 + for (var x = 0, j = children.length; x < j; x++) { 1.16524 + i = backward ? children.length - 1 - x : x; 1.16525 + if (!(child = this[children[i]])) { 1.16526 + continue; 1.16527 + } 1.16528 + if (child instanceof Array) { 1.16529 + arr = this[children[i]] = []; 1.16530 + var y; 1.16531 + for (var y = 0, l = child.length; y < l; y++) { 1.16532 + k = backward ? child.length - 1 - y : y; 1.16533 + if (!child[k]) { 1.16534 + if (backward) { 1.16535 + arr.unshift(child[k]); 1.16536 + } else { 1.16537 + arr.push(child[k]); 1.16538 + } 1.16539 + } else if (typeof child[k][name] === 'function') { 1.16540 + trans = child[k][name](o); 1.16541 + if (trans !== null) { 1.16542 + if (backward) { 1.16543 + arr.unshift(trans); 1.16544 + } else { 1.16545 + arr.push(trans); 1.16546 + } 1.16547 + } 1.16548 + } 1.16549 + } 1.16550 + } else if (typeof child[name] === 'function') { 1.16551 + trans = child[name](o); 1.16552 + if (trans === null) { 1.16553 + this[children[i]] = undefined; 1.16554 + } else { 1.16555 + this[children[i]] = trans; 1.16556 + } 1.16557 + } 1.16558 + } 1.16559 + if (typeof this[prop] === 'function') { 1.16560 + if (o.logger && typeof this.loc !== 'undefined') { 1.16561 + o.logger.push(this); 1.16562 + trans = this[prop](o); 1.16563 + o.logger.pop(); 1.16564 + } else { 1.16565 + trans = this[prop](o); 1.16566 + } 1.16567 + if (trans === null) { 1.16568 + return null; 1.16569 + } 1.16570 + return trans ? trans : this; 1.16571 + } 1.16572 + return this; 1.16573 + }; 1.16574 + }; 1.16575 + exports.lift = function lift(raw) { 1.16576 + if (!raw) { 1.16577 + return raw; 1.16578 + } 1.16579 + if (raw instanceof Array) { 1.16580 + return raw.map(function (r) { 1.16581 + return r ? lift(r) : r; 1.16582 + }); 1.16583 + } 1.16584 + var type = raw.type; 1.16585 + var Node = exports[type]; 1.16586 + if (!Node) { 1.16587 + throw new Error('unknown node type `' + type + '\''); 1.16588 + } 1.16589 + var node = new Node(); 1.16590 + node.loc = raw.loc; 1.16591 + var fields = allFields(lang[type]); 1.16592 + for (var i = 0, j = fields.length; i < j; i++) { 1.16593 + var field; 1.16594 + if (fields[i].charAt(0) === '@') { 1.16595 + field = fields[i].substr(1); 1.16596 + if (raw[field]) { 1.16597 + node[field] = lift(raw[field]); 1.16598 + } 1.16599 + } else { 1.16600 + field = fields[i]; 1.16601 + node[field] = raw[field]; 1.16602 + } 1.16603 + } 1.16604 + return node; 1.16605 + }; 1.16606 + exports.flatten = function flatten(node) { 1.16607 + if (!node) { 1.16608 + return node; 1.16609 + } 1.16610 + if (node instanceof Array) { 1.16611 + return node.map(function (n) { 1.16612 + return flatten(n); 1.16613 + }); 1.16614 + } 1.16615 + var type = node.type; 1.16616 + var raw = { 1.16617 + type: type 1.16618 + }; 1.16619 + var fields = allFields(lang[type]); 1.16620 + for (var i = 0, j = fields.length; i < j; i++) { 1.16621 + var field; 1.16622 + if (fields[i].charAt(0) === '@') { 1.16623 + field = fields[i].substr(1); 1.16624 + if (node[field]) { 1.16625 + raw[field] = flatten(node[field]); 1.16626 + } else { 1.16627 + raw[field] = null; 1.16628 + } 1.16629 + } else { 1.16630 + field = fields[i]; 1.16631 + raw[field] = node[field]; 1.16632 + } 1.16633 + } 1.16634 + return raw; 1.16635 + }; 1.16636 +}(typeof exports === 'undefined' ? estransform = {} : exports)); 1.16637 +(function (exports) { 1.16638 + var Syntax, Precedence, BinaryPrecedence, Regex, VisitorKeys, VisitorOption, isArray, base, indent, json, renumber, hexadecimal, quotes, escapeless, newline, space, parentheses, semicolons, extra, parse; 1.16639 + Syntax = { 1.16640 + AssignmentExpression: 'AssignmentExpression', 1.16641 + ArrayExpression: 'ArrayExpression', 1.16642 + BlockStatement: 'BlockStatement', 1.16643 + BinaryExpression: 'BinaryExpression', 1.16644 + BreakStatement: 'BreakStatement', 1.16645 + CallExpression: 'CallExpression', 1.16646 + CatchClause: 'CatchClause', 1.16647 + ConditionalExpression: 'ConditionalExpression', 1.16648 + ContinueStatement: 'ContinueStatement', 1.16649 + DoWhileStatement: 'DoWhileStatement', 1.16650 + DebuggerStatement: 'DebuggerStatement', 1.16651 + EmptyStatement: 'EmptyStatement', 1.16652 + ExpressionStatement: 'ExpressionStatement', 1.16653 + ForStatement: 'ForStatement', 1.16654 + ForInStatement: 'ForInStatement', 1.16655 + FunctionDeclaration: 'FunctionDeclaration', 1.16656 + FunctionExpression: 'FunctionExpression', 1.16657 + Identifier: 'Identifier', 1.16658 + IfStatement: 'IfStatement', 1.16659 + Literal: 'Literal', 1.16660 + LabeledStatement: 'LabeledStatement', 1.16661 + LogicalExpression: 'LogicalExpression', 1.16662 + MemberExpression: 'MemberExpression', 1.16663 + NewExpression: 'NewExpression', 1.16664 + ObjectExpression: 'ObjectExpression', 1.16665 + Program: 'Program', 1.16666 + Property: 'Property', 1.16667 + ReturnStatement: 'ReturnStatement', 1.16668 + SequenceExpression: 'SequenceExpression', 1.16669 + SwitchStatement: 'SwitchStatement', 1.16670 + SwitchCase: 'SwitchCase', 1.16671 + ThisExpression: 'ThisExpression', 1.16672 + ThrowStatement: 'ThrowStatement', 1.16673 + TryStatement: 'TryStatement', 1.16674 + UnaryExpression: 'UnaryExpression', 1.16675 + UpdateExpression: 'UpdateExpression', 1.16676 + VariableDeclaration: 'VariableDeclaration', 1.16677 + VariableDeclarator: 'VariableDeclarator', 1.16678 + WhileStatement: 'WhileStatement', 1.16679 + WithStatement: 'WithStatement' 1.16680 + }; 1.16681 + Precedence = { 1.16682 + Sequence: 0, 1.16683 + Assignment: 1, 1.16684 + Conditional: 2, 1.16685 + LogicalOR: 3, 1.16686 + LogicalAND: 4, 1.16687 + BitwiseOR: 5, 1.16688 + BitwiseXOR: 6, 1.16689 + BitwiseAND: 7, 1.16690 + Equality: 8, 1.16691 + Relational: 9, 1.16692 + BitwiseSHIFT: 10, 1.16693 + Additive: 11, 1.16694 + Multiplicative: 12, 1.16695 + Unary: 13, 1.16696 + Postfix: 14, 1.16697 + Call: 15, 1.16698 + New: 16, 1.16699 + Member: 17, 1.16700 + Primary: 18 1.16701 + }; 1.16702 + BinaryPrecedence = { 1.16703 + '||': Precedence.LogicalOR, 1.16704 + '&&': Precedence.LogicalAND, 1.16705 + '|': Precedence.BitwiseOR, 1.16706 + '^': Precedence.BitwiseXOR, 1.16707 + '&': Precedence.BitwiseAND, 1.16708 + '==': Precedence.Equality, 1.16709 + '!=': Precedence.Equality, 1.16710 + '===': Precedence.Equality, 1.16711 + '!==': Precedence.Equality, 1.16712 + '<': Precedence.Relational, 1.16713 + '>': Precedence.Relational, 1.16714 + '<=': Precedence.Relational, 1.16715 + '>=': Precedence.Relational, 1.16716 + 'in': Precedence.Relational, 1.16717 + 'instanceof': Precedence.Relational, 1.16718 + '<<': Precedence.BitwiseSHIFT, 1.16719 + '>>': Precedence.BitwiseSHIFT, 1.16720 + '>>>': Precedence.BitwiseSHIFT, 1.16721 + '+': Precedence.Additive, 1.16722 + '-': Precedence.Additive, 1.16723 + '*': Precedence.Multiplicative, 1.16724 + '%': Precedence.Multiplicative, 1.16725 + '/': Precedence.Multiplicative 1.16726 + }; 1.16727 + Regex = { 1.16728 + NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]') 1.16729 + }; 1.16730 + function getDefaultOptions() { 1.16731 + return { 1.16732 + indent: null, 1.16733 + base: null, 1.16734 + parse: null, 1.16735 + comment: false, 1.16736 + format: { 1.16737 + indent: { 1.16738 + style: ' ', 1.16739 + base: 0, 1.16740 + adjustMultilineComment: false 1.16741 + }, 1.16742 + json: false, 1.16743 + renumber: false, 1.16744 + hexadecimal: false, 1.16745 + quotes: 'single', 1.16746 + escapeless: false, 1.16747 + compact: false, 1.16748 + parentheses: true, 1.16749 + semicolons: true 1.16750 + } 1.16751 + }; 1.16752 + } 1.16753 + function stringToArray(str) { 1.16754 + var length = str.length, result = [], i; 1.16755 + for (i = 0; i < length; i += 1) { 1.16756 + result[i] = str.charAt(i); 1.16757 + } 1.16758 + return result; 1.16759 + } 1.16760 + function stringRepeat(str, num) { 1.16761 + var result = ''; 1.16762 + for (num |= 0; num > 0; num >>>= 1, str += str) { 1.16763 + if (num & 1) { 1.16764 + result += str; 1.16765 + } 1.16766 + } 1.16767 + return result; 1.16768 + } 1.16769 + isArray = Array.isArray; 1.16770 + if (!isArray) { 1.16771 + isArray = function isArray(array) { 1.16772 + return Object.prototype.toString.call(array) === '[object Array]'; 1.16773 + }; 1.16774 + } 1.16775 + function endsWithLineTerminator(str) { 1.16776 + var len, ch; 1.16777 + len = str.length; 1.16778 + ch = str.charAt(len - 1); 1.16779 + return ch === '\r' || ch === '\n'; 1.16780 + } 1.16781 + function shallowCopy(obj) { 1.16782 + var ret = {}, key; 1.16783 + for (key in obj) { 1.16784 + if (obj.hasOwnProperty(key)) { 1.16785 + ret[key] = obj[key]; 1.16786 + } 1.16787 + } 1.16788 + return ret; 1.16789 + } 1.16790 + function deepCopy(obj) { 1.16791 + var ret = {}, key, val; 1.16792 + for (key in obj) { 1.16793 + if (obj.hasOwnProperty(key)) { 1.16794 + val = obj[key]; 1.16795 + if (typeof val === 'object' && val !== null) { 1.16796 + ret[key] = deepCopy(val); 1.16797 + } else { 1.16798 + ret[key] = val; 1.16799 + } 1.16800 + } 1.16801 + } 1.16802 + return ret; 1.16803 + } 1.16804 + function updateDeeply(target, override) { 1.16805 + var key, val; 1.16806 + function isHashObject(target) { 1.16807 + return typeof target === 'object' && target instanceof Object && !(target instanceof RegExp); 1.16808 + } 1.16809 + for (key in override) { 1.16810 + if (override.hasOwnProperty(key)) { 1.16811 + val = override[key]; 1.16812 + if (isHashObject(val)) { 1.16813 + if (isHashObject(target[key])) { 1.16814 + updateDeeply(target[key], val); 1.16815 + } else { 1.16816 + target[key] = updateDeeply({}, val); 1.16817 + } 1.16818 + } else { 1.16819 + target[key] = val; 1.16820 + } 1.16821 + } 1.16822 + } 1.16823 + return target; 1.16824 + } 1.16825 + function generateNumber(value) { 1.16826 + var result, point, temp, exponent, pos; 1.16827 + if (value !== value) { 1.16828 + throw new Error('Numeric literal whose value is NaN'); 1.16829 + } 1.16830 + if (1 / value < 0) { 1.16831 + throw new Error('Numeric literal whose value is negative'); 1.16832 + } 1.16833 + if (value === 1 / 0) { 1.16834 + return json ? 'null' : renumber ? '1e400' : '1e+400'; 1.16835 + } 1.16836 + result = '' + value; 1.16837 + if (!renumber || result.length < 3) { 1.16838 + return result; 1.16839 + } 1.16840 + point = result.indexOf('.'); 1.16841 + if (!json && result.charAt(0) === '0' && point === 1) { 1.16842 + point = 0; 1.16843 + result = result.slice(1); 1.16844 + } 1.16845 + temp = result; 1.16846 + result = result.replace('e+', 'e'); 1.16847 + exponent = 0; 1.16848 + if ((pos = temp.indexOf('e')) > 0) { 1.16849 + exponent = +temp.slice(pos + 1); 1.16850 + temp = temp.slice(0, pos); 1.16851 + } 1.16852 + if (point >= 0) { 1.16853 + exponent -= temp.length - point - 1; 1.16854 + temp = +(temp.slice(0, point) + temp.slice(point + 1)) + ''; 1.16855 + } 1.16856 + pos = 0; 1.16857 + while (temp.charAt(temp.length + pos - 1) === '0') { 1.16858 + pos -= 1; 1.16859 + } 1.16860 + if (pos !== 0) { 1.16861 + exponent -= pos; 1.16862 + temp = temp.slice(0, pos); 1.16863 + } 1.16864 + if (exponent !== 0) { 1.16865 + temp += 'e' + exponent; 1.16866 + } 1.16867 + if ((temp.length < result.length || hexadecimal && value > 1000000000000 && Math.floor(value) === value && (temp = '0x' + value.toString(16)).length < result.length) && +temp === value) { 1.16868 + result = temp; 1.16869 + } 1.16870 + return result; 1.16871 + } 1.16872 + function escapeAllowedCharacter(ch, next) { 1.16873 + var code = ch.charCodeAt(0), hex = code.toString(16), result = '\\'; 1.16874 + switch (ch) { 1.16875 + case '\b': 1.16876 + result += 'b'; 1.16877 + break; 1.16878 + case '\f': 1.16879 + result += 'f'; 1.16880 + break; 1.16881 + case '\t': 1.16882 + result += 't'; 1.16883 + break; 1.16884 + default: 1.16885 + if (json || code > 255) { 1.16886 + result += 'u' + '0000'.slice(hex.length) + hex; 1.16887 + } else if (ch === '\0' && '0123456789'.indexOf(next) < 0) { 1.16888 + result += '0'; 1.16889 + } else if (ch === '\v') { 1.16890 + result += 'v'; 1.16891 + } else { 1.16892 + result += 'x' + '00'.slice(hex.length) + hex; 1.16893 + } 1.16894 + break; 1.16895 + } 1.16896 + return result; 1.16897 + } 1.16898 + function escapeDisallowedCharacter(ch) { 1.16899 + var result = '\\'; 1.16900 + switch (ch) { 1.16901 + case '\\': 1.16902 + result += '\\'; 1.16903 + break; 1.16904 + case '\n': 1.16905 + result += 'n'; 1.16906 + break; 1.16907 + case '\r': 1.16908 + result += 'r'; 1.16909 + break; 1.16910 + case '\u2028': 1.16911 + result += 'u2028'; 1.16912 + break; 1.16913 + case '\u2029': 1.16914 + result += 'u2029'; 1.16915 + break; 1.16916 + default: 1.16917 + throw new Error('Incorrectly classified character'); 1.16918 + } 1.16919 + return result; 1.16920 + } 1.16921 + function escapeString(str) { 1.16922 + var result = '', i, len, ch, next, singleQuotes = 0, doubleQuotes = 0, single; 1.16923 + if (typeof str[0] === 'undefined') { 1.16924 + str = stringToArray(str); 1.16925 + } 1.16926 + for (i = 0, len = str.length; i < len; i += 1) { 1.16927 + ch = str[i]; 1.16928 + if (ch === '\'') { 1.16929 + singleQuotes += 1; 1.16930 + } else if (ch === '"') { 1.16931 + doubleQuotes += 1; 1.16932 + } else if (ch === '/' && json) { 1.16933 + result += '\\'; 1.16934 + } else if ('\\\n\r\u2028\u2029'.indexOf(ch) >= 0) { 1.16935 + result += escapeDisallowedCharacter(ch); 1.16936 + continue; 1.16937 + } else if (json && ch < ' ' || !(json || escapeless || ch >= ' ' && ch <= '~')) { 1.16938 + result += escapeAllowedCharacter(ch, str[i + 1]); 1.16939 + continue; 1.16940 + } 1.16941 + result += ch; 1.16942 + } 1.16943 + single = !(quotes === 'double' || quotes === 'auto' && doubleQuotes < singleQuotes); 1.16944 + str = result; 1.16945 + result = single ? '\'' : '"'; 1.16946 + if (typeof str[0] === 'undefined') { 1.16947 + str = stringToArray(str); 1.16948 + } 1.16949 + for (i = 0, len = str.length; i < len; i += 1) { 1.16950 + ch = str[i]; 1.16951 + if (ch === '\'' && single || ch === '"' && !single) { 1.16952 + result += '\\'; 1.16953 + } 1.16954 + result += ch; 1.16955 + } 1.16956 + return result + (single ? '\'' : '"'); 1.16957 + } 1.16958 + function isWhiteSpace(ch) { 1.16959 + return '\t\v\f \xa0'.indexOf(ch) >= 0 || ch.charCodeAt(0) >= 5760 && '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\ufeff'.indexOf(ch) >= 0; 1.16960 + } 1.16961 + function isLineTerminator(ch) { 1.16962 + return '\n\r\u2028\u2029'.indexOf(ch) >= 0; 1.16963 + } 1.16964 + function isIdentifierPart(ch) { 1.16965 + return ch === '$' || ch === '_' || ch === '\\' || ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch >= '0' && ch <= '9' || ch.charCodeAt(0) >= 128 && Regex.NonAsciiIdentifierPart.test(ch); 1.16966 + } 1.16967 + function join(left, right) { 1.16968 + var leftChar = left.charAt(left.length - 1), rightChar = right.charAt(0); 1.16969 + if ((leftChar === '+' || leftChar === '-') && leftChar === rightChar || isIdentifierPart(leftChar) && isIdentifierPart(rightChar)) { 1.16970 + return left + ' ' + right; 1.16971 + } else if (isWhiteSpace(leftChar) || isLineTerminator(leftChar) || isWhiteSpace(rightChar) || isLineTerminator(rightChar)) { 1.16972 + return left + right; 1.16973 + } 1.16974 + return left + space + right; 1.16975 + } 1.16976 + function addIndent(stmt) { 1.16977 + return base + stmt; 1.16978 + } 1.16979 + function calculateSpaces(str) { 1.16980 + var i; 1.16981 + for (i = str.length - 1; i >= 0; i -= 1) { 1.16982 + if (isLineTerminator(str.charAt(i))) { 1.16983 + break; 1.16984 + } 1.16985 + } 1.16986 + return str.length - 1 - i; 1.16987 + } 1.16988 + function adjustMultilineComment(value, specialBase) { 1.16989 + var array, i, len, line, j, ch, spaces, previousBase; 1.16990 + array = value.split(/\r\n|[\r\n]/); 1.16991 + spaces = Number.MAX_VALUE; 1.16992 + for (i = 1, len = array.length; i < len; i += 1) { 1.16993 + line = array[i]; 1.16994 + j = 0; 1.16995 + while (j < line.length && isWhiteSpace(line[j])) { 1.16996 + j += 1; 1.16997 + } 1.16998 + if (spaces > j) { 1.16999 + spaces = j; 1.17000 + } 1.17001 + } 1.17002 + if (typeof specialBase !== 'undefined') { 1.17003 + previousBase = base; 1.17004 + if (array[1][spaces] === '*') { 1.17005 + specialBase += ' '; 1.17006 + } 1.17007 + base = specialBase; 1.17008 + } else { 1.17009 + if (spaces % 2 === 1) { 1.17010 + spaces -= 1; 1.17011 + } 1.17012 + previousBase = base; 1.17013 + } 1.17014 + for (i = 1, len = array.length; i < len; i += 1) { 1.17015 + array[i] = addIndent(array[i].slice(spaces)); 1.17016 + } 1.17017 + base = previousBase; 1.17018 + return array.join('\n'); 1.17019 + } 1.17020 + function generateComment(comment, specialBase) { 1.17021 + if (comment.type === 'Line') { 1.17022 + if (endsWithLineTerminator(comment.value)) { 1.17023 + return '//' + comment.value; 1.17024 + } else { 1.17025 + return '//' + comment.value + '\n'; 1.17026 + } 1.17027 + } 1.17028 + if (extra.format.indent.adjustMultilineComment && /[\n\r]/.test(comment.value)) { 1.17029 + return adjustMultilineComment('/*' + comment.value + '*/', specialBase); 1.17030 + } 1.17031 + return '/*' + comment.value + '*/'; 1.17032 + } 1.17033 + function addCommentsToStatement(stmt, result) { 1.17034 + var i, len, comment, save, node, tailingToStatement, specialBase, fragment; 1.17035 + if (stmt.leadingComments) { 1.17036 + save = result; 1.17037 + comment = stmt.leadingComments[0]; 1.17038 + result = generateComment(comment); 1.17039 + if (!endsWithLineTerminator(result)) { 1.17040 + result += '\n'; 1.17041 + } 1.17042 + for (i = 1, len = stmt.leadingComments.length; i < len; i += 1) { 1.17043 + comment = stmt.leadingComments[i]; 1.17044 + fragment = generateComment(comment); 1.17045 + if (!endsWithLineTerminator(fragment)) { 1.17046 + fragment += '\n'; 1.17047 + } 1.17048 + result += addIndent(fragment); 1.17049 + } 1.17050 + result += addIndent(save); 1.17051 + } 1.17052 + if (stmt.trailingComments) { 1.17053 + tailingToStatement = !endsWithLineTerminator(result); 1.17054 + specialBase = stringRepeat(' ', calculateSpaces(base + result + indent)); 1.17055 + for (i = 0, len = stmt.trailingComments.length; i < len; i += 1) { 1.17056 + comment = stmt.trailingComments[i]; 1.17057 + if (tailingToStatement) { 1.17058 + if (i === 0) { 1.17059 + result += indent; 1.17060 + } else { 1.17061 + result += specialBase; 1.17062 + } 1.17063 + result += generateComment(comment, specialBase); 1.17064 + } else { 1.17065 + result += addIndent(generateComment(comment)); 1.17066 + } 1.17067 + if (i !== len - 1 && !endsWithLineTerminator(result)) { 1.17068 + result += '\n'; 1.17069 + } 1.17070 + } 1.17071 + } 1.17072 + return result; 1.17073 + } 1.17074 + function parenthesize(text, current, should) { 1.17075 + if (current < should) { 1.17076 + return '(' + text + ')'; 1.17077 + } 1.17078 + return text; 1.17079 + } 1.17080 + function maybeBlock(stmt, semicolonOptional) { 1.17081 + var previousBase, result, noLeadingComment; 1.17082 + noLeadingComment = !extra.comment || !stmt.leadingComments; 1.17083 + if (stmt.type === Syntax.BlockStatement && noLeadingComment) { 1.17084 + return space + generateStatement(stmt); 1.17085 + } 1.17086 + if (stmt.type === Syntax.EmptyStatement && noLeadingComment) { 1.17087 + return ';'; 1.17088 + } 1.17089 + previousBase = base; 1.17090 + base += indent; 1.17091 + result = newline + addIndent(generateStatement(stmt, { 1.17092 + semicolonOptional: semicolonOptional 1.17093 + })); 1.17094 + base = previousBase; 1.17095 + return result; 1.17096 + } 1.17097 + function maybeBlockSuffix(stmt, result) { 1.17098 + if (stmt.type === Syntax.BlockStatement && (!extra.comment || !stmt.leadingComments) && !endsWithLineTerminator(result)) { 1.17099 + return space; 1.17100 + } 1.17101 + if (endsWithLineTerminator(result)) { 1.17102 + return addIndent(''); 1.17103 + } 1.17104 + return (newline === '' ? ' ' : newline) + addIndent(''); 1.17105 + } 1.17106 + function generateFunctionBody(node) { 1.17107 + var result, i, len; 1.17108 + result = '('; 1.17109 + for (i = 0, len = node.params.length; i < len; i += 1) { 1.17110 + result += node.params[i].name; 1.17111 + if (i + 1 < len) { 1.17112 + result += ',' + space; 1.17113 + } 1.17114 + } 1.17115 + return result + ')' + maybeBlock(node.body); 1.17116 + } 1.17117 + function generateExpression(expr, option) { 1.17118 + var result, precedence, currentPrecedence, previousBase, i, len, raw, fragment, allowIn, allowCall, allowUnparenthesizedNew; 1.17119 + precedence = option.precedence; 1.17120 + allowIn = option.allowIn; 1.17121 + allowCall = option.allowCall; 1.17122 + switch (expr.type) { 1.17123 + case Syntax.SequenceExpression: 1.17124 + result = ''; 1.17125 + allowIn |= Precedence.Sequence < precedence; 1.17126 + for (i = 0, len = expr.expressions.length; i < len; i += 1) { 1.17127 + result += generateExpression(expr.expressions[i], { 1.17128 + precedence: Precedence.Assignment, 1.17129 + allowIn: allowIn, 1.17130 + allowCall: true 1.17131 + }); 1.17132 + if (i + 1 < len) { 1.17133 + result += ',' + space; 1.17134 + } 1.17135 + } 1.17136 + result = parenthesize(result, Precedence.Sequence, precedence); 1.17137 + break; 1.17138 + case Syntax.AssignmentExpression: 1.17139 + allowIn |= Precedence.Assignment < precedence; 1.17140 + result = parenthesize(generateExpression(expr.left, { 1.17141 + precedence: Precedence.Call, 1.17142 + allowIn: allowIn, 1.17143 + allowCall: true 1.17144 + }) + space + expr.operator + space + generateExpression(expr.right, { 1.17145 + precedence: Precedence.Assignment, 1.17146 + allowIn: allowIn, 1.17147 + allowCall: true 1.17148 + }), Precedence.Assignment, precedence); 1.17149 + break; 1.17150 + case Syntax.ConditionalExpression: 1.17151 + allowIn |= Precedence.Conditional < precedence; 1.17152 + result = parenthesize(generateExpression(expr.test, { 1.17153 + precedence: Precedence.LogicalOR, 1.17154 + allowIn: allowIn, 1.17155 + allowCall: true 1.17156 + }) + space + '?' + space + generateExpression(expr.consequent, { 1.17157 + precedence: Precedence.Assignment, 1.17158 + allowIn: allowIn, 1.17159 + allowCall: true 1.17160 + }) + space + ':' + space + generateExpression(expr.alternate, { 1.17161 + precedence: Precedence.Assignment, 1.17162 + allowIn: allowIn, 1.17163 + allowCall: true 1.17164 + }), Precedence.Conditional, precedence); 1.17165 + break; 1.17166 + case Syntax.LogicalExpression: 1.17167 + case Syntax.BinaryExpression: 1.17168 + currentPrecedence = BinaryPrecedence[expr.operator]; 1.17169 + allowIn |= currentPrecedence < precedence; 1.17170 + result = join(generateExpression(expr.left, { 1.17171 + precedence: currentPrecedence, 1.17172 + allowIn: allowIn, 1.17173 + allowCall: true 1.17174 + }), expr.operator); 1.17175 + fragment = generateExpression(expr.right, { 1.17176 + precedence: currentPrecedence + 1, 1.17177 + allowIn: allowIn, 1.17178 + allowCall: true 1.17179 + }); 1.17180 + if (expr.operator === '/' && result.charAt(result.length - 1) === '/') { 1.17181 + result += ' ' + fragment; 1.17182 + } else { 1.17183 + result = join(result, fragment); 1.17184 + } 1.17185 + if (expr.operator === 'in' && !allowIn) { 1.17186 + result = '(' + result + ')'; 1.17187 + } else { 1.17188 + result = parenthesize(result, currentPrecedence, precedence); 1.17189 + } 1.17190 + break; 1.17191 + case Syntax.CallExpression: 1.17192 + result = generateExpression(expr.callee, { 1.17193 + precedence: Precedence.Call, 1.17194 + allowIn: true, 1.17195 + allowCall: true, 1.17196 + allowUnparenthesizedNew: false 1.17197 + }); 1.17198 + result += '('; 1.17199 + for (i = 0, len = expr['arguments'].length; i < len; i += 1) { 1.17200 + result += generateExpression(expr['arguments'][i], { 1.17201 + precedence: Precedence.Assignment, 1.17202 + allowIn: true, 1.17203 + allowCall: true 1.17204 + }); 1.17205 + if (i + 1 < len) { 1.17206 + result += ',' + space; 1.17207 + } 1.17208 + } 1.17209 + result += ')'; 1.17210 + if (!allowCall) { 1.17211 + result = '(' + result + ')'; 1.17212 + } else { 1.17213 + result = parenthesize(result, Precedence.Call, precedence); 1.17214 + } 1.17215 + break; 1.17216 + case Syntax.NewExpression: 1.17217 + len = expr['arguments'].length; 1.17218 + allowUnparenthesizedNew = option.allowUnparenthesizedNew === undefined || option.allowUnparenthesizedNew; 1.17219 + result = join('new', generateExpression(expr.callee, { 1.17220 + precedence: Precedence.New, 1.17221 + allowIn: true, 1.17222 + allowCall: false, 1.17223 + allowUnparenthesizedNew: allowUnparenthesizedNew && !parentheses && len === 0 1.17224 + })); 1.17225 + if (!allowUnparenthesizedNew || parentheses || len > 0) { 1.17226 + result += '('; 1.17227 + for (i = 0; i < len; i += 1) { 1.17228 + result += generateExpression(expr['arguments'][i], { 1.17229 + precedence: Precedence.Assignment, 1.17230 + allowIn: true, 1.17231 + allowCall: true 1.17232 + }); 1.17233 + if (i + 1 < len) { 1.17234 + result += ',' + space; 1.17235 + } 1.17236 + } 1.17237 + result += ')'; 1.17238 + } 1.17239 + result = parenthesize(result, Precedence.New, precedence); 1.17240 + break; 1.17241 + case Syntax.MemberExpression: 1.17242 + result = generateExpression(expr.object, { 1.17243 + precedence: Precedence.Call, 1.17244 + allowIn: true, 1.17245 + allowCall: allowCall, 1.17246 + allowUnparenthesizedNew: false 1.17247 + }); 1.17248 + if (expr.computed) { 1.17249 + result += '[' + generateExpression(expr.property, { 1.17250 + precedence: Precedence.Sequence, 1.17251 + allowIn: true, 1.17252 + allowCall: allowCall 1.17253 + }) + ']'; 1.17254 + } else { 1.17255 + if (expr.object.type === Syntax.Literal && typeof expr.object.value === 'number') { 1.17256 + if (result.indexOf('.') < 0) { 1.17257 + if (!/[eExX]/.test(result) && !(result.length >= 2 && result[0] === '0')) { 1.17258 + result += '.'; 1.17259 + } 1.17260 + } 1.17261 + } 1.17262 + result += '.' + expr.property.name; 1.17263 + } 1.17264 + result = parenthesize(result, Precedence.Member, precedence); 1.17265 + break; 1.17266 + case Syntax.UnaryExpression: 1.17267 + fragment = generateExpression(expr.argument, { 1.17268 + precedence: Precedence.Unary + (expr.argument.type === Syntax.UnaryExpression && expr.operator.length < 3 && expr.argument.operator === expr.operator ? 1 : 0), 1.17269 + allowIn: true, 1.17270 + allowCall: true 1.17271 + }); 1.17272 + if (space === '') { 1.17273 + result = join(expr.operator, fragment); 1.17274 + } else { 1.17275 + result = expr.operator; 1.17276 + if (result.length > 2) { 1.17277 + result += ' '; 1.17278 + } 1.17279 + result += fragment; 1.17280 + } 1.17281 + result = parenthesize(result, Precedence.Unary, precedence); 1.17282 + break; 1.17283 + case Syntax.UpdateExpression: 1.17284 + if (expr.prefix) { 1.17285 + result = parenthesize(expr.operator + generateExpression(expr.argument, { 1.17286 + precedence: Precedence.Unary, 1.17287 + allowIn: true, 1.17288 + allowCall: true 1.17289 + }), Precedence.Unary, precedence); 1.17290 + } else { 1.17291 + result = parenthesize(generateExpression(expr.argument, { 1.17292 + precedence: Precedence.Postfix, 1.17293 + allowIn: true, 1.17294 + allowCall: true 1.17295 + }) + expr.operator, Precedence.Postfix, precedence); 1.17296 + } 1.17297 + break; 1.17298 + case Syntax.FunctionExpression: 1.17299 + result = 'function'; 1.17300 + if (expr.id) { 1.17301 + result += ' ' + expr.id.name; 1.17302 + } else { 1.17303 + result += space; 1.17304 + } 1.17305 + result += generateFunctionBody(expr); 1.17306 + break; 1.17307 + case Syntax.ArrayExpression: 1.17308 + if (!expr.elements.length) { 1.17309 + result = '[]'; 1.17310 + break; 1.17311 + } 1.17312 + result = '[' + newline; 1.17313 + previousBase = base; 1.17314 + base += indent; 1.17315 + for (i = 0, len = expr.elements.length; i < len; i += 1) { 1.17316 + if (!expr.elements[i]) { 1.17317 + result += addIndent(''); 1.17318 + if (i + 1 === len) { 1.17319 + result += ','; 1.17320 + } 1.17321 + } else { 1.17322 + result += addIndent(generateExpression(expr.elements[i], { 1.17323 + precedence: Precedence.Assignment, 1.17324 + allowIn: true, 1.17325 + allowCall: true 1.17326 + })); 1.17327 + } 1.17328 + if (i + 1 < len) { 1.17329 + result += ',' + newline; 1.17330 + } 1.17331 + } 1.17332 + base = previousBase; 1.17333 + if (!endsWithLineTerminator(result)) { 1.17334 + result += newline; 1.17335 + } 1.17336 + result += addIndent(']'); 1.17337 + break; 1.17338 + case Syntax.Property: 1.17339 + if (expr.kind === 'get' || expr.kind === 'set') { 1.17340 + result = expr.kind + ' ' + generateExpression(expr.key, { 1.17341 + precedence: Precedence.Sequence, 1.17342 + allowIn: true, 1.17343 + allowCall: true 1.17344 + }) + generateFunctionBody(expr.value); 1.17345 + } else { 1.17346 + result = generateExpression(expr.key, { 1.17347 + precedence: Precedence.Sequence, 1.17348 + allowIn: true, 1.17349 + allowCall: true 1.17350 + }) + ':' + space + generateExpression(expr.value, { 1.17351 + precedence: Precedence.Assignment, 1.17352 + allowIn: true, 1.17353 + allowCall: true 1.17354 + }); 1.17355 + } 1.17356 + break; 1.17357 + case Syntax.ObjectExpression: 1.17358 + if (!expr.properties.length) { 1.17359 + result = '{}'; 1.17360 + break; 1.17361 + } 1.17362 + result = '{' + newline; 1.17363 + previousBase = base; 1.17364 + base += indent; 1.17365 + for (i = 0, len = expr.properties.length; i < len; i += 1) { 1.17366 + result += addIndent(generateExpression(expr.properties[i], { 1.17367 + precedence: Precedence.Sequence, 1.17368 + allowIn: true, 1.17369 + allowCall: true 1.17370 + })); 1.17371 + if (i + 1 < len) { 1.17372 + result += ',' + newline; 1.17373 + } 1.17374 + } 1.17375 + base = previousBase; 1.17376 + if (!endsWithLineTerminator(result)) { 1.17377 + result += newline; 1.17378 + } 1.17379 + result += addIndent('}'); 1.17380 + break; 1.17381 + case Syntax.ThisExpression: 1.17382 + result = 'this'; 1.17383 + break; 1.17384 + case Syntax.Identifier: 1.17385 + result = expr.name; 1.17386 + break; 1.17387 + case Syntax.Literal: 1.17388 + if (expr.hasOwnProperty('raw') && parse) { 1.17389 + try { 1.17390 + raw = parse(expr.raw).body[0].expression; 1.17391 + if (raw.type === Syntax.Literal) { 1.17392 + if (raw.value === expr.value) { 1.17393 + result = expr.raw; 1.17394 + break; 1.17395 + } 1.17396 + } 1.17397 + } catch (e) { 1.17398 + } 1.17399 + } 1.17400 + if (expr.value === null) { 1.17401 + result = 'null'; 1.17402 + break; 1.17403 + } 1.17404 + if (typeof expr.value === 'string') { 1.17405 + result = escapeString(expr.value); 1.17406 + break; 1.17407 + } 1.17408 + if (typeof expr.value === 'number') { 1.17409 + result = generateNumber(expr.value); 1.17410 + break; 1.17411 + } 1.17412 + result = expr.value.toString(); 1.17413 + break; 1.17414 + default: 1.17415 + break; 1.17416 + } 1.17417 + if (result === undefined) { 1.17418 + throw new Error('Unknown expression type: ' + expr.type); 1.17419 + } 1.17420 + return result; 1.17421 + } 1.17422 + function generateStatement(stmt, option) { 1.17423 + var i, len, result, previousBase, node, allowIn, fragment, semicolon; 1.17424 + allowIn = true; 1.17425 + semicolon = ';'; 1.17426 + if (option) { 1.17427 + allowIn = option.allowIn === undefined || option.allowIn; 1.17428 + if (!semicolons && option.semicolonOptional === true) { 1.17429 + semicolon = ''; 1.17430 + } 1.17431 + } 1.17432 + switch (stmt.type) { 1.17433 + case Syntax.BlockStatement: 1.17434 + result = '{' + newline; 1.17435 + previousBase = base; 1.17436 + base += indent; 1.17437 + for (i = 0, len = stmt.body.length; i < len; i += 1) { 1.17438 + fragment = addIndent(generateStatement(stmt.body[i], { 1.17439 + semicolonOptional: i === len - 1 1.17440 + })); 1.17441 + result += fragment; 1.17442 + if (!endsWithLineTerminator(fragment)) { 1.17443 + result += newline; 1.17444 + } 1.17445 + } 1.17446 + base = previousBase; 1.17447 + result += addIndent('}'); 1.17448 + break; 1.17449 + case Syntax.BreakStatement: 1.17450 + if (stmt.label) { 1.17451 + result = 'break ' + stmt.label.name + semicolon; 1.17452 + } else { 1.17453 + result = 'break' + semicolon; 1.17454 + } 1.17455 + break; 1.17456 + case Syntax.ContinueStatement: 1.17457 + if (stmt.label) { 1.17458 + result = 'continue ' + stmt.label.name + semicolon; 1.17459 + } else { 1.17460 + result = 'continue' + semicolon; 1.17461 + } 1.17462 + break; 1.17463 + case Syntax.DoWhileStatement: 1.17464 + result = join('do', maybeBlock(stmt.body)); 1.17465 + result += maybeBlockSuffix(stmt.body, result); 1.17466 + result += 'while' + space + '(' + generateExpression(stmt.test, { 1.17467 + precedence: Precedence.Sequence, 1.17468 + allowIn: true, 1.17469 + allowCall: true 1.17470 + }) + ')' + semicolon; 1.17471 + break; 1.17472 + case Syntax.CatchClause: 1.17473 + previousBase = base; 1.17474 + base += indent; 1.17475 + result = 'catch' + space + '(' + generateExpression(stmt.param, { 1.17476 + precedence: Precedence.Sequence, 1.17477 + allowIn: true, 1.17478 + allowCall: true 1.17479 + }) + ')'; 1.17480 + base = previousBase; 1.17481 + result += maybeBlock(stmt.body); 1.17482 + break; 1.17483 + case Syntax.DebuggerStatement: 1.17484 + result = 'debugger' + semicolon; 1.17485 + break; 1.17486 + case Syntax.EmptyStatement: 1.17487 + result = ';'; 1.17488 + break; 1.17489 + case Syntax.ExpressionStatement: 1.17490 + result = generateExpression(stmt.expression, { 1.17491 + precedence: Precedence.Sequence, 1.17492 + allowIn: true, 1.17493 + allowCall: true 1.17494 + }); 1.17495 + if (result.charAt(0) === '{' || result.slice(0, 8) === 'function' && ' ('.indexOf(result.charAt(8)) >= 0) { 1.17496 + result = '(' + result + ')' + semicolon; 1.17497 + } else { 1.17498 + result += semicolon; 1.17499 + } 1.17500 + break; 1.17501 + case Syntax.VariableDeclarator: 1.17502 + if (stmt.init) { 1.17503 + result = stmt.id.name + space + '=' + space + generateExpression(stmt.init, { 1.17504 + precedence: Precedence.Assignment, 1.17505 + allowIn: allowIn, 1.17506 + allowCall: true 1.17507 + }); 1.17508 + } else { 1.17509 + result = stmt.id.name; 1.17510 + } 1.17511 + break; 1.17512 + case Syntax.VariableDeclaration: 1.17513 + result = stmt.kind; 1.17514 + if (stmt.declarations.length === 1 && stmt.declarations[0].init && stmt.declarations[0].init.type === Syntax.FunctionExpression) { 1.17515 + result += ' ' + generateStatement(stmt.declarations[0], { 1.17516 + allowIn: allowIn 1.17517 + }); 1.17518 + } else { 1.17519 + previousBase = base; 1.17520 + base += indent; 1.17521 + node = stmt.declarations[0]; 1.17522 + if (extra.comment && node.leadingComments) { 1.17523 + result += '\n' + addIndent(generateStatement(node, { 1.17524 + allowIn: allowIn 1.17525 + })); 1.17526 + } else { 1.17527 + result += ' ' + generateStatement(node, { 1.17528 + allowIn: allowIn 1.17529 + }); 1.17530 + } 1.17531 + for (i = 1, len = stmt.declarations.length; i < len; i += 1) { 1.17532 + node = stmt.declarations[i]; 1.17533 + if (extra.comment && node.leadingComments) { 1.17534 + result += ',' + newline + addIndent(generateStatement(node, { 1.17535 + allowIn: allowIn 1.17536 + })); 1.17537 + } else { 1.17538 + result += ',' + space + generateStatement(node, { 1.17539 + allowIn: allowIn 1.17540 + }); 1.17541 + } 1.17542 + } 1.17543 + base = previousBase; 1.17544 + } 1.17545 + result += semicolon; 1.17546 + break; 1.17547 + case Syntax.ThrowStatement: 1.17548 + result = join('throw', generateExpression(stmt.argument, { 1.17549 + precedence: Precedence.Sequence, 1.17550 + allowIn: true, 1.17551 + allowCall: true 1.17552 + })) + semicolon; 1.17553 + break; 1.17554 + case Syntax.TryStatement: 1.17555 + result = 'try' + maybeBlock(stmt.block); 1.17556 + result += maybeBlockSuffix(stmt.block, result); 1.17557 + for (i = 0, len = stmt.handlers.length; i < len; i += 1) { 1.17558 + result += generateStatement(stmt.handlers[i]); 1.17559 + if (stmt.finalizer || i + 1 !== len) { 1.17560 + result += maybeBlockSuffix(stmt.handlers[i].body, result); 1.17561 + } 1.17562 + } 1.17563 + if (stmt.finalizer) { 1.17564 + result += 'finally' + maybeBlock(stmt.finalizer); 1.17565 + } 1.17566 + break; 1.17567 + case Syntax.SwitchStatement: 1.17568 + previousBase = base; 1.17569 + base += indent; 1.17570 + result = 'switch' + space + '(' + generateExpression(stmt.discriminant, { 1.17571 + precedence: Precedence.Sequence, 1.17572 + allowIn: true, 1.17573 + allowCall: true 1.17574 + }) + ')' + space + '{' + newline; 1.17575 + base = previousBase; 1.17576 + if (stmt.cases) { 1.17577 + for (i = 0, len = stmt.cases.length; i < len; i += 1) { 1.17578 + fragment = addIndent(generateStatement(stmt.cases[i], { 1.17579 + semicolonOptional: i === len - 1 1.17580 + })); 1.17581 + result += fragment; 1.17582 + if (!endsWithLineTerminator(fragment)) { 1.17583 + result += newline; 1.17584 + } 1.17585 + } 1.17586 + } 1.17587 + result += addIndent('}'); 1.17588 + break; 1.17589 + case Syntax.SwitchCase: 1.17590 + previousBase = base; 1.17591 + base += indent; 1.17592 + if (stmt.test) { 1.17593 + result = join('case', generateExpression(stmt.test, { 1.17594 + precedence: Precedence.Sequence, 1.17595 + allowIn: true, 1.17596 + allowCall: true 1.17597 + })) + ':'; 1.17598 + } else { 1.17599 + result = 'default:'; 1.17600 + } 1.17601 + i = 0; 1.17602 + len = stmt.consequent.length; 1.17603 + if (len && stmt.consequent[0].type === Syntax.BlockStatement) { 1.17604 + fragment = maybeBlock(stmt.consequent[0]); 1.17605 + result += fragment; 1.17606 + i = 1; 1.17607 + } 1.17608 + if (i !== len && !endsWithLineTerminator(result)) { 1.17609 + result += newline; 1.17610 + } 1.17611 + for (; i < len; i += 1) { 1.17612 + fragment = addIndent(generateStatement(stmt.consequent[i], { 1.17613 + semicolonOptional: i === len - 1 && semicolon === '' 1.17614 + })); 1.17615 + result += fragment; 1.17616 + if (i + 1 !== len && !endsWithLineTerminator(fragment)) { 1.17617 + result += newline; 1.17618 + } 1.17619 + } 1.17620 + base = previousBase; 1.17621 + break; 1.17622 + case Syntax.IfStatement: 1.17623 + previousBase = base; 1.17624 + base += indent; 1.17625 + if (stmt.alternate) { 1.17626 + if (stmt.alternate.type === Syntax.IfStatement) { 1.17627 + result = 'if' + space + '(' + generateExpression(stmt.test, { 1.17628 + precedence: Precedence.Sequence, 1.17629 + allowIn: true, 1.17630 + allowCall: true 1.17631 + }) + ')'; 1.17632 + base = previousBase; 1.17633 + result += maybeBlock(stmt.consequent); 1.17634 + result += maybeBlockSuffix(stmt.consequent, result); 1.17635 + result += 'else ' + generateStatement(stmt.alternate); 1.17636 + } else { 1.17637 + result = 'if' + space + '(' + generateExpression(stmt.test, { 1.17638 + precedence: Precedence.Sequence, 1.17639 + allowIn: true, 1.17640 + allowCall: true 1.17641 + }) + ')'; 1.17642 + base = previousBase; 1.17643 + result += maybeBlock(stmt.consequent); 1.17644 + result += maybeBlockSuffix(stmt.consequent, result); 1.17645 + result += 'else'; 1.17646 + result = join(result, maybeBlock(stmt.alternate, semicolon === '')); 1.17647 + } 1.17648 + } else { 1.17649 + result = 'if' + space + '(' + generateExpression(stmt.test, { 1.17650 + precedence: Precedence.Sequence, 1.17651 + allowIn: true, 1.17652 + allowCall: true 1.17653 + }) + ')'; 1.17654 + base = previousBase; 1.17655 + result += maybeBlock(stmt.consequent, semicolon === ''); 1.17656 + } 1.17657 + break; 1.17658 + case Syntax.ForStatement: 1.17659 + previousBase = base; 1.17660 + base += indent; 1.17661 + result = 'for' + space + '('; 1.17662 + if (stmt.init) { 1.17663 + if (stmt.init.type === Syntax.VariableDeclaration) { 1.17664 + result += generateStatement(stmt.init, { 1.17665 + allowIn: false 1.17666 + }); 1.17667 + } else { 1.17668 + result += generateExpression(stmt.init, { 1.17669 + precedence: Precedence.Sequence, 1.17670 + allowIn: false, 1.17671 + allowCall: true 1.17672 + }) + ';'; 1.17673 + } 1.17674 + } else { 1.17675 + result += ';'; 1.17676 + } 1.17677 + if (stmt.test) { 1.17678 + result += space + generateExpression(stmt.test, { 1.17679 + precedence: Precedence.Sequence, 1.17680 + allowIn: true, 1.17681 + allowCall: true 1.17682 + }) + ';'; 1.17683 + } else { 1.17684 + result += ';'; 1.17685 + } 1.17686 + if (stmt.update) { 1.17687 + result += space + generateExpression(stmt.update, { 1.17688 + precedence: Precedence.Sequence, 1.17689 + allowIn: true, 1.17690 + allowCall: true 1.17691 + }) + ')'; 1.17692 + } else { 1.17693 + result += ')'; 1.17694 + } 1.17695 + base = previousBase; 1.17696 + result += maybeBlock(stmt.body, semicolon === ''); 1.17697 + break; 1.17698 + case Syntax.ForInStatement: 1.17699 + result = 'for' + space + '('; 1.17700 + if (stmt.left.type === Syntax.VariableDeclaration) { 1.17701 + previousBase = base; 1.17702 + base += indent + indent; 1.17703 + result += stmt.left.kind + ' ' + generateStatement(stmt.left.declarations[0], { 1.17704 + allowIn: false 1.17705 + }); 1.17706 + base = previousBase; 1.17707 + } else { 1.17708 + previousBase = base; 1.17709 + base += indent; 1.17710 + result += generateExpression(stmt.left, { 1.17711 + precedence: Precedence.Call, 1.17712 + allowIn: true, 1.17713 + allowCall: true 1.17714 + }); 1.17715 + base = previousBase; 1.17716 + } 1.17717 + previousBase = base; 1.17718 + base += indent; 1.17719 + result = join(result, 'in'); 1.17720 + result = join(result, generateExpression(stmt.right, { 1.17721 + precedence: Precedence.Sequence, 1.17722 + allowIn: true, 1.17723 + allowCall: true 1.17724 + })) + ')'; 1.17725 + base = previousBase; 1.17726 + result += maybeBlock(stmt.body, semicolon === ''); 1.17727 + break; 1.17728 + case Syntax.LabeledStatement: 1.17729 + result = stmt.label.name + ':' + maybeBlock(stmt.body, semicolon === ''); 1.17730 + break; 1.17731 + case Syntax.Program: 1.17732 + result = ''; 1.17733 + for (i = 0, len = stmt.body.length; i < len; i += 1) { 1.17734 + fragment = addIndent(generateStatement(stmt.body[i], { 1.17735 + semicolonOptional: i === len - 1 1.17736 + })); 1.17737 + result += fragment; 1.17738 + if (i + 1 < len && !endsWithLineTerminator(fragment)) { 1.17739 + result += newline; 1.17740 + } 1.17741 + } 1.17742 + break; 1.17743 + case Syntax.FunctionDeclaration: 1.17744 + result = 'function' + space; 1.17745 + if (stmt.id) { 1.17746 + result += (space === '' ? ' ' : '') + stmt.id.name; 1.17747 + } 1.17748 + result += generateFunctionBody(stmt); 1.17749 + break; 1.17750 + case Syntax.ReturnStatement: 1.17751 + if (stmt.argument) { 1.17752 + result = join('return', generateExpression(stmt.argument, { 1.17753 + precedence: Precedence.Sequence, 1.17754 + allowIn: true, 1.17755 + allowCall: true 1.17756 + })) + semicolon; 1.17757 + } else { 1.17758 + result = 'return' + semicolon; 1.17759 + } 1.17760 + break; 1.17761 + case Syntax.WhileStatement: 1.17762 + previousBase = base; 1.17763 + base += indent; 1.17764 + result = 'while' + space + '(' + generateExpression(stmt.test, { 1.17765 + precedence: Precedence.Sequence, 1.17766 + allowIn: true, 1.17767 + allowCall: true 1.17768 + }) + ')'; 1.17769 + base = previousBase; 1.17770 + result += maybeBlock(stmt.body, semicolon === ''); 1.17771 + break; 1.17772 + case Syntax.WithStatement: 1.17773 + previousBase = base; 1.17774 + base += indent; 1.17775 + result = 'with' + space + '(' + generateExpression(stmt.object, { 1.17776 + precedence: Precedence.Sequence, 1.17777 + allowIn: true, 1.17778 + allowCall: true 1.17779 + }) + ')'; 1.17780 + base = previousBase; 1.17781 + result += maybeBlock(stmt.body, semicolon === ''); 1.17782 + break; 1.17783 + default: 1.17784 + break; 1.17785 + } 1.17786 + if (result === undefined) { 1.17787 + throw new Error('Unknown statement type: ' + stmt.type); 1.17788 + } 1.17789 + if (extra.comment) { 1.17790 + return addCommentsToStatement(stmt, result); 1.17791 + } 1.17792 + return result; 1.17793 + } 1.17794 + function generate(node, options) { 1.17795 + var defaultOptions = getDefaultOptions(); 1.17796 + if (typeof options !== 'undefined') { 1.17797 + if (typeof options.indent === 'string') { 1.17798 + defaultOptions.format.indent.style = options.indent; 1.17799 + } 1.17800 + if (typeof options.base === 'number') { 1.17801 + defaultOptions.format.indent.base = options.base; 1.17802 + } 1.17803 + options = updateDeeply(defaultOptions, options); 1.17804 + indent = options.format.indent.style; 1.17805 + if (typeof options.base === 'string') { 1.17806 + base = options.base; 1.17807 + } else { 1.17808 + base = stringRepeat(indent, options.format.indent.base); 1.17809 + } 1.17810 + } else { 1.17811 + options = defaultOptions; 1.17812 + indent = options.format.indent.style; 1.17813 + base = stringRepeat(indent, options.format.indent.base); 1.17814 + } 1.17815 + json = options.format.json; 1.17816 + renumber = options.format.renumber; 1.17817 + hexadecimal = json ? false : options.format.hexadecimal; 1.17818 + quotes = json ? 'double' : options.format.quotes; 1.17819 + escapeless = options.format.escapeless; 1.17820 + if (options.format.compact) { 1.17821 + newline = space = indent = base = ''; 1.17822 + } else { 1.17823 + newline = '\n'; 1.17824 + space = ' '; 1.17825 + } 1.17826 + parentheses = options.format.parentheses; 1.17827 + semicolons = options.format.semicolons; 1.17828 + parse = json ? null : options.parse; 1.17829 + extra = options; 1.17830 + switch (node.type) { 1.17831 + case Syntax.BlockStatement: 1.17832 + case Syntax.BreakStatement: 1.17833 + case Syntax.CatchClause: 1.17834 + case Syntax.ContinueStatement: 1.17835 + case Syntax.DoWhileStatement: 1.17836 + case Syntax.DebuggerStatement: 1.17837 + case Syntax.EmptyStatement: 1.17838 + case Syntax.ExpressionStatement: 1.17839 + case Syntax.ForStatement: 1.17840 + case Syntax.ForInStatement: 1.17841 + case Syntax.FunctionDeclaration: 1.17842 + case Syntax.IfStatement: 1.17843 + case Syntax.LabeledStatement: 1.17844 + case Syntax.Program: 1.17845 + case Syntax.ReturnStatement: 1.17846 + case Syntax.SwitchStatement: 1.17847 + case Syntax.SwitchCase: 1.17848 + case Syntax.ThrowStatement: 1.17849 + case Syntax.TryStatement: 1.17850 + case Syntax.VariableDeclaration: 1.17851 + case Syntax.VariableDeclarator: 1.17852 + case Syntax.WhileStatement: 1.17853 + case Syntax.WithStatement: 1.17854 + return generateStatement(node); 1.17855 + case Syntax.AssignmentExpression: 1.17856 + case Syntax.ArrayExpression: 1.17857 + case Syntax.BinaryExpression: 1.17858 + case Syntax.CallExpression: 1.17859 + case Syntax.ConditionalExpression: 1.17860 + case Syntax.FunctionExpression: 1.17861 + case Syntax.Identifier: 1.17862 + case Syntax.Literal: 1.17863 + case Syntax.LogicalExpression: 1.17864 + case Syntax.MemberExpression: 1.17865 + case Syntax.NewExpression: 1.17866 + case Syntax.ObjectExpression: 1.17867 + case Syntax.Property: 1.17868 + case Syntax.SequenceExpression: 1.17869 + case Syntax.ThisExpression: 1.17870 + case Syntax.UnaryExpression: 1.17871 + case Syntax.UpdateExpression: 1.17872 + return generateExpression(node, { 1.17873 + precedence: Precedence.Sequence, 1.17874 + allowIn: true, 1.17875 + allowCall: true 1.17876 + }); 1.17877 + default: 1.17878 + break; 1.17879 + } 1.17880 + throw new Error('Unknown node type: ' + node.type); 1.17881 + } 1.17882 + VisitorKeys = { 1.17883 + AssignmentExpression: [ 1.17884 + 'left', 1.17885 + 'right' 1.17886 + ], 1.17887 + ArrayExpression: [ 1.17888 + 'elements' 1.17889 + ], 1.17890 + BlockStatement: [ 1.17891 + 'body' 1.17892 + ], 1.17893 + BinaryExpression: [ 1.17894 + 'left', 1.17895 + 'right' 1.17896 + ], 1.17897 + BreakStatement: [ 1.17898 + 'label' 1.17899 + ], 1.17900 + CallExpression: [ 1.17901 + 'callee', 1.17902 + 'arguments' 1.17903 + ], 1.17904 + CatchClause: [ 1.17905 + 'param', 1.17906 + 'body' 1.17907 + ], 1.17908 + ConditionalExpression: [ 1.17909 + 'test', 1.17910 + 'consequent', 1.17911 + 'alternate' 1.17912 + ], 1.17913 + ContinueStatement: [ 1.17914 + 'label' 1.17915 + ], 1.17916 + DoWhileStatement: [ 1.17917 + 'body', 1.17918 + 'test' 1.17919 + ], 1.17920 + DebuggerStatement: [], 1.17921 + EmptyStatement: [], 1.17922 + ExpressionStatement: [ 1.17923 + 'expression' 1.17924 + ], 1.17925 + ForStatement: [ 1.17926 + 'init', 1.17927 + 'test', 1.17928 + 'update', 1.17929 + 'body' 1.17930 + ], 1.17931 + ForInStatement: [ 1.17932 + 'left', 1.17933 + 'right', 1.17934 + 'body' 1.17935 + ], 1.17936 + FunctionDeclaration: [ 1.17937 + 'id', 1.17938 + 'params', 1.17939 + 'body' 1.17940 + ], 1.17941 + FunctionExpression: [ 1.17942 + 'id', 1.17943 + 'params', 1.17944 + 'body' 1.17945 + ], 1.17946 + Identifier: [], 1.17947 + IfStatement: [ 1.17948 + 'test', 1.17949 + 'consequent', 1.17950 + 'alternate' 1.17951 + ], 1.17952 + Literal: [], 1.17953 + LabeledStatement: [ 1.17954 + 'label', 1.17955 + 'body' 1.17956 + ], 1.17957 + LogicalExpression: [ 1.17958 + 'left', 1.17959 + 'right' 1.17960 + ], 1.17961 + MemberExpression: [ 1.17962 + 'object', 1.17963 + 'property' 1.17964 + ], 1.17965 + NewExpression: [ 1.17966 + 'callee', 1.17967 + 'arguments' 1.17968 + ], 1.17969 + ObjectExpression: [ 1.17970 + 'properties' 1.17971 + ], 1.17972 + Program: [ 1.17973 + 'body' 1.17974 + ], 1.17975 + Property: [ 1.17976 + 'key', 1.17977 + 'value' 1.17978 + ], 1.17979 + ReturnStatement: [ 1.17980 + 'argument' 1.17981 + ], 1.17982 + SequenceExpression: [ 1.17983 + 'expressions' 1.17984 + ], 1.17985 + SwitchStatement: [ 1.17986 + 'descriminant', 1.17987 + 'cases' 1.17988 + ], 1.17989 + SwitchCase: [ 1.17990 + 'test', 1.17991 + 'consequent' 1.17992 + ], 1.17993 + ThisExpression: [], 1.17994 + ThrowStatement: [ 1.17995 + 'argument' 1.17996 + ], 1.17997 + TryStatement: [ 1.17998 + 'block', 1.17999 + 'handlers', 1.18000 + 'finalizer' 1.18001 + ], 1.18002 + UnaryExpression: [ 1.18003 + 'argument' 1.18004 + ], 1.18005 + UpdateExpression: [ 1.18006 + 'argument' 1.18007 + ], 1.18008 + VariableDeclaration: [ 1.18009 + 'declarations' 1.18010 + ], 1.18011 + VariableDeclarator: [ 1.18012 + 'id', 1.18013 + 'init' 1.18014 + ], 1.18015 + WhileStatement: [ 1.18016 + 'test', 1.18017 + 'body' 1.18018 + ], 1.18019 + WithStatement: [ 1.18020 + 'object', 1.18021 + 'body' 1.18022 + ], 1.18023 + PointerType: [ 1.18024 + 'base' 1.18025 + ], 1.18026 + StructType: [ 1.18027 + 'id', 1.18028 + 'fields' 1.18029 + ], 1.18030 + FieldDeclarator: [ 1.18031 + 'id', 1.18032 + 'decltype' 1.18033 + ], 1.18034 + ArrowType: [ 1.18035 + 'params', 1.18036 + 'return' 1.18037 + ], 1.18038 + TypeIdentifier: [], 1.18039 + TypeAliasDirective: [ 1.18040 + 'original', 1.18041 + 'alias' 1.18042 + ], 1.18043 + CastExpression: [ 1.18044 + 'as', 1.18045 + 'argument' 1.18046 + ] 1.18047 + }; 1.18048 + VisitorOption = { 1.18049 + Break: 1, 1.18050 + Skip: 2 1.18051 + }; 1.18052 + function traverse(top, visitor) { 1.18053 + var worklist, leavelist, node, ret, current, current2, candidates, candidate; 1.18054 + worklist = [ 1.18055 + top 1.18056 + ]; 1.18057 + leavelist = []; 1.18058 + while (worklist.length) { 1.18059 + node = worklist.pop(); 1.18060 + if (node) { 1.18061 + if (visitor.enter) { 1.18062 + ret = visitor.enter(node); 1.18063 + } else { 1.18064 + ret = undefined; 1.18065 + } 1.18066 + if (ret === VisitorOption.Break) { 1.18067 + return; 1.18068 + } 1.18069 + worklist.push(null); 1.18070 + leavelist.push(node); 1.18071 + if (ret !== VisitorOption.Skip) { 1.18072 + candidates = VisitorKeys[node.type]; 1.18073 + current = candidates.length; 1.18074 + while ((current -= 1) >= 0) { 1.18075 + candidate = node[candidates[current]]; 1.18076 + if (candidate) { 1.18077 + if (isArray(candidate)) { 1.18078 + current2 = candidate.length; 1.18079 + while ((current2 -= 1) >= 0) { 1.18080 + if (candidate[current2]) { 1.18081 + worklist.push(candidate[current2]); 1.18082 + } 1.18083 + } 1.18084 + } else { 1.18085 + worklist.push(candidate); 1.18086 + } 1.18087 + } 1.18088 + } 1.18089 + } 1.18090 + } else { 1.18091 + node = leavelist.pop(); 1.18092 + if (visitor.leave) { 1.18093 + ret = visitor.leave(node); 1.18094 + } else { 1.18095 + ret = undefined; 1.18096 + } 1.18097 + if (ret === VisitorOption.Break) { 1.18098 + return; 1.18099 + } 1.18100 + } 1.18101 + } 1.18102 + } 1.18103 + function upperBound(array, func) { 1.18104 + var diff, len, i, current; 1.18105 + len = array.length; 1.18106 + i = 0; 1.18107 + while (len) { 1.18108 + diff = len >>> 1; 1.18109 + current = i + diff; 1.18110 + if (func(array[current])) { 1.18111 + len = diff; 1.18112 + } else { 1.18113 + i = current + 1; 1.18114 + len -= diff + 1; 1.18115 + } 1.18116 + } 1.18117 + return i; 1.18118 + } 1.18119 + function lowerBound(array, func) { 1.18120 + var diff, len, i, current; 1.18121 + len = array.length; 1.18122 + i = 0; 1.18123 + while (len) { 1.18124 + diff = len >>> 1; 1.18125 + current = i + diff; 1.18126 + if (func(array[current])) { 1.18127 + i = current + 1; 1.18128 + len -= diff + 1; 1.18129 + } else { 1.18130 + len = diff; 1.18131 + } 1.18132 + } 1.18133 + return i; 1.18134 + } 1.18135 + function extendCommentRange(comment, tokens) { 1.18136 + var target, token; 1.18137 + target = upperBound(tokens, function search(token) { 1.18138 + return token.range[0] > comment.range[0]; 1.18139 + }); 1.18140 + comment.extendedRange = [ 1.18141 + comment.range[0], 1.18142 + comment.range[1] 1.18143 + ]; 1.18144 + if (target !== tokens.length) { 1.18145 + comment.extendedRange[1] = tokens[target].range[0]; 1.18146 + } 1.18147 + target -= 1; 1.18148 + if (target >= 0) { 1.18149 + if (target < tokens.length) { 1.18150 + comment.extendedRange[0] = tokens[target].range[1]; 1.18151 + } else if (token.length) { 1.18152 + comment.extendedRange[1] = tokens[tokens.length - 1].range[0]; 1.18153 + } 1.18154 + } 1.18155 + return comment; 1.18156 + } 1.18157 + function attachComments(tree, providedComments, tokens) { 1.18158 + var comments = [], comment, len, i; 1.18159 + if (!tree.range) { 1.18160 + throw new Error('attachComments needs range information'); 1.18161 + } 1.18162 + if (!tokens.length) { 1.18163 + if (providedComments.length) { 1.18164 + for (i = 0, len = providedComments.length; i < len; i += 1) { 1.18165 + comment = deepCopy(providedComments[i]); 1.18166 + comment.extendedRange = [ 1.18167 + 0, 1.18168 + tree.range[0] 1.18169 + ]; 1.18170 + comments.push(comment); 1.18171 + } 1.18172 + tree.leadingComments = comments; 1.18173 + } 1.18174 + return tree; 1.18175 + } 1.18176 + for (i = 0, len = providedComments.length; i < len; i += 1) { 1.18177 + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); 1.18178 + } 1.18179 + traverse(tree, { 1.18180 + cursor: 0, 1.18181 + enter: function (node) { 1.18182 + var comment; 1.18183 + while (this.cursor < comments.length) { 1.18184 + comment = comments[this.cursor]; 1.18185 + if (comment.extendedRange[1] > node.range[0]) { 1.18186 + break; 1.18187 + } 1.18188 + if (comment.extendedRange[1] === node.range[0]) { 1.18189 + if (!node.leadingComments) { 1.18190 + node.leadingComments = []; 1.18191 + } 1.18192 + node.leadingComments.push(comment); 1.18193 + comments.splice(this.cursor, 1); 1.18194 + } else { 1.18195 + this.cursor += 1; 1.18196 + } 1.18197 + } 1.18198 + if (this.cursor === comments.length) { 1.18199 + return VisitorOption.Break; 1.18200 + } 1.18201 + if (comments[this.cursor].extendedRange[0] > node.range[1]) { 1.18202 + return VisitorOption.Skip; 1.18203 + } 1.18204 + } 1.18205 + }); 1.18206 + traverse(tree, { 1.18207 + cursor: 0, 1.18208 + leave: function (node) { 1.18209 + var comment; 1.18210 + while (this.cursor < comments.length) { 1.18211 + comment = comments[this.cursor]; 1.18212 + if (node.range[1] < comment.extendedRange[0]) { 1.18213 + break; 1.18214 + } 1.18215 + if (node.range[1] === comment.extendedRange[0]) { 1.18216 + if (!node.trailingComments) { 1.18217 + node.trailingComments = []; 1.18218 + } 1.18219 + node.trailingComments.push(comment); 1.18220 + comments.splice(this.cursor, 1); 1.18221 + } else { 1.18222 + this.cursor += 1; 1.18223 + } 1.18224 + } 1.18225 + if (this.cursor === comments.length) { 1.18226 + return VisitorOption.Break; 1.18227 + } 1.18228 + if (comments[this.cursor].extendedRange[0] > node.range[1]) { 1.18229 + return VisitorOption.Skip; 1.18230 + } 1.18231 + } 1.18232 + }); 1.18233 + return tree; 1.18234 + } 1.18235 + exports.version = '0.0.6-dev'; 1.18236 + exports.generate = generate; 1.18237 + exports.traverse = traverse; 1.18238 + exports.attachComments = attachComments; 1.18239 +}(typeof exports === 'undefined' ? escodegen = {} : exports)); 1.18240 +var verifierOptions = systemOptions.register(new OptionSet('Verifier Options')); 1.18241 +var verifierTraceLevel = verifierOptions.register(new Option('tv', 'tv', 'number', 0, 'Verifier Trace Level')); 1.18242 +var Type = function () { 1.18243 + function type() { 1.18244 + unexpected('Type is Abstract'); 1.18245 + } 1.18246 + type.prototype.equals = function (other) { 1.18247 + return this === other; 1.18248 + }; 1.18249 + type.prototype.merge = function (other) { 1.18250 + unexpected('Merging ' + this + ' with ' + other); 1.18251 + }; 1.18252 + type.cache = { 1.18253 + name: {}, 1.18254 + classInfo: [], 1.18255 + instanceInfo: [], 1.18256 + scriptInfo: [], 1.18257 + methodInfo: [] 1.18258 + }; 1.18259 + type.from = function from(x, domain) { 1.18260 + var traitsTypeCache = null; 1.18261 + if (x instanceof ClassInfo) { 1.18262 + traitsTypeCache = type.cache.classInfo; 1.18263 + } else if (x instanceof InstanceInfo) { 1.18264 + traitsTypeCache = type.cache.instanceInfo; 1.18265 + } else if (x instanceof ScriptInfo) { 1.18266 + traitsTypeCache = type.cache.scriptInfo; 1.18267 + } 1.18268 + if (traitsTypeCache) { 1.18269 + return traitsTypeCache[x.runtimeId] || (traitsTypeCache[x.runtimeId] = new TraitsType(x, domain)); 1.18270 + } 1.18271 + if (x instanceof ActivationInfo) { 1.18272 + return new TraitsType(x.methodInfo); 1.18273 + } else if (x instanceof Global) { 1.18274 + return new TraitsType(x.scriptInfo); 1.18275 + } else if (x instanceof Interface) { 1.18276 + return new TraitsType(x.classInfo, domain); 1.18277 + } else if (x instanceof MethodInfo) { 1.18278 + return new MethodType(x); 1.18279 + } else if (domain && x instanceof Class) { 1.18280 + return type.from(x.classInfo, domain); 1.18281 + } 1.18282 + return Type.Any; 1.18283 + }; 1.18284 + type.fromSimpleName = function (name, domain) { 1.18285 + return Type.fromName(Multiname.fromSimpleName(name), domain); 1.18286 + }; 1.18287 + type.fromName = function fromName(mn, domain) { 1.18288 + if (mn === undefined) { 1.18289 + return Type.Undefined; 1.18290 + } else { 1.18291 + var qn = Multiname.isQName(mn) ? Multiname.getFullQualifiedName(mn) : undefined; 1.18292 + if (qn) { 1.18293 + var ty = type.cache.name[qn]; 1.18294 + if (ty) { 1.18295 + return ty; 1.18296 + } 1.18297 + } 1.18298 + if (qn === Multiname.getPublicQualifiedName('void')) { 1.18299 + return Type.Void; 1.18300 + } 1.18301 + true; 1.18302 + ty = domain.findClassInfo(mn); 1.18303 + ty = ty ? type.from(ty, domain) : Type.Any; 1.18304 + if (mn.hasTypeParameter()) { 1.18305 + ty = new ParameterizedType(ty, type.fromName(mn.typeParameter, domain)); 1.18306 + } 1.18307 + return type.cache.name[qn] = ty; 1.18308 + } 1.18309 + }; 1.18310 + type.prototype.applyType = function (parameter) { 1.18311 + return new ParameterizedType(this, parameter); 1.18312 + }; 1.18313 + type.prototype.toString = function () { 1.18314 + return '[type]'; 1.18315 + }; 1.18316 + type.prototype.isNumeric = function () { 1.18317 + return this === Type.Int || this === Type.Uint || this === Type.Number; 1.18318 + }; 1.18319 + type.prototype.isString = function () { 1.18320 + return this === Type.String; 1.18321 + }; 1.18322 + type.prototype.isDirectlyReadable = function () { 1.18323 + return this === Type.Array; 1.18324 + }; 1.18325 + type.prototype.isIndexedReadable = function () { 1.18326 + return this.isParameterizedType(); 1.18327 + }; 1.18328 + type.prototype.isDirectlyWriteable = function () { 1.18329 + return this === Type.Array; 1.18330 + }; 1.18331 + type.prototype.isIndexedWriteable = function () { 1.18332 + return this.isParameterizedType(); 1.18333 + }; 1.18334 + type.prototype.isVector = function () { 1.18335 + return this.isParameterizedType(); 1.18336 + }; 1.18337 + type.prototype.isNotDirectlyIndexable = function () { 1.18338 + return this === Type.Any || this === Type.XML || this === Type.XMLList || this === Type.Dictionary; 1.18339 + }; 1.18340 + type.prototype.isParameterizedType = function () { 1.18341 + return this instanceof ParameterizedType; 1.18342 + }; 1.18343 + type.prototype.instanceType = function () { 1.18344 + return this; 1.18345 + }; 1.18346 + type.prototype.getTrait = function () { 1.18347 + return null; 1.18348 + }; 1.18349 + type.prototype.super = function () { 1.18350 + unexpected('Can\'t call super on ' + this); 1.18351 + }; 1.18352 + type.prototype.isSubtypeOf = function (other) { 1.18353 + if (this === other || this.equals(other)) { 1.18354 + return true; 1.18355 + } 1.18356 + return this.merge(other) === this; 1.18357 + }; 1.18358 + var typesInitialized = false; 1.18359 + type.initializeTypes = function (domain) { 1.18360 + if (typesInitialized) { 1.18361 + return; 1.18362 + } 1.18363 + type.Any = new AtomType('Any'); 1.18364 + type.Null = new AtomType('Null'); 1.18365 + type.Undefined = new AtomType('Undefined'); 1.18366 + type.Void = new AtomType('Void'); 1.18367 + type.Int = Type.fromSimpleName('int', domain).instanceType(); 1.18368 + type.Uint = Type.fromSimpleName('uint', domain).instanceType(); 1.18369 + type.Class = Type.fromSimpleName('Class', domain).instanceType(); 1.18370 + type.Array = Type.fromSimpleName('Array', domain).instanceType(); 1.18371 + type.Object = Type.fromSimpleName('Object', domain).instanceType(); 1.18372 + type.String = Type.fromSimpleName('String', domain).instanceType(); 1.18373 + type.Number = Type.fromSimpleName('Number', domain).instanceType(); 1.18374 + type.Boolean = Type.fromSimpleName('Boolean', domain).instanceType(); 1.18375 + type.Function = Type.fromSimpleName('Function', domain).instanceType(); 1.18376 + type.XML = Type.fromSimpleName('XML', domain).instanceType(); 1.18377 + type.XMLList = Type.fromSimpleName('XMLList', domain).instanceType(); 1.18378 + type.Dictionary = Type.fromSimpleName('flash.utils.Dictionary', domain).instanceType(); 1.18379 + typesInitialized = true; 1.18380 + }; 1.18381 + return type; 1.18382 + }(); 1.18383 +var AtomType = function () { 1.18384 + function atomType(name) { 1.18385 + this.name = name; 1.18386 + } 1.18387 + atomType.prototype = Object.create(Type.prototype); 1.18388 + atomType.prototype.toString = function () { 1.18389 + if (this === Type.Any) { 1.18390 + return '?'; 1.18391 + } else if (this === Type.Undefined) { 1.18392 + return '_'; 1.18393 + } else if (this === Type.Null) { 1.18394 + return 'X'; 1.18395 + } else if (this === Type.Void) { 1.18396 + return 'V'; 1.18397 + } 1.18398 + unexpected(); 1.18399 + }; 1.18400 + atomType.prototype.merge = function merge(other) { 1.18401 + if (other instanceof TraitsType) { 1.18402 + return Type.Any; 1.18403 + } 1.18404 + if (this === other) { 1.18405 + return this; 1.18406 + } 1.18407 + if (this === Type.Any || other === Type.Any) { 1.18408 + return Type.Any; 1.18409 + } 1.18410 + return Type.Any; 1.18411 + }; 1.18412 + return atomType; 1.18413 + }(); 1.18414 +var MethodType = function () { 1.18415 + function methodType(methodInfo) { 1.18416 + this.methodInfo = methodInfo; 1.18417 + } 1.18418 + methodType.prototype = Object.create(Type.prototype); 1.18419 + methodType.prototype.toString = function () { 1.18420 + return 'MT ' + this.methodInfo; 1.18421 + }; 1.18422 + return methodType; 1.18423 + }(); 1.18424 +var TraitsType = function () { 1.18425 + function traitsType(object, domain) { 1.18426 + true; 1.18427 + this.object = object; 1.18428 + this.traits = object.traits; 1.18429 + this.domain = domain; 1.18430 + if (this.object instanceof InstanceInfo) { 1.18431 + true; 1.18432 + } 1.18433 + } 1.18434 + traitsType.prototype = Object.create(Type.prototype); 1.18435 + function nameOf(x) { 1.18436 + if (x instanceof ScriptInfo) { 1.18437 + return 'SI'; 1.18438 + } else if (x instanceof ClassInfo) { 1.18439 + return 'CI:' + x.instanceInfo.name.name; 1.18440 + } else if (x instanceof InstanceInfo) { 1.18441 + return 'II:' + x.name.name; 1.18442 + } else if (x instanceof MethodInfo) { 1.18443 + return 'MI'; 1.18444 + } else if (x instanceof ActivationInfo) { 1.18445 + return 'AC'; 1.18446 + } 1.18447 + true; 1.18448 + } 1.18449 + function findTraitBySlotId(traits, slotId) { 1.18450 + for (var i = traits.length - 1; i >= 0; i--) { 1.18451 + if (traits[i].slotId === slotId) { 1.18452 + return traits[i]; 1.18453 + } 1.18454 + } 1.18455 + unexpected('Cannot find trait with slotId: ' + slotId + ' in ' + traits); 1.18456 + } 1.18457 + function findTraitByName(traits, mn, isSetter) { 1.18458 + var isGetter = !isSetter; 1.18459 + var trait; 1.18460 + if (!Multiname.isQName(mn)) { 1.18461 + if (mn instanceof MultinameType) { 1.18462 + return; 1.18463 + } 1.18464 + true; 1.18465 + var dy; 1.18466 + for (var i = 0, j = mn.namespaces.length; i < j; i++) { 1.18467 + var qn = mn.getQName(i); 1.18468 + if (mn.namespaces[i].isDynamic()) { 1.18469 + dy = qn; 1.18470 + } else { 1.18471 + if (trait = findTraitByName(traits, qn, isSetter)) { 1.18472 + return trait; 1.18473 + } 1.18474 + } 1.18475 + } 1.18476 + if (dy) { 1.18477 + return findTraitByName(traits, dy, isSetter); 1.18478 + } 1.18479 + } else { 1.18480 + var qn = Multiname.getQualifiedName(mn); 1.18481 + for (var i = 0, j = traits.length; i < j; i++) { 1.18482 + trait = traits[i]; 1.18483 + if (Multiname.getQualifiedName(trait.name) === qn) { 1.18484 + if (isSetter && trait.isGetter() || isGetter && trait.isSetter()) { 1.18485 + continue; 1.18486 + } 1.18487 + return trait; 1.18488 + } 1.18489 + } 1.18490 + } 1.18491 + } 1.18492 + traitsType.prototype.getTrait = function (mn, isSetter, followSuperType) { 1.18493 + if (mn instanceof MultinameType) { 1.18494 + return null; 1.18495 + } 1.18496 + if (mn.isAttribute()) { 1.18497 + return null; 1.18498 + } 1.18499 + if (followSuperType && (this.isInstanceInfo() || this.isClassInfo())) { 1.18500 + var that = this; 1.18501 + do { 1.18502 + var trait = that.getTrait(mn, isSetter, false); 1.18503 + if (!trait) { 1.18504 + that = that.super(); 1.18505 + } 1.18506 + } while (!trait && that); 1.18507 + return trait; 1.18508 + } else { 1.18509 + return findTraitByName(this.traits, mn, isSetter); 1.18510 + } 1.18511 + }; 1.18512 + traitsType.prototype.getTraitAt = function (i) { 1.18513 + if (this.object instanceof ScriptInfo || this.object instanceof MethodInfo) { 1.18514 + return findTraitBySlotId(this.traits, i); 1.18515 + } 1.18516 + }; 1.18517 + traitsType.prototype.toString = function () { 1.18518 + switch (this) { 1.18519 + case Type.Int: 1.18520 + return 'I'; 1.18521 + case Type.Uint: 1.18522 + return 'U'; 1.18523 + case Type.Array: 1.18524 + return 'A'; 1.18525 + case Type.Object: 1.18526 + return 'O'; 1.18527 + case Type.String: 1.18528 + return 'S'; 1.18529 + case Type.Number: 1.18530 + return 'N'; 1.18531 + case Type.Boolean: 1.18532 + return 'B'; 1.18533 + case Type.Function: 1.18534 + return 'F'; 1.18535 + } 1.18536 + return nameOf(this.object); 1.18537 + }; 1.18538 + traitsType.prototype.instanceType = function () { 1.18539 + true; 1.18540 + return this.instanceCache || (this.instanceCache = Type.from(this.object.instanceInfo, this.domain)); 1.18541 + }; 1.18542 + traitsType.prototype.classType = function () { 1.18543 + true; 1.18544 + return this.instanceCache || (this.instanceCache = Type.from(this.object.classInfo, this.domain)); 1.18545 + }; 1.18546 + traitsType.prototype.super = function () { 1.18547 + if (this.object instanceof ClassInfo) { 1.18548 + return Type.Class; 1.18549 + } 1.18550 + true; 1.18551 + if (this.object.superName) { 1.18552 + var result = Type.fromName(this.object.superName, this.domain).instanceType(); 1.18553 + true; 1.18554 + return result; 1.18555 + } 1.18556 + return null; 1.18557 + }; 1.18558 + traitsType.prototype.isScriptInfo = function () { 1.18559 + return this.object instanceof ScriptInfo; 1.18560 + }; 1.18561 + traitsType.prototype.isClassInfo = function () { 1.18562 + return this.object instanceof ClassInfo; 1.18563 + }; 1.18564 + traitsType.prototype.isInstanceInfo = function () { 1.18565 + return this.object instanceof InstanceInfo; 1.18566 + }; 1.18567 + traitsType.prototype.isInstanceOrClassInfo = function () { 1.18568 + return this.isInstanceInfo() || this.isClassInfo(); 1.18569 + }; 1.18570 + traitsType.prototype.equals = function (other) { 1.18571 + return this.traits === other.traits; 1.18572 + }; 1.18573 + traitsType.prototype.merge = function (other) { 1.18574 + if (other instanceof TraitsType) { 1.18575 + if (this.equals(other)) { 1.18576 + return this; 1.18577 + } 1.18578 + if (this.isNumeric() && other.isNumeric()) { 1.18579 + return Type.Number; 1.18580 + } 1.18581 + if (this.isInstanceInfo() && other.isInstanceInfo()) { 1.18582 + var path = []; 1.18583 + for (var curr = this; curr; curr = curr.super()) { 1.18584 + path.push(curr); 1.18585 + } 1.18586 + for (var curr = other; curr; curr = curr.super()) { 1.18587 + for (var i = 0; i < path.length; i++) { 1.18588 + if (path[i].equals(curr)) { 1.18589 + return curr; 1.18590 + } 1.18591 + } 1.18592 + } 1.18593 + return Type.Object; 1.18594 + } 1.18595 + } 1.18596 + return Type.Any; 1.18597 + }; 1.18598 + return traitsType; 1.18599 + }(); 1.18600 +var MultinameType = function () { 1.18601 + function multinameType(namespaces, name, flags) { 1.18602 + this.namespaces = namespaces; 1.18603 + this.name = name; 1.18604 + this.flags = flags; 1.18605 + } 1.18606 + multinameType.prototype = Object.create(Type.prototype); 1.18607 + multinameType.prototype.toString = function () { 1.18608 + return 'MN'; 1.18609 + }; 1.18610 + return multinameType; 1.18611 + }(); 1.18612 +var ParameterizedType = function () { 1.18613 + function parameterizedType(type, parameter) { 1.18614 + this.type = type; 1.18615 + this.parameter = parameter; 1.18616 + } 1.18617 + parameterizedType.prototype = Object.create(Type.prototype); 1.18618 + parameterizedType.prototype.toString = function () { 1.18619 + return this.type + '<' + this.parameter + '>'; 1.18620 + }; 1.18621 + parameterizedType.prototype.instanceType = function () { 1.18622 + true; 1.18623 + return new ParameterizedType(this.type.instanceType(), this.parameter.instanceType()); 1.18624 + }; 1.18625 + parameterizedType.prototype.equals = function (other) { 1.18626 + if (other instanceof ParameterizedType) { 1.18627 + return this.type.equals(other.type) && this.parameter.equals(other.parameter); 1.18628 + } 1.18629 + return false; 1.18630 + }; 1.18631 + parameterizedType.prototype.merge = function (other) { 1.18632 + if (other instanceof TraitsType) { 1.18633 + if (this.equals(other)) { 1.18634 + return this; 1.18635 + } 1.18636 + } 1.18637 + return Type.Any; 1.18638 + }; 1.18639 + return parameterizedType; 1.18640 + }(); 1.18641 +var TypeInformation = function () { 1.18642 + function typeInformation() { 1.18643 + } 1.18644 + typeInformation.prototype.toString = function () { 1.18645 + return toKeyValueArray(this).map(function (x) { 1.18646 + return x[0] + ': ' + x[1]; 1.18647 + }).join(' | '); 1.18648 + }; 1.18649 + return typeInformation; 1.18650 + }(); 1.18651 +var Verifier = function () { 1.18652 + function VerifierError(message) { 1.18653 + this.name = 'VerifierError'; 1.18654 + this.message = message || ''; 1.18655 + } 1.18656 + var State = function () { 1.18657 + var id = 0; 1.18658 + function state() { 1.18659 + this.id = id += 1; 1.18660 + this.stack = []; 1.18661 + this.scope = []; 1.18662 + this.local = []; 1.18663 + } 1.18664 + state.prototype.clone = function clone() { 1.18665 + var s = new State(); 1.18666 + s.originalId = this.id; 1.18667 + s.stack = this.stack.slice(0); 1.18668 + s.scope = this.scope.slice(0); 1.18669 + s.local = this.local.slice(0); 1.18670 + return s; 1.18671 + }; 1.18672 + state.prototype.trace = function trace(writer) { 1.18673 + writer.writeLn(this.toString()); 1.18674 + }; 1.18675 + state.prototype.toString = function () { 1.18676 + return '<' + this.id + (this.originalId ? ':' + this.originalId : '') + ', L[' + this.local.join(', ') + ']' + ', S[' + this.stack.join(', ') + ']' + ', $[' + this.scope.join(', ') + ']>'; 1.18677 + }; 1.18678 + state.prototype.equals = function (other) { 1.18679 + return arrayEquals(this.stack, other.stack) && arrayEquals(this.scope, other.scope) && arrayEquals(this.local, other.local); 1.18680 + }; 1.18681 + function arrayEquals(a, b) { 1.18682 + if (a.length != b.length) { 1.18683 + return false; 1.18684 + } 1.18685 + for (var i = a.length - 1; i >= 0; i--) { 1.18686 + if (!a[i].equals(b[i])) { 1.18687 + return false; 1.18688 + } 1.18689 + } 1.18690 + return true; 1.18691 + } 1.18692 + state.prototype.isSubset = function (other) { 1.18693 + return arraySubset(this.stack, other.stack) && arraySubset(this.scope, other.scope) && arraySubset(this.local, other.local); 1.18694 + }; 1.18695 + function arraySubset(a, b) { 1.18696 + if (a.length != b.length) { 1.18697 + return false; 1.18698 + } 1.18699 + for (var i = a.length - 1; i >= 0; i--) { 1.18700 + if (a[i] === b[i] || a[i].equals(b[i])) { 1.18701 + continue; 1.18702 + } 1.18703 + if (a[i].merge(b[i]) !== a[i]) { 1.18704 + return false; 1.18705 + } 1.18706 + } 1.18707 + return true; 1.18708 + } 1.18709 + state.prototype.merge = function (other) { 1.18710 + mergeArrays(this.local, other.local); 1.18711 + mergeArrays(this.stack, other.stack); 1.18712 + mergeArrays(this.scope, other.scope); 1.18713 + }; 1.18714 + function mergeArrays(a, b) { 1.18715 + true; 1.18716 + for (var i = a.length - 1; i >= 0; i--) { 1.18717 + true; 1.18718 + if (a[i] === b[i]) { 1.18719 + continue; 1.18720 + } 1.18721 + a[i] = a[i].merge(b[i]); 1.18722 + } 1.18723 + } 1.18724 + return state; 1.18725 + }(); 1.18726 + var Verification = function () { 1.18727 + function verification(methodInfo, domain, savedScope) { 1.18728 + this.savedScope = savedScope; 1.18729 + this.methodInfo = methodInfo; 1.18730 + this.domain = domain; 1.18731 + this.writer = new IndentingWriter(); 1.18732 + this.returnType = Type.Undefined; 1.18733 + } 1.18734 + verification.prototype.verify = function verify() { 1.18735 + var mi = this.methodInfo; 1.18736 + var writer = verifierTraceLevel.value ? this.writer : null; 1.18737 + var blocks = mi.analysis.blocks; 1.18738 + blocks.forEach(function (x) { 1.18739 + x.entryState = x.exitState = null; 1.18740 + }); 1.18741 + if (writer) { 1.18742 + this.methodInfo.trace(writer); 1.18743 + } 1.18744 + var entryState = new State(); 1.18745 + true; 1.18746 + this.thisType = mi.holder ? Type.from(mi.holder, this.domain) : Type.Any; 1.18747 + entryState.local.push(this.thisType); 1.18748 + for (var i = 0; i < mi.parameters.length; i++) { 1.18749 + entryState.local.push(Type.fromName(mi.parameters[i].type, this.domain).instanceType()); 1.18750 + } 1.18751 + var remainingLocals = mi.localCount - mi.parameters.length - 1; 1.18752 + if (mi.needsRest() || mi.needsArguments()) { 1.18753 + entryState.local.push(Type.Array); 1.18754 + remainingLocals -= 1; 1.18755 + } 1.18756 + for (var i = 0; i < remainingLocals; i++) { 1.18757 + entryState.local.push(Type.Undefined); 1.18758 + } 1.18759 + true; 1.18760 + if (writer) { 1.18761 + entryState.trace(writer); 1.18762 + } 1.18763 + for (var bi = 0, len = blocks.length; bi < len; bi++) { 1.18764 + blocks[bi].bdo = bi; 1.18765 + } 1.18766 + var worklist = new Shumway.SortedList(function compare(blockA, blockB) { 1.18767 + return blockA.bdo - blockB.bdo; 1.18768 + }); 1.18769 + blocks[0].entryState = entryState; 1.18770 + worklist.push(blocks[0]); 1.18771 + while (!worklist.isEmpty()) { 1.18772 + var block = worklist.pop(); 1.18773 + var exitState = block.exitState = block.entryState.clone(); 1.18774 + this.verifyBlock(block, exitState); 1.18775 + block.succs.forEach(function (successor) { 1.18776 + if (worklist.contains(successor)) { 1.18777 + if (writer) { 1.18778 + writer.writeLn('Forward Merged Block: ' + successor.bid + ' ' + exitState.toString() + ' with ' + successor.entryState.toString()); 1.18779 + } 1.18780 + successor.entryState.merge(exitState); 1.18781 + if (writer) { 1.18782 + writer.writeLn('Merged State: ' + successor.entryState); 1.18783 + } 1.18784 + return; 1.18785 + } 1.18786 + if (successor.entryState) { 1.18787 + if (!successor.entryState.isSubset(exitState)) { 1.18788 + if (writer) { 1.18789 + writer.writeLn('Backward Merged Block: ' + block.bid + ' with ' + successor.bid + ' ' + exitState.toString() + ' with ' + successor.entryState.toString()); 1.18790 + } 1.18791 + successor.entryState.merge(exitState); 1.18792 + worklist.push(successor); 1.18793 + if (writer) { 1.18794 + writer.writeLn('Merged State: ' + successor.entryState); 1.18795 + } 1.18796 + } 1.18797 + return; 1.18798 + } 1.18799 + successor.entryState = exitState.clone(); 1.18800 + worklist.push(successor); 1.18801 + if (writer) { 1.18802 + writer.writeLn('Added Block: ' + successor.bid + ' to worklist: ' + successor.entryState.toString()); 1.18803 + } 1.18804 + }); 1.18805 + } 1.18806 + if (writer) { 1.18807 + writer.writeLn('Inferred return type: ' + this.returnType); 1.18808 + } 1.18809 + this.methodInfo.inferredReturnType = this.returnType; 1.18810 + }; 1.18811 + verification.prototype.verifyBlock = function verifyBlock(block, state) { 1.18812 + var savedScope = this.savedScope; 1.18813 + var globalScope = savedScope[0]; 1.18814 + var local = state.local; 1.18815 + var stack = state.stack; 1.18816 + var scope = state.scope; 1.18817 + var writer = verifierTraceLevel.value ? this.writer : null; 1.18818 + var bytecodes = this.methodInfo.analysis.bytecodes; 1.18819 + var domain = this.domain; 1.18820 + var multinames = this.methodInfo.abc.constantPool.multinames; 1.18821 + var mi = this.methodInfo; 1.18822 + var bc, obj, fn, mn, l, r, val, type, returnType; 1.18823 + if (writer) { 1.18824 + writer.enter('verifyBlock: ' + block.bid + ', range: [' + block.position + ', ' + block.end.position + '], entryState: ' + state.toString() + ' {'); 1.18825 + } 1.18826 + function construct(obj) { 1.18827 + if (obj instanceof TraitsType || obj instanceof ParameterizedType) { 1.18828 + if (obj === Type.Function || obj === Type.Class || obj === Type.Object) { 1.18829 + return Type.Object; 1.18830 + } 1.18831 + return obj.instanceType(); 1.18832 + } else { 1.18833 + return Type.Any; 1.18834 + } 1.18835 + } 1.18836 + function ti() { 1.18837 + return bc.ti || (bc.ti = new TypeInformation()); 1.18838 + } 1.18839 + function push(x) { 1.18840 + true; 1.18841 + ti().type = x; 1.18842 + stack.push(x); 1.18843 + } 1.18844 + function pop() { 1.18845 + return stack.pop(); 1.18846 + } 1.18847 + function findProperty(mn, strict) { 1.18848 + if (mn instanceof MultinameType) { 1.18849 + if (mn.name === 'Array') { 1.18850 + debugger; 1.18851 + } 1.18852 + return Type.Any; 1.18853 + } 1.18854 + for (var i = scope.length - 1; i >= -savedScope.length; i--) { 1.18855 + var s = i >= 0 ? scope[i] : savedScope[savedScope.length + i]; 1.18856 + if (s instanceof TraitsType) { 1.18857 + var trait = s.getTrait(mn, false, true); 1.18858 + if (trait) { 1.18859 + ti().scopeDepth = scope.length - i - 1; 1.18860 + if (s.isClassInfo() || s.isScriptInfo()) { 1.18861 + ti().object = LazyInitializer.create(s.object); 1.18862 + } 1.18863 + return s; 1.18864 + } 1.18865 + } else { 1.18866 + if (mn.name === 'Array') { 1.18867 + debugger; 1.18868 + } 1.18869 + return Type.Any; 1.18870 + } 1.18871 + } 1.18872 + var resolved = domain.findDefiningScript(mn, false); 1.18873 + if (resolved) { 1.18874 + ti().object = LazyInitializer.create(resolved.script); 1.18875 + return Type.from(resolved.script, domain); 1.18876 + } 1.18877 + if (mn.name === 'Array') { 1.18878 + debugger; 1.18879 + } 1.18880 + return Type.Any; 1.18881 + } 1.18882 + function popMultiname() { 1.18883 + var mn = multinames[bc.index]; 1.18884 + if (mn.isRuntime()) { 1.18885 + var namespaces = mn.namespaces; 1.18886 + var name = mn.name; 1.18887 + if (mn.isRuntimeName()) { 1.18888 + name = pop(); 1.18889 + } 1.18890 + if (mn.isRuntimeNamespace()) { 1.18891 + namespaces = [ 1.18892 + pop() 1.18893 + ]; 1.18894 + } 1.18895 + return new MultinameType(namespaces, name, mn.flags); 1.18896 + } 1.18897 + return mn; 1.18898 + } 1.18899 + function accessSlot(obj) { 1.18900 + if (obj instanceof TraitsType) { 1.18901 + var trait = obj.getTraitAt(bc.index); 1.18902 + writer && writer.debugLn('accessSlot() -> ' + trait); 1.18903 + if (trait) { 1.18904 + ti().trait = trait; 1.18905 + if (trait.isSlot()) { 1.18906 + return Type.fromName(trait.typeName, domain).instanceType(); 1.18907 + } else if (trait.isClass()) { 1.18908 + return Type.from(trait.classInfo, domain); 1.18909 + } 1.18910 + } 1.18911 + } 1.18912 + return Type.Any; 1.18913 + } 1.18914 + function isNumericMultiname(mn) { 1.18915 + return mn instanceof Multiname && Multiname.isNumeric(mn) || mn instanceof MultinameType && (mn.name instanceof TraitsType && mn.name.isNumeric()); 1.18916 + } 1.18917 + function getProperty(obj, mn) { 1.18918 + if (obj instanceof TraitsType || obj instanceof ParameterizedType) { 1.18919 + var trait = obj.getTrait(mn, false, true); 1.18920 + writer && writer.debugLn('getProperty(' + mn + ') -> ' + trait); 1.18921 + if (trait) { 1.18922 + ti().trait = trait; 1.18923 + if (trait.isSlot() || trait.isConst()) { 1.18924 + return Type.fromName(trait.typeName, domain).instanceType(); 1.18925 + } else if (trait.isGetter()) { 1.18926 + return Type.fromName(trait.methodInfo.returnType, domain).instanceType(); 1.18927 + } else if (trait.isClass()) { 1.18928 + return Type.from(trait.classInfo, domain); 1.18929 + } else if (trait.isMethod()) { 1.18930 + return Type.from(trait.methodInfo, domain); 1.18931 + } 1.18932 + } else if (obj.isDirectlyReadable() && mn instanceof Multiname) { 1.18933 + ti().propertyQName = Multiname.getPublicQualifiedName(mn.name); 1.18934 + } 1.18935 + if (isNumericMultiname(mn)) { 1.18936 + if (obj.isIndexedReadable()) { 1.18937 + ti().isIndexedReadable = true; 1.18938 + if (obj.isVector()) { 1.18939 + return obj.parameter; 1.18940 + } 1.18941 + } else if (obj.isDirectlyReadable()) { 1.18942 + ti().isDirectlyReadable = true; 1.18943 + } 1.18944 + } 1.18945 + } 1.18946 + return Type.Any; 1.18947 + } 1.18948 + function setProperty(obj, mn, value) { 1.18949 + if (obj instanceof TraitsType || obj instanceof ParameterizedType) { 1.18950 + var trait = obj.getTrait(mn, true, true); 1.18951 + writer && writer.debugLn('setProperty(' + mn + ') -> ' + trait); 1.18952 + if (trait) { 1.18953 + ti().trait = trait; 1.18954 + } else if (obj.isDirectlyWriteable() && mn instanceof Multiname) { 1.18955 + ti().propertyQName = Multiname.getPublicQualifiedName(mn.name); 1.18956 + } 1.18957 + if (isNumericMultiname(mn)) { 1.18958 + if (obj.isDirectlyWriteable()) { 1.18959 + ti().isDirectlyWriteable = true; 1.18960 + } else if (obj.isVector()) { 1.18961 + ti().isIndexedWriteable = true; 1.18962 + } 1.18963 + } 1.18964 + } 1.18965 + } 1.18966 + for (var bci = block.position, end = block.end.position; bci <= end; bci++) { 1.18967 + bc = bytecodes[bci]; 1.18968 + var op = bc.op; 1.18969 + if (writer && verifierTraceLevel.value > 1) { 1.18970 + writer.writeLn(('stateBefore: ' + state.toString() + ' $$[' + savedScope.join(', ') + ']').padRight(' ', 100) + ' : ' + bci + ', ' + bc.toString(mi.abc)); 1.18971 + } 1.18972 + switch (op) { 1.18973 + case 1: 1.18974 + break; 1.18975 + case 3: 1.18976 + pop(); 1.18977 + break; 1.18978 + case 4: 1.18979 + mn = popMultiname(); 1.18980 + obj = pop(); 1.18981 + true; 1.18982 + ti().baseClass = LazyInitializer.create(this.thisType.super().classType().object); 1.18983 + push(getProperty(obj.super(), mn)); 1.18984 + break; 1.18985 + case 5: 1.18986 + val = pop(); 1.18987 + mn = popMultiname(); 1.18988 + obj = pop(); 1.18989 + true; 1.18990 + ti().baseClass = LazyInitializer.create(this.thisType.super().classType().object); 1.18991 + setProperty(obj.super(), mn, val); 1.18992 + break; 1.18993 + case 6: 1.18994 + notImplemented(bc); 1.18995 + break; 1.18996 + case 7: 1.18997 + notImplemented(bc); 1.18998 + break; 1.18999 + case 8: 1.19000 + state.local[bc.index] = Type.Undefined; 1.19001 + break; 1.19002 + case 10: 1.19003 + notImplemented(bc); 1.19004 + break; 1.19005 + case 11: 1.19006 + notImplemented(bc); 1.19007 + break; 1.19008 + case 12: 1.19009 + case 24: 1.19010 + case 13: 1.19011 + case 23: 1.19012 + case 14: 1.19013 + case 22: 1.19014 + case 15: 1.19015 + case 21: 1.19016 + case 19: 1.19017 + case 20: 1.19018 + case 25: 1.19019 + case 26: 1.19020 + pop(); 1.19021 + pop(); 1.19022 + break; 1.19023 + case 16: 1.19024 + break; 1.19025 + case 17: 1.19026 + case 18: 1.19027 + pop(); 1.19028 + break; 1.19029 + case 27: 1.19030 + pop(Type.Int); 1.19031 + break; 1.19032 + case 29: 1.19033 + scope.pop(); 1.19034 + break; 1.19035 + case 30: 1.19036 + case 35: 1.19037 + pop(Type.Int); 1.19038 + pop(); 1.19039 + push(Type.Any); 1.19040 + break; 1.19041 + case 31: 1.19042 + push(Type.Boolean); 1.19043 + break; 1.19044 + case 50: 1.19045 + push(Type.Boolean); 1.19046 + break; 1.19047 + case 32: 1.19048 + push(Type.Null); 1.19049 + break; 1.19050 + case 33: 1.19051 + push(Type.Undefined); 1.19052 + break; 1.19053 + case 34: 1.19054 + notImplemented(bc); 1.19055 + break; 1.19056 + case 36: 1.19057 + push(Type.Int); 1.19058 + break; 1.19059 + case 37: 1.19060 + push(Type.Int); 1.19061 + break; 1.19062 + case 44: 1.19063 + push(Type.String); 1.19064 + break; 1.19065 + case 45: 1.19066 + push(Type.Int); 1.19067 + break; 1.19068 + case 46: 1.19069 + push(Type.Uint); 1.19070 + break; 1.19071 + case 47: 1.19072 + push(Type.Number); 1.19073 + break; 1.19074 + case 38: 1.19075 + push(Type.Boolean); 1.19076 + break; 1.19077 + case 39: 1.19078 + push(Type.Boolean); 1.19079 + break; 1.19080 + case 40: 1.19081 + push(Type.Number); 1.19082 + break; 1.19083 + case 41: 1.19084 + pop(); 1.19085 + break; 1.19086 + case 42: 1.19087 + val = pop(); 1.19088 + push(val); 1.19089 + push(val); 1.19090 + break; 1.19091 + case 43: 1.19092 + l = pop(); 1.19093 + r = pop(); 1.19094 + push(l); 1.19095 + push(r); 1.19096 + break; 1.19097 + case 28: 1.19098 + pop(); 1.19099 + scope.push(Type.Any); 1.19100 + break; 1.19101 + case 48: 1.19102 + scope.push(pop()); 1.19103 + break; 1.19104 + case 49: 1.19105 + notImplemented(bc); 1.19106 + break; 1.19107 + case 53: 1.19108 + case 54: 1.19109 + case 55: 1.19110 + push(Type.Int); 1.19111 + break; 1.19112 + case 56: 1.19113 + case 57: 1.19114 + push(Type.Number); 1.19115 + break; 1.19116 + case 58: 1.19117 + case 59: 1.19118 + case 60: 1.19119 + pop(Type.Int); 1.19120 + break; 1.19121 + case 61: 1.19122 + case 62: 1.19123 + pop(Type.Number); 1.19124 + break; 1.19125 + case 64: 1.19126 + push(Type.Function); 1.19127 + break; 1.19128 + case 65: 1.19129 + stack.popMany(bc.argCount); 1.19130 + obj = pop(); 1.19131 + fn = pop(); 1.19132 + push(Type.Any); 1.19133 + break; 1.19134 + case 67: 1.19135 + throw new VerifierError('callmethod'); 1.19136 + case 68: 1.19137 + notImplemented(bc); 1.19138 + break; 1.19139 + case 69: 1.19140 + case 78: 1.19141 + case 79: 1.19142 + case 70: 1.19143 + case 76: 1.19144 + stack.popMany(bc.argCount); 1.19145 + mn = popMultiname(); 1.19146 + obj = pop(); 1.19147 + if (op === OP_callsuper || op === OP_callsupervoid) { 1.19148 + obj = this.thisType.super(); 1.19149 + ti().baseClass = LazyInitializer.create(this.thisType.super().classType().object); 1.19150 + } 1.19151 + type = getProperty(obj, mn); 1.19152 + if (op === OP_callpropvoid || op === OP_callsupervoid) { 1.19153 + break; 1.19154 + } 1.19155 + if (type instanceof MethodType) { 1.19156 + returnType = Type.fromName(type.methodInfo.returnType, domain).instanceType(); 1.19157 + } else if (type instanceof TraitsType && type.isClassInfo()) { 1.19158 + returnType = type.instanceType(); 1.19159 + } else { 1.19160 + returnType = Type.Any; 1.19161 + } 1.19162 + push(returnType); 1.19163 + break; 1.19164 + case 71: 1.19165 + this.returnType.merge(Type.Undefined); 1.19166 + break; 1.19167 + case 72: 1.19168 + type = pop(); 1.19169 + if (mi.returnType) { 1.19170 + var coerceType = Type.fromName(mi.returnType, this.domain).instanceType(); 1.19171 + if (coerceType.isSubtypeOf(type)) { 1.19172 + ti().noCoercionNeeded = true; 1.19173 + } 1.19174 + } 1.19175 + break; 1.19176 + case 73: 1.19177 + stack.popMany(bc.argCount); 1.19178 + stack.pop(); 1.19179 + if (this.thisType.isInstanceInfo() && this.thisType.super() === Type.Object) { 1.19180 + ti().noCallSuperNeeded = true; 1.19181 + } else { 1.19182 + ti().baseClass = LazyInitializer.create(this.thisType.super().classType().object); 1.19183 + } 1.19184 + break; 1.19185 + case 66: 1.19186 + stack.popMany(bc.argCount); 1.19187 + push(construct(pop())); 1.19188 + break; 1.19189 + case 74: 1.19190 + stack.popMany(bc.argCount); 1.19191 + mn = popMultiname(); 1.19192 + push(construct(getProperty(stack.pop(), mn))); 1.19193 + break; 1.19194 + case 75: 1.19195 + notImplemented(bc); 1.19196 + break; 1.19197 + case 77: 1.19198 + notImplemented(bc); 1.19199 + break; 1.19200 + case 80: 1.19201 + case 81: 1.19202 + case 82: 1.19203 + break; 1.19204 + case 83: 1.19205 + true; 1.19206 + val = pop(); 1.19207 + obj = pop(); 1.19208 + if (obj === Type.Any) { 1.19209 + push(Type.Any); 1.19210 + } else { 1.19211 + push(obj.applyType(val)); 1.19212 + } 1.19213 + break; 1.19214 + case 84: 1.19215 + notImplemented(bc); 1.19216 + break; 1.19217 + case 85: 1.19218 + stack.popMany(bc.argCount * 2); 1.19219 + push(Type.Object); 1.19220 + break; 1.19221 + case 86: 1.19222 + stack.popMany(bc.argCount); 1.19223 + push(Type.Array); 1.19224 + break; 1.19225 + case 87: 1.19226 + push(Type.from(new ActivationInfo(this.methodInfo))); 1.19227 + break; 1.19228 + case 88: 1.19229 + push(Type.Any); 1.19230 + break; 1.19231 + case 89: 1.19232 + popMultiname(); 1.19233 + pop(); 1.19234 + push(Type.XMLList); 1.19235 + break; 1.19236 + case 90: 1.19237 + push(Type.Any); 1.19238 + break; 1.19239 + case 93: 1.19240 + push(findProperty(popMultiname(), true)); 1.19241 + break; 1.19242 + case 94: 1.19243 + push(findProperty(popMultiname(), false)); 1.19244 + break; 1.19245 + case 95: 1.19246 + notImplemented(bc); 1.19247 + break; 1.19248 + case 96: 1.19249 + mn = popMultiname(); 1.19250 + push(getProperty(findProperty(mn, true), mn)); 1.19251 + break; 1.19252 + case 104: 1.19253 + case 97: 1.19254 + val = pop(); 1.19255 + mn = popMultiname(); 1.19256 + obj = pop(); 1.19257 + setProperty(obj, mn, val, bc); 1.19258 + break; 1.19259 + case 98: 1.19260 + push(local[bc.index]); 1.19261 + break; 1.19262 + case 99: 1.19263 + local[bc.index] = pop(); 1.19264 + break; 1.19265 + case 100: 1.19266 + push(globalScope); 1.19267 + ti().object = LazyInitializer.create(globalScope.object); 1.19268 + break; 1.19269 + case 101: 1.19270 + push(scope[bc.index]); 1.19271 + break; 1.19272 + case 102: 1.19273 + mn = popMultiname(); 1.19274 + obj = pop(); 1.19275 + push(getProperty(obj, mn)); 1.19276 + break; 1.19277 + case 103: 1.19278 + notImplemented(bc); 1.19279 + break; 1.19280 + case 105: 1.19281 + notImplemented(bc); 1.19282 + break; 1.19283 + case 106: 1.19284 + popMultiname(); 1.19285 + pop(); 1.19286 + push(Type.Boolean); 1.19287 + break; 1.19288 + case 107: 1.19289 + notImplemented(bc); 1.19290 + break; 1.19291 + case 108: 1.19292 + push(accessSlot(pop())); 1.19293 + break; 1.19294 + case 109: 1.19295 + val = pop(); 1.19296 + obj = pop(); 1.19297 + accessSlot(obj); 1.19298 + break; 1.19299 + case 110: 1.19300 + notImplemented(bc); 1.19301 + break; 1.19302 + case 111: 1.19303 + notImplemented(bc); 1.19304 + break; 1.19305 + case 112: 1.19306 + pop(); 1.19307 + push(Type.String); 1.19308 + break; 1.19309 + case 113: 1.19310 + pop(); 1.19311 + push(Type.String); 1.19312 + break; 1.19313 + case 114: 1.19314 + pop(); 1.19315 + push(Type.String); 1.19316 + break; 1.19317 + case 131: 1.19318 + case 115: 1.19319 + pop(); 1.19320 + push(Type.Int); 1.19321 + break; 1.19322 + case 136: 1.19323 + case 116: 1.19324 + pop(); 1.19325 + push(Type.Uint); 1.19326 + break; 1.19327 + case 132: 1.19328 + case 117: 1.19329 + pop(); 1.19330 + push(Type.Number); 1.19331 + break; 1.19332 + case 129: 1.19333 + case 118: 1.19334 + pop(); 1.19335 + push(Type.Boolean); 1.19336 + break; 1.19337 + case 119: 1.19338 + notImplemented(bc); 1.19339 + break; 1.19340 + case 120: 1.19341 + break; 1.19342 + case 121: 1.19343 + pop(); 1.19344 + push(Type.Number); 1.19345 + break; 1.19346 + case 122: 1.19347 + notImplemented(bc); 1.19348 + break; 1.19349 + case 123: 1.19350 + notImplemented(bc); 1.19351 + break; 1.19352 + case 128: 1.19353 + type = pop(); 1.19354 + var coerceType = Type.fromName(multinames[bc.index], this.domain).instanceType(); 1.19355 + if (coerceType.isSubtypeOf(type)) { 1.19356 + ti().noCoercionNeeded = true; 1.19357 + } 1.19358 + push(coerceType); 1.19359 + break; 1.19360 + case 130: 1.19361 + break; 1.19362 + case 133: 1.19363 + pop(); 1.19364 + push(Type.String); 1.19365 + break; 1.19366 + case 134: 1.19367 + notImplemented(bc); 1.19368 + break; 1.19369 + case 135: 1.19370 + type = pop(); 1.19371 + pop(); 1.19372 + if (type instanceof TraitsType) { 1.19373 + push(type.instanceType()); 1.19374 + } else { 1.19375 + push(Type.Any); 1.19376 + } 1.19377 + break; 1.19378 + case 137: 1.19379 + notImplemented(bc); 1.19380 + break; 1.19381 + case 144: 1.19382 + case 145: 1.19383 + case 147: 1.19384 + pop(); 1.19385 + push(Type.Number); 1.19386 + break; 1.19387 + case 146: 1.19388 + case 148: 1.19389 + local[bc.index] = Type.Number; 1.19390 + break; 1.19391 + case 149: 1.19392 + pop(); 1.19393 + push(Type.String); 1.19394 + break; 1.19395 + case 150: 1.19396 + pop(); 1.19397 + push(Type.Boolean); 1.19398 + break; 1.19399 + case 160: 1.19400 + r = pop(); 1.19401 + l = pop(); 1.19402 + if (l.isNumeric() && r.isNumeric()) { 1.19403 + push(Type.Number); 1.19404 + } else if (l === Type.String || r === Type.String) { 1.19405 + push(Type.String); 1.19406 + } else { 1.19407 + push(Type.Any); 1.19408 + } 1.19409 + break; 1.19410 + case 161: 1.19411 + case 162: 1.19412 + case 163: 1.19413 + case 164: 1.19414 + pop(); 1.19415 + pop(); 1.19416 + push(Type.Number); 1.19417 + break; 1.19418 + case 168: 1.19419 + case 169: 1.19420 + case 170: 1.19421 + case 165: 1.19422 + case 166: 1.19423 + case 167: 1.19424 + pop(); 1.19425 + pop(); 1.19426 + push(Type.Int); 1.19427 + break; 1.19428 + case 151: 1.19429 + pop(); 1.19430 + push(Type.Int); 1.19431 + break; 1.19432 + case 171: 1.19433 + case 172: 1.19434 + case 173: 1.19435 + case 174: 1.19436 + case 175: 1.19437 + case 176: 1.19438 + case 177: 1.19439 + case 180: 1.19440 + pop(); 1.19441 + pop(); 1.19442 + push(Type.Boolean); 1.19443 + break; 1.19444 + case 178: 1.19445 + pop(); 1.19446 + push(Type.Boolean); 1.19447 + break; 1.19448 + case 179: 1.19449 + pop(); 1.19450 + pop(); 1.19451 + push(Type.Boolean); 1.19452 + break; 1.19453 + case 194: 1.19454 + case 195: 1.19455 + local[bc.index] = Type.Int; 1.19456 + break; 1.19457 + case 193: 1.19458 + case 192: 1.19459 + case 196: 1.19460 + pop(); 1.19461 + push(Type.Int); 1.19462 + break; 1.19463 + case 197: 1.19464 + case 198: 1.19465 + case 199: 1.19466 + pop(); 1.19467 + pop(); 1.19468 + push(Type.Int); 1.19469 + break; 1.19470 + case 208: 1.19471 + case 209: 1.19472 + case 210: 1.19473 + case 211: 1.19474 + push(local[op - OP_getlocal0]); 1.19475 + break; 1.19476 + case 212: 1.19477 + case 213: 1.19478 + case 214: 1.19479 + case 215: 1.19480 + local[op - OP_setlocal0] = pop(); 1.19481 + break; 1.19482 + case 239: 1.19483 + break; 1.19484 + case 240: 1.19485 + break; 1.19486 + case 241: 1.19487 + break; 1.19488 + case 242: 1.19489 + break; 1.19490 + case 243: 1.19491 + break; 1.19492 + default: 1.19493 + console.info('Not Implemented: ' + bc); 1.19494 + } 1.19495 + if (writer) { 1.19496 + if (bc.ti) { 1.19497 + writer.debugLn('> TI: ' + bc.ti); 1.19498 + } 1.19499 + } 1.19500 + } 1.19501 + if (writer) { 1.19502 + writer.leave('}'); 1.19503 + writer.writeLn('verifiedBlock: ' + block.bid + ', range: [' + block.position + ', ' + block.end.position + '], exitState: ' + state.toString()); 1.19504 + } 1.19505 + }; 1.19506 + return verification; 1.19507 + }(); 1.19508 + function verifier() { 1.19509 + this.writer = new IndentingWriter(); 1.19510 + } 1.19511 + verifier.prototype.verifyMethod = function (methodInfo, scope) { 1.19512 + try { 1.19513 + var domain = methodInfo.abc.applicationDomain; 1.19514 + var scopeObjects = scope.getScopeObjects(); 1.19515 + if (!scopeObjects[scopeObjects.length - 1]) { 1.19516 + if (methodInfo.holder instanceof InstanceInfo) { 1.19517 + scopeObjects[scopeObjects.length - 1] = methodInfo.holder.classInfo; 1.19518 + } else if (methodInfo.holder instanceof ClassInfo) { 1.19519 + scopeObjects[scopeObjects.length - 1] = methodInfo.holder; 1.19520 + } 1.19521 + } 1.19522 + var savedScope = scopeObjects.map(function (object) { 1.19523 + if (object instanceof MethodInfo) { 1.19524 + return Type.from(new ActivationInfo(object)); 1.19525 + } 1.19526 + return Type.from(object, domain); 1.19527 + }); 1.19528 + new Verification(methodInfo, methodInfo.abc.applicationDomain, savedScope).verify(); 1.19529 + methodInfo.verified = true; 1.19530 + Counter.count('Verifier: Methods'); 1.19531 + } catch (e) { 1.19532 + if (e instanceof VerifierError) { 1.19533 + return; 1.19534 + } 1.19535 + throw e; 1.19536 + } 1.19537 + }; 1.19538 + return verifier; 1.19539 + }(); 1.19540 +(function (exports) { 1.19541 + var debug = false; 1.19542 + var IRDefinition = { 1.19543 + Control: { 1.19544 + Region: { 1.19545 + predecessors: { 1.19546 + array: true, 1.19547 + expand: 'control' 1.19548 + }, 1.19549 + Start: { 1.19550 + _constructorText: 'this.control = this;', 1.19551 + scope: { 1.19552 + dynamic: true 1.19553 + }, 1.19554 + domain: { 1.19555 + dynamic: true 1.19556 + } 1.19557 + } 1.19558 + }, 1.19559 + End: { 1.19560 + control: { 1.19561 + assert: 'isControlOrNull' 1.19562 + }, 1.19563 + Stop: { 1.19564 + store: { 1.19565 + assert: 'isStore' 1.19566 + }, 1.19567 + argument: { 1.19568 + assert: '' 1.19569 + } 1.19570 + }, 1.19571 + If: { 1.19572 + predicate: { 1.19573 + assert: '' 1.19574 + } 1.19575 + }, 1.19576 + Switch: { 1.19577 + determinant: { 1.19578 + assert: '' 1.19579 + } 1.19580 + }, 1.19581 + Jump: {} 1.19582 + } 1.19583 + }, 1.19584 + Value: { 1.19585 + StoreDependent: { 1.19586 + control: { 1.19587 + assert: 'isControlOrNull', 1.19588 + nullable: true 1.19589 + }, 1.19590 + store: { 1.19591 + assert: 'isStoreOrNull', 1.19592 + nullable: true 1.19593 + }, 1.19594 + loads: { 1.19595 + dynamic: true, 1.19596 + nullable: true, 1.19597 + array: true 1.19598 + }, 1.19599 + Call: { 1.19600 + callee: { 1.19601 + assert: '' 1.19602 + }, 1.19603 + object: { 1.19604 + assert: 'isValueOrNull', 1.19605 + nullable: true 1.19606 + }, 1.19607 + args: { 1.19608 + assert: 'isArray', 1.19609 + array: true 1.19610 + }, 1.19611 + flags: { 1.19612 + internal: true, 1.19613 + assert: 'isNumber' 1.19614 + } 1.19615 + }, 1.19616 + CallProperty: { 1.19617 + object: { 1.19618 + assert: '' 1.19619 + }, 1.19620 + name: { 1.19621 + assert: '' 1.19622 + }, 1.19623 + args: { 1.19624 + assert: 'isArray', 1.19625 + array: true 1.19626 + }, 1.19627 + flags: { 1.19628 + internal: true, 1.19629 + assert: 'isNumber' 1.19630 + }, 1.19631 + ASCallProperty: { 1.19632 + isLex: { 1.19633 + assert: '', 1.19634 + internal: true 1.19635 + } 1.19636 + }, 1.19637 + ASCallSuper: { 1.19638 + scope: { 1.19639 + assert: '' 1.19640 + } 1.19641 + } 1.19642 + }, 1.19643 + New: { 1.19644 + callee: { 1.19645 + assert: '' 1.19646 + }, 1.19647 + args: { 1.19648 + assert: '', 1.19649 + array: true 1.19650 + }, 1.19651 + ASNew: {} 1.19652 + }, 1.19653 + GetProperty: { 1.19654 + object: { 1.19655 + assert: '' 1.19656 + }, 1.19657 + name: { 1.19658 + assert: '' 1.19659 + }, 1.19660 + ASGetProperty: { 1.19661 + flags: { 1.19662 + internal: true, 1.19663 + assert: 'isNumber' 1.19664 + } 1.19665 + }, 1.19666 + ASGetDescendants: {}, 1.19667 + ASHasProperty: {}, 1.19668 + ASGetSlot: {}, 1.19669 + ASGetSuper: { 1.19670 + scope: { 1.19671 + assert: '' 1.19672 + } 1.19673 + } 1.19674 + }, 1.19675 + SetProperty: { 1.19676 + object: { 1.19677 + assert: '' 1.19678 + }, 1.19679 + name: { 1.19680 + assert: '' 1.19681 + }, 1.19682 + value: { 1.19683 + assert: '' 1.19684 + }, 1.19685 + ASSetProperty: { 1.19686 + flags: { 1.19687 + internal: true 1.19688 + } 1.19689 + }, 1.19690 + ASSetSlot: {}, 1.19691 + ASSetSuper: { 1.19692 + scope: { 1.19693 + assert: '' 1.19694 + } 1.19695 + } 1.19696 + }, 1.19697 + DeleteProperty: { 1.19698 + object: { 1.19699 + assert: '' 1.19700 + }, 1.19701 + name: { 1.19702 + assert: '' 1.19703 + }, 1.19704 + ASDeleteProperty: {} 1.19705 + }, 1.19706 + ASFindProperty: { 1.19707 + scope: { 1.19708 + assert: '' 1.19709 + }, 1.19710 + name: { 1.19711 + assert: '' 1.19712 + }, 1.19713 + domain: { 1.19714 + assert: '' 1.19715 + }, 1.19716 + strict: { 1.19717 + internal: true 1.19718 + } 1.19719 + } 1.19720 + }, 1.19721 + Store: {}, 1.19722 + Phi: { 1.19723 + control: { 1.19724 + assert: 'isControl', 1.19725 + nullable: true 1.19726 + }, 1.19727 + args: { 1.19728 + array: true, 1.19729 + expand: 'value' 1.19730 + } 1.19731 + }, 1.19732 + Variable: { 1.19733 + name: { 1.19734 + internal: true 1.19735 + } 1.19736 + }, 1.19737 + Copy: { 1.19738 + argument: {} 1.19739 + }, 1.19740 + Move: { 1.19741 + to: {}, 1.19742 + from: {} 1.19743 + }, 1.19744 + Projection: { 1.19745 + argument: {}, 1.19746 + type: { 1.19747 + internal: true 1.19748 + }, 1.19749 + selector: { 1.19750 + internal: true, 1.19751 + optional: true 1.19752 + } 1.19753 + }, 1.19754 + Latch: { 1.19755 + control: { 1.19756 + assert: 'isControlOrNull', 1.19757 + nullable: true 1.19758 + }, 1.19759 + condition: {}, 1.19760 + left: {}, 1.19761 + right: {} 1.19762 + }, 1.19763 + Binary: { 1.19764 + operator: { 1.19765 + internal: true 1.19766 + }, 1.19767 + left: {}, 1.19768 + right: {} 1.19769 + }, 1.19770 + Unary: { 1.19771 + operator: { 1.19772 + internal: true 1.19773 + }, 1.19774 + argument: {} 1.19775 + }, 1.19776 + Constant: { 1.19777 + value: { 1.19778 + internal: true 1.19779 + } 1.19780 + }, 1.19781 + GlobalProperty: { 1.19782 + name: { 1.19783 + internal: true 1.19784 + } 1.19785 + }, 1.19786 + This: { 1.19787 + control: { 1.19788 + assert: 'isControl' 1.19789 + } 1.19790 + }, 1.19791 + Throw: { 1.19792 + control: { 1.19793 + assert: 'isControl' 1.19794 + }, 1.19795 + argument: {} 1.19796 + }, 1.19797 + Arguments: { 1.19798 + control: { 1.19799 + assert: 'isControl' 1.19800 + } 1.19801 + }, 1.19802 + Parameter: { 1.19803 + control: { 1.19804 + assert: 'isControl' 1.19805 + }, 1.19806 + index: { 1.19807 + internal: true 1.19808 + }, 1.19809 + name: { 1.19810 + internal: true 1.19811 + } 1.19812 + }, 1.19813 + NewArray: { 1.19814 + control: { 1.19815 + assert: 'isControl' 1.19816 + }, 1.19817 + elements: { 1.19818 + array: true 1.19819 + } 1.19820 + }, 1.19821 + NewObject: { 1.19822 + control: { 1.19823 + assert: 'isControl' 1.19824 + }, 1.19825 + properties: { 1.19826 + array: true 1.19827 + } 1.19828 + }, 1.19829 + KeyValuePair: { 1.19830 + key: {}, 1.19831 + value: {} 1.19832 + }, 1.19833 + ASScope: { 1.19834 + parent: {}, 1.19835 + object: {}, 1.19836 + isWith: { 1.19837 + internal: true 1.19838 + } 1.19839 + }, 1.19840 + ASGlobal: { 1.19841 + control: { 1.19842 + assert: 'isControlOrNull', 1.19843 + nullable: true 1.19844 + }, 1.19845 + scope: { 1.19846 + assert: 'isScope' 1.19847 + } 1.19848 + }, 1.19849 + ASNewActivation: { 1.19850 + methodInfo: { 1.19851 + internal: true 1.19852 + } 1.19853 + }, 1.19854 + ASMultiname: { 1.19855 + namespaces: {}, 1.19856 + name: {}, 1.19857 + flags: { 1.19858 + internal: true 1.19859 + } 1.19860 + } 1.19861 + } 1.19862 + }; 1.19863 + function IRGenerator(root) { 1.19864 + var str = ''; 1.19865 + function out(s) { 1.19866 + str += s + '\n'; 1.19867 + } 1.19868 + var writer = new IndentingWriter(false, out); 1.19869 + function makeProperties(node) { 1.19870 + var result = []; 1.19871 + for (var k in node) { 1.19872 + if (isProperty(k)) { 1.19873 + node[k].name = k; 1.19874 + result.push(node[k]); 1.19875 + } 1.19876 + } 1.19877 + return result; 1.19878 + } 1.19879 + function isProperty(v) { 1.19880 + if (v[0] === '_') { 1.19881 + return false; 1.19882 + } 1.19883 + return v[0].toLowerCase() === v[0]; 1.19884 + } 1.19885 + function generate(node, path) { 1.19886 + path = path.concat([ 1.19887 + node 1.19888 + ]); 1.19889 + writer.enter('var ' + node._name + ' = (function () {'); 1.19890 + var constructorName = node._name[0].toLowerCase() + node._name.slice(1) + 'Node'; 1.19891 + if (constructorName.substring(0, 2) === 'aS') { 1.19892 + constructorName = 'as' + constructorName.substring(2); 1.19893 + } 1.19894 + var prototypeName = constructorName + '.prototype'; 1.19895 + var properties = path.reduce(function (a, v) { 1.19896 + return a.concat(makeProperties(v)); 1.19897 + }, []); 1.19898 + var parameters = properties.filter(function (property) { 1.19899 + return !property.dynamic; 1.19900 + }); 1.19901 + var optionalParameters = parameters.filter(function (property) { 1.19902 + return property.optional; 1.19903 + }); 1.19904 + var parameterString = parameters.map(function (property) { 1.19905 + if (property.expand) { 1.19906 + return property.expand; 1.19907 + } 1.19908 + return property.name; 1.19909 + }).join(', '); 1.19910 + writer.enter('function ' + constructorName + '(' + parameterString + ') {'); 1.19911 + if (true) { 1.19912 + properties.forEach(function (property) { 1.19913 + if (property.assert === '') { 1.19914 + writer.writeLn('release || assert (!(' + property.name + ' == undefined), "' + property.name + '");'); 1.19915 + } else if (property.assert) { 1.19916 + writer.writeLn('release || assert (' + property.assert + '(' + property.name + '), "' + property.name + '");'); 1.19917 + } 1.19918 + }); 1.19919 + writer.writeLn('release || assert (arguments.length >= ' + (parameters.length - optionalParameters.length) + ', "' + node._name + ' not enough args.");'); 1.19920 + } 1.19921 + if (node._constructorText) { 1.19922 + writer.writeLn(node._constructorText); 1.19923 + } 1.19924 + properties.forEach(function (property) { 1.19925 + if (property.expand) { 1.19926 + writer.writeLn('this.' + property.name + ' = ' + property.expand + ' ? [' + property.expand + '] : [];'); 1.19927 + } else if (property.dynamic) { 1.19928 + writer.writeLn('this.' + property.name + ' = undefined;'); 1.19929 + } else { 1.19930 + writer.writeLn('this.' + property.name + ' = ' + property.name + ';'); 1.19931 + } 1.19932 + }); 1.19933 + writer.writeLn('this.id = nextID[nextID.length - 1] += 1;'); 1.19934 + writer.leave('}'); 1.19935 + if (path.length > 1) { 1.19936 + writer.writeLn(prototypeName + ' = ' + 'extend(' + path[path.length - 2]._name + ', "' + node._name + '");'); 1.19937 + } 1.19938 + writer.writeLn(prototypeName + '.nodeName = "' + node._name + '";'); 1.19939 + writer.enter(prototypeName + '.visitInputs = function (visitor) {'); 1.19940 + properties.forEach(function (property) { 1.19941 + if (property.internal) { 1.19942 + return; 1.19943 + } 1.19944 + var str = ''; 1.19945 + if (property.nullable) { 1.19946 + str += 'this.' + property.name + ' && '; 1.19947 + } 1.19948 + if (property.array) { 1.19949 + str += 'visitArrayInputs(this.' + property.name + ', visitor);'; 1.19950 + } else { 1.19951 + str += 'visitor(this.' + property.name + ');'; 1.19952 + } 1.19953 + writer.writeLn(str); 1.19954 + }); 1.19955 + writer.leave('};'); 1.19956 + writer.writeLn('return ' + constructorName + ';'); 1.19957 + writer.leave('})();'); 1.19958 + writer.writeLn(''); 1.19959 + for (var name in node) { 1.19960 + if (name[0] === '_' || isProperty(name)) { 1.19961 + continue; 1.19962 + } 1.19963 + var child = node[name]; 1.19964 + child._name = name; 1.19965 + generate(child, path); 1.19966 + } 1.19967 + } 1.19968 + IRDefinition._name = 'Node'; 1.19969 + generate(IRDefinition, []); 1.19970 + return str; 1.19971 + } 1.19972 + var nextID = []; 1.19973 + var Node = function () { 1.19974 + function nodeNode() { 1.19975 + true; 1.19976 + this.id = nextID[nextID.length - 1] += 1; 1.19977 + } 1.19978 + nodeNode.prototype.nodeName = 'Node'; 1.19979 + nodeNode.prototype.visitInputs = function (visitor) { 1.19980 + }; 1.19981 + return nodeNode; 1.19982 + }(); 1.19983 + var Control = function () { 1.19984 + function controlNode() { 1.19985 + true; 1.19986 + this.id = nextID[nextID.length - 1] += 1; 1.19987 + } 1.19988 + controlNode.prototype = extend(Node, 'Control'); 1.19989 + controlNode.prototype.nodeName = 'Control'; 1.19990 + controlNode.prototype.visitInputs = function (visitor) { 1.19991 + }; 1.19992 + return controlNode; 1.19993 + }(); 1.19994 + var Region = function () { 1.19995 + function regionNode(control) { 1.19996 + true; 1.19997 + this.predecessors = control ? [ 1.19998 + control 1.19999 + ] : []; 1.20000 + this.id = nextID[nextID.length - 1] += 1; 1.20001 + } 1.20002 + regionNode.prototype = extend(Control, 'Region'); 1.20003 + regionNode.prototype.nodeName = 'Region'; 1.20004 + regionNode.prototype.visitInputs = function (visitor) { 1.20005 + visitArrayInputs(this.predecessors, visitor); 1.20006 + }; 1.20007 + return regionNode; 1.20008 + }(); 1.20009 + var Start = function () { 1.20010 + function startNode(control) { 1.20011 + true; 1.20012 + this.control = this; 1.20013 + this.predecessors = control ? [ 1.20014 + control 1.20015 + ] : []; 1.20016 + this.scope = undefined; 1.20017 + this.domain = undefined; 1.20018 + this.id = nextID[nextID.length - 1] += 1; 1.20019 + } 1.20020 + startNode.prototype = extend(Region, 'Start'); 1.20021 + startNode.prototype.nodeName = 'Start'; 1.20022 + startNode.prototype.visitInputs = function (visitor) { 1.20023 + visitArrayInputs(this.predecessors, visitor); 1.20024 + visitor(this.scope); 1.20025 + visitor(this.domain); 1.20026 + }; 1.20027 + return startNode; 1.20028 + }(); 1.20029 + var End = function () { 1.20030 + function endNode(control) { 1.20031 + true; 1.20032 + true; 1.20033 + this.control = control; 1.20034 + this.id = nextID[nextID.length - 1] += 1; 1.20035 + } 1.20036 + endNode.prototype = extend(Control, 'End'); 1.20037 + endNode.prototype.nodeName = 'End'; 1.20038 + endNode.prototype.visitInputs = function (visitor) { 1.20039 + visitor(this.control); 1.20040 + }; 1.20041 + return endNode; 1.20042 + }(); 1.20043 + var Stop = function () { 1.20044 + function stopNode(control, store, argument) { 1.20045 + true; 1.20046 + true; 1.20047 + true; 1.20048 + true; 1.20049 + this.control = control; 1.20050 + this.store = store; 1.20051 + this.argument = argument; 1.20052 + this.id = nextID[nextID.length - 1] += 1; 1.20053 + } 1.20054 + stopNode.prototype = extend(End, 'Stop'); 1.20055 + stopNode.prototype.nodeName = 'Stop'; 1.20056 + stopNode.prototype.visitInputs = function (visitor) { 1.20057 + visitor(this.control); 1.20058 + visitor(this.store); 1.20059 + visitor(this.argument); 1.20060 + }; 1.20061 + return stopNode; 1.20062 + }(); 1.20063 + var If = function () { 1.20064 + function ifNode(control, predicate) { 1.20065 + true; 1.20066 + true; 1.20067 + true; 1.20068 + this.control = control; 1.20069 + this.predicate = predicate; 1.20070 + this.id = nextID[nextID.length - 1] += 1; 1.20071 + } 1.20072 + ifNode.prototype = extend(End, 'If'); 1.20073 + ifNode.prototype.nodeName = 'If'; 1.20074 + ifNode.prototype.visitInputs = function (visitor) { 1.20075 + visitor(this.control); 1.20076 + visitor(this.predicate); 1.20077 + }; 1.20078 + return ifNode; 1.20079 + }(); 1.20080 + var Switch = function () { 1.20081 + function switchNode(control, determinant) { 1.20082 + true; 1.20083 + true; 1.20084 + true; 1.20085 + this.control = control; 1.20086 + this.determinant = determinant; 1.20087 + this.id = nextID[nextID.length - 1] += 1; 1.20088 + } 1.20089 + switchNode.prototype = extend(End, 'Switch'); 1.20090 + switchNode.prototype.nodeName = 'Switch'; 1.20091 + switchNode.prototype.visitInputs = function (visitor) { 1.20092 + visitor(this.control); 1.20093 + visitor(this.determinant); 1.20094 + }; 1.20095 + return switchNode; 1.20096 + }(); 1.20097 + var Jump = function () { 1.20098 + function jumpNode(control) { 1.20099 + true; 1.20100 + true; 1.20101 + this.control = control; 1.20102 + this.id = nextID[nextID.length - 1] += 1; 1.20103 + } 1.20104 + jumpNode.prototype = extend(End, 'Jump'); 1.20105 + jumpNode.prototype.nodeName = 'Jump'; 1.20106 + jumpNode.prototype.visitInputs = function (visitor) { 1.20107 + visitor(this.control); 1.20108 + }; 1.20109 + return jumpNode; 1.20110 + }(); 1.20111 + var Value = function () { 1.20112 + function valueNode() { 1.20113 + true; 1.20114 + this.id = nextID[nextID.length - 1] += 1; 1.20115 + } 1.20116 + valueNode.prototype = extend(Node, 'Value'); 1.20117 + valueNode.prototype.nodeName = 'Value'; 1.20118 + valueNode.prototype.visitInputs = function (visitor) { 1.20119 + }; 1.20120 + return valueNode; 1.20121 + }(); 1.20122 + var StoreDependent = function () { 1.20123 + function storeDependentNode(control, store) { 1.20124 + true; 1.20125 + true; 1.20126 + true; 1.20127 + this.control = control; 1.20128 + this.store = store; 1.20129 + this.loads = undefined; 1.20130 + this.id = nextID[nextID.length - 1] += 1; 1.20131 + } 1.20132 + storeDependentNode.prototype = extend(Value, 'StoreDependent'); 1.20133 + storeDependentNode.prototype.nodeName = 'StoreDependent'; 1.20134 + storeDependentNode.prototype.visitInputs = function (visitor) { 1.20135 + this.control && visitor(this.control); 1.20136 + this.store && visitor(this.store); 1.20137 + this.loads && visitArrayInputs(this.loads, visitor); 1.20138 + }; 1.20139 + return storeDependentNode; 1.20140 + }(); 1.20141 + var Call = function () { 1.20142 + function callNode(control, store, callee, object, args, flags) { 1.20143 + true; 1.20144 + true; 1.20145 + true; 1.20146 + true; 1.20147 + true; 1.20148 + true; 1.20149 + true; 1.20150 + this.control = control; 1.20151 + this.store = store; 1.20152 + this.loads = undefined; 1.20153 + this.callee = callee; 1.20154 + this.object = object; 1.20155 + this.args = args; 1.20156 + this.flags = flags; 1.20157 + this.id = nextID[nextID.length - 1] += 1; 1.20158 + } 1.20159 + callNode.prototype = extend(StoreDependent, 'Call'); 1.20160 + callNode.prototype.nodeName = 'Call'; 1.20161 + callNode.prototype.visitInputs = function (visitor) { 1.20162 + this.control && visitor(this.control); 1.20163 + this.store && visitor(this.store); 1.20164 + this.loads && visitArrayInputs(this.loads, visitor); 1.20165 + visitor(this.callee); 1.20166 + this.object && visitor(this.object); 1.20167 + visitArrayInputs(this.args, visitor); 1.20168 + }; 1.20169 + return callNode; 1.20170 + }(); 1.20171 + var CallProperty = function () { 1.20172 + function callPropertyNode(control, store, object, name, args, flags) { 1.20173 + true; 1.20174 + true; 1.20175 + true; 1.20176 + true; 1.20177 + true; 1.20178 + true; 1.20179 + true; 1.20180 + this.control = control; 1.20181 + this.store = store; 1.20182 + this.loads = undefined; 1.20183 + this.object = object; 1.20184 + this.name = name; 1.20185 + this.args = args; 1.20186 + this.flags = flags; 1.20187 + this.id = nextID[nextID.length - 1] += 1; 1.20188 + } 1.20189 + callPropertyNode.prototype = extend(StoreDependent, 'CallProperty'); 1.20190 + callPropertyNode.prototype.nodeName = 'CallProperty'; 1.20191 + callPropertyNode.prototype.visitInputs = function (visitor) { 1.20192 + this.control && visitor(this.control); 1.20193 + this.store && visitor(this.store); 1.20194 + this.loads && visitArrayInputs(this.loads, visitor); 1.20195 + visitor(this.object); 1.20196 + visitor(this.name); 1.20197 + visitArrayInputs(this.args, visitor); 1.20198 + }; 1.20199 + return callPropertyNode; 1.20200 + }(); 1.20201 + var ASCallProperty = function () { 1.20202 + function asCallPropertyNode(control, store, object, name, args, flags, isLex) { 1.20203 + true; 1.20204 + true; 1.20205 + true; 1.20206 + true; 1.20207 + true; 1.20208 + true; 1.20209 + true; 1.20210 + true; 1.20211 + this.control = control; 1.20212 + this.store = store; 1.20213 + this.loads = undefined; 1.20214 + this.object = object; 1.20215 + this.name = name; 1.20216 + this.args = args; 1.20217 + this.flags = flags; 1.20218 + this.isLex = isLex; 1.20219 + this.id = nextID[nextID.length - 1] += 1; 1.20220 + } 1.20221 + asCallPropertyNode.prototype = extend(CallProperty, 'ASCallProperty'); 1.20222 + asCallPropertyNode.prototype.nodeName = 'ASCallProperty'; 1.20223 + asCallPropertyNode.prototype.visitInputs = function (visitor) { 1.20224 + this.control && visitor(this.control); 1.20225 + this.store && visitor(this.store); 1.20226 + this.loads && visitArrayInputs(this.loads, visitor); 1.20227 + visitor(this.object); 1.20228 + visitor(this.name); 1.20229 + visitArrayInputs(this.args, visitor); 1.20230 + }; 1.20231 + return asCallPropertyNode; 1.20232 + }(); 1.20233 + var ASCallSuper = function () { 1.20234 + function asCallSuperNode(control, store, object, name, args, flags, scope) { 1.20235 + true; 1.20236 + true; 1.20237 + true; 1.20238 + true; 1.20239 + true; 1.20240 + true; 1.20241 + true; 1.20242 + true; 1.20243 + this.control = control; 1.20244 + this.store = store; 1.20245 + this.loads = undefined; 1.20246 + this.object = object; 1.20247 + this.name = name; 1.20248 + this.args = args; 1.20249 + this.flags = flags; 1.20250 + this.scope = scope; 1.20251 + this.id = nextID[nextID.length - 1] += 1; 1.20252 + } 1.20253 + asCallSuperNode.prototype = extend(CallProperty, 'ASCallSuper'); 1.20254 + asCallSuperNode.prototype.nodeName = 'ASCallSuper'; 1.20255 + asCallSuperNode.prototype.visitInputs = function (visitor) { 1.20256 + this.control && visitor(this.control); 1.20257 + this.store && visitor(this.store); 1.20258 + this.loads && visitArrayInputs(this.loads, visitor); 1.20259 + visitor(this.object); 1.20260 + visitor(this.name); 1.20261 + visitArrayInputs(this.args, visitor); 1.20262 + visitor(this.scope); 1.20263 + }; 1.20264 + return asCallSuperNode; 1.20265 + }(); 1.20266 + var New = function () { 1.20267 + function newNode(control, store, callee, args) { 1.20268 + true; 1.20269 + true; 1.20270 + true; 1.20271 + true; 1.20272 + true; 1.20273 + this.control = control; 1.20274 + this.store = store; 1.20275 + this.loads = undefined; 1.20276 + this.callee = callee; 1.20277 + this.args = args; 1.20278 + this.id = nextID[nextID.length - 1] += 1; 1.20279 + } 1.20280 + newNode.prototype = extend(StoreDependent, 'New'); 1.20281 + newNode.prototype.nodeName = 'New'; 1.20282 + newNode.prototype.visitInputs = function (visitor) { 1.20283 + this.control && visitor(this.control); 1.20284 + this.store && visitor(this.store); 1.20285 + this.loads && visitArrayInputs(this.loads, visitor); 1.20286 + visitor(this.callee); 1.20287 + visitArrayInputs(this.args, visitor); 1.20288 + }; 1.20289 + return newNode; 1.20290 + }(); 1.20291 + var ASNew = function () { 1.20292 + function asNewNode(control, store, callee, args) { 1.20293 + true; 1.20294 + true; 1.20295 + true; 1.20296 + true; 1.20297 + true; 1.20298 + this.control = control; 1.20299 + this.store = store; 1.20300 + this.loads = undefined; 1.20301 + this.callee = callee; 1.20302 + this.args = args; 1.20303 + this.id = nextID[nextID.length - 1] += 1; 1.20304 + } 1.20305 + asNewNode.prototype = extend(New, 'ASNew'); 1.20306 + asNewNode.prototype.nodeName = 'ASNew'; 1.20307 + asNewNode.prototype.visitInputs = function (visitor) { 1.20308 + this.control && visitor(this.control); 1.20309 + this.store && visitor(this.store); 1.20310 + this.loads && visitArrayInputs(this.loads, visitor); 1.20311 + visitor(this.callee); 1.20312 + visitArrayInputs(this.args, visitor); 1.20313 + }; 1.20314 + return asNewNode; 1.20315 + }(); 1.20316 + var GetProperty = function () { 1.20317 + function getPropertyNode(control, store, object, name) { 1.20318 + true; 1.20319 + true; 1.20320 + true; 1.20321 + true; 1.20322 + true; 1.20323 + this.control = control; 1.20324 + this.store = store; 1.20325 + this.loads = undefined; 1.20326 + this.object = object; 1.20327 + this.name = name; 1.20328 + this.id = nextID[nextID.length - 1] += 1; 1.20329 + } 1.20330 + getPropertyNode.prototype = extend(StoreDependent, 'GetProperty'); 1.20331 + getPropertyNode.prototype.nodeName = 'GetProperty'; 1.20332 + getPropertyNode.prototype.visitInputs = function (visitor) { 1.20333 + this.control && visitor(this.control); 1.20334 + this.store && visitor(this.store); 1.20335 + this.loads && visitArrayInputs(this.loads, visitor); 1.20336 + visitor(this.object); 1.20337 + visitor(this.name); 1.20338 + }; 1.20339 + return getPropertyNode; 1.20340 + }(); 1.20341 + var ASGetProperty = function () { 1.20342 + function asGetPropertyNode(control, store, object, name, flags) { 1.20343 + true; 1.20344 + true; 1.20345 + true; 1.20346 + true; 1.20347 + true; 1.20348 + true; 1.20349 + this.control = control; 1.20350 + this.store = store; 1.20351 + this.loads = undefined; 1.20352 + this.object = object; 1.20353 + this.name = name; 1.20354 + this.flags = flags; 1.20355 + this.id = nextID[nextID.length - 1] += 1; 1.20356 + } 1.20357 + asGetPropertyNode.prototype = extend(GetProperty, 'ASGetProperty'); 1.20358 + asGetPropertyNode.prototype.nodeName = 'ASGetProperty'; 1.20359 + asGetPropertyNode.prototype.visitInputs = function (visitor) { 1.20360 + this.control && visitor(this.control); 1.20361 + this.store && visitor(this.store); 1.20362 + this.loads && visitArrayInputs(this.loads, visitor); 1.20363 + visitor(this.object); 1.20364 + visitor(this.name); 1.20365 + }; 1.20366 + return asGetPropertyNode; 1.20367 + }(); 1.20368 + var ASGetDescendants = function () { 1.20369 + function asGetDescendantsNode(control, store, object, name) { 1.20370 + true; 1.20371 + true; 1.20372 + true; 1.20373 + true; 1.20374 + true; 1.20375 + this.control = control; 1.20376 + this.store = store; 1.20377 + this.loads = undefined; 1.20378 + this.object = object; 1.20379 + this.name = name; 1.20380 + this.id = nextID[nextID.length - 1] += 1; 1.20381 + } 1.20382 + asGetDescendantsNode.prototype = extend(GetProperty, 'ASGetDescendants'); 1.20383 + asGetDescendantsNode.prototype.nodeName = 'ASGetDescendants'; 1.20384 + asGetDescendantsNode.prototype.visitInputs = function (visitor) { 1.20385 + this.control && visitor(this.control); 1.20386 + this.store && visitor(this.store); 1.20387 + this.loads && visitArrayInputs(this.loads, visitor); 1.20388 + visitor(this.object); 1.20389 + visitor(this.name); 1.20390 + }; 1.20391 + return asGetDescendantsNode; 1.20392 + }(); 1.20393 + var ASHasProperty = function () { 1.20394 + function asHasPropertyNode(control, store, object, name) { 1.20395 + true; 1.20396 + true; 1.20397 + true; 1.20398 + true; 1.20399 + true; 1.20400 + this.control = control; 1.20401 + this.store = store; 1.20402 + this.loads = undefined; 1.20403 + this.object = object; 1.20404 + this.name = name; 1.20405 + this.id = nextID[nextID.length - 1] += 1; 1.20406 + } 1.20407 + asHasPropertyNode.prototype = extend(GetProperty, 'ASHasProperty'); 1.20408 + asHasPropertyNode.prototype.nodeName = 'ASHasProperty'; 1.20409 + asHasPropertyNode.prototype.visitInputs = function (visitor) { 1.20410 + this.control && visitor(this.control); 1.20411 + this.store && visitor(this.store); 1.20412 + this.loads && visitArrayInputs(this.loads, visitor); 1.20413 + visitor(this.object); 1.20414 + visitor(this.name); 1.20415 + }; 1.20416 + return asHasPropertyNode; 1.20417 + }(); 1.20418 + var ASGetSlot = function () { 1.20419 + function asGetSlotNode(control, store, object, name) { 1.20420 + true; 1.20421 + true; 1.20422 + true; 1.20423 + true; 1.20424 + true; 1.20425 + this.control = control; 1.20426 + this.store = store; 1.20427 + this.loads = undefined; 1.20428 + this.object = object; 1.20429 + this.name = name; 1.20430 + this.id = nextID[nextID.length - 1] += 1; 1.20431 + } 1.20432 + asGetSlotNode.prototype = extend(GetProperty, 'ASGetSlot'); 1.20433 + asGetSlotNode.prototype.nodeName = 'ASGetSlot'; 1.20434 + asGetSlotNode.prototype.visitInputs = function (visitor) { 1.20435 + this.control && visitor(this.control); 1.20436 + this.store && visitor(this.store); 1.20437 + this.loads && visitArrayInputs(this.loads, visitor); 1.20438 + visitor(this.object); 1.20439 + visitor(this.name); 1.20440 + }; 1.20441 + return asGetSlotNode; 1.20442 + }(); 1.20443 + var ASGetSuper = function () { 1.20444 + function asGetSuperNode(control, store, object, name, scope) { 1.20445 + true; 1.20446 + true; 1.20447 + true; 1.20448 + true; 1.20449 + true; 1.20450 + true; 1.20451 + this.control = control; 1.20452 + this.store = store; 1.20453 + this.loads = undefined; 1.20454 + this.object = object; 1.20455 + this.name = name; 1.20456 + this.scope = scope; 1.20457 + this.id = nextID[nextID.length - 1] += 1; 1.20458 + } 1.20459 + asGetSuperNode.prototype = extend(GetProperty, 'ASGetSuper'); 1.20460 + asGetSuperNode.prototype.nodeName = 'ASGetSuper'; 1.20461 + asGetSuperNode.prototype.visitInputs = function (visitor) { 1.20462 + this.control && visitor(this.control); 1.20463 + this.store && visitor(this.store); 1.20464 + this.loads && visitArrayInputs(this.loads, visitor); 1.20465 + visitor(this.object); 1.20466 + visitor(this.name); 1.20467 + visitor(this.scope); 1.20468 + }; 1.20469 + return asGetSuperNode; 1.20470 + }(); 1.20471 + var SetProperty = function () { 1.20472 + function setPropertyNode(control, store, object, name, value) { 1.20473 + true; 1.20474 + true; 1.20475 + true; 1.20476 + true; 1.20477 + true; 1.20478 + true; 1.20479 + this.control = control; 1.20480 + this.store = store; 1.20481 + this.loads = undefined; 1.20482 + this.object = object; 1.20483 + this.name = name; 1.20484 + this.value = value; 1.20485 + this.id = nextID[nextID.length - 1] += 1; 1.20486 + } 1.20487 + setPropertyNode.prototype = extend(StoreDependent, 'SetProperty'); 1.20488 + setPropertyNode.prototype.nodeName = 'SetProperty'; 1.20489 + setPropertyNode.prototype.visitInputs = function (visitor) { 1.20490 + this.control && visitor(this.control); 1.20491 + this.store && visitor(this.store); 1.20492 + this.loads && visitArrayInputs(this.loads, visitor); 1.20493 + visitor(this.object); 1.20494 + visitor(this.name); 1.20495 + visitor(this.value); 1.20496 + }; 1.20497 + return setPropertyNode; 1.20498 + }(); 1.20499 + var ASSetProperty = function () { 1.20500 + function asSetPropertyNode(control, store, object, name, value, flags) { 1.20501 + true; 1.20502 + true; 1.20503 + true; 1.20504 + true; 1.20505 + true; 1.20506 + true; 1.20507 + this.control = control; 1.20508 + this.store = store; 1.20509 + this.loads = undefined; 1.20510 + this.object = object; 1.20511 + this.name = name; 1.20512 + this.value = value; 1.20513 + this.flags = flags; 1.20514 + this.id = nextID[nextID.length - 1] += 1; 1.20515 + } 1.20516 + asSetPropertyNode.prototype = extend(SetProperty, 'ASSetProperty'); 1.20517 + asSetPropertyNode.prototype.nodeName = 'ASSetProperty'; 1.20518 + asSetPropertyNode.prototype.visitInputs = function (visitor) { 1.20519 + this.control && visitor(this.control); 1.20520 + this.store && visitor(this.store); 1.20521 + this.loads && visitArrayInputs(this.loads, visitor); 1.20522 + visitor(this.object); 1.20523 + visitor(this.name); 1.20524 + visitor(this.value); 1.20525 + }; 1.20526 + return asSetPropertyNode; 1.20527 + }(); 1.20528 + var ASSetSlot = function () { 1.20529 + function asSetSlotNode(control, store, object, name, value) { 1.20530 + true; 1.20531 + true; 1.20532 + true; 1.20533 + true; 1.20534 + true; 1.20535 + true; 1.20536 + this.control = control; 1.20537 + this.store = store; 1.20538 + this.loads = undefined; 1.20539 + this.object = object; 1.20540 + this.name = name; 1.20541 + this.value = value; 1.20542 + this.id = nextID[nextID.length - 1] += 1; 1.20543 + } 1.20544 + asSetSlotNode.prototype = extend(SetProperty, 'ASSetSlot'); 1.20545 + asSetSlotNode.prototype.nodeName = 'ASSetSlot'; 1.20546 + asSetSlotNode.prototype.visitInputs = function (visitor) { 1.20547 + this.control && visitor(this.control); 1.20548 + this.store && visitor(this.store); 1.20549 + this.loads && visitArrayInputs(this.loads, visitor); 1.20550 + visitor(this.object); 1.20551 + visitor(this.name); 1.20552 + visitor(this.value); 1.20553 + }; 1.20554 + return asSetSlotNode; 1.20555 + }(); 1.20556 + var ASSetSuper = function () { 1.20557 + function asSetSuperNode(control, store, object, name, value, scope) { 1.20558 + true; 1.20559 + true; 1.20560 + true; 1.20561 + true; 1.20562 + true; 1.20563 + true; 1.20564 + true; 1.20565 + this.control = control; 1.20566 + this.store = store; 1.20567 + this.loads = undefined; 1.20568 + this.object = object; 1.20569 + this.name = name; 1.20570 + this.value = value; 1.20571 + this.scope = scope; 1.20572 + this.id = nextID[nextID.length - 1] += 1; 1.20573 + } 1.20574 + asSetSuperNode.prototype = extend(SetProperty, 'ASSetSuper'); 1.20575 + asSetSuperNode.prototype.nodeName = 'ASSetSuper'; 1.20576 + asSetSuperNode.prototype.visitInputs = function (visitor) { 1.20577 + this.control && visitor(this.control); 1.20578 + this.store && visitor(this.store); 1.20579 + this.loads && visitArrayInputs(this.loads, visitor); 1.20580 + visitor(this.object); 1.20581 + visitor(this.name); 1.20582 + visitor(this.value); 1.20583 + visitor(this.scope); 1.20584 + }; 1.20585 + return asSetSuperNode; 1.20586 + }(); 1.20587 + var DeleteProperty = function () { 1.20588 + function deletePropertyNode(control, store, object, name) { 1.20589 + true; 1.20590 + true; 1.20591 + true; 1.20592 + true; 1.20593 + true; 1.20594 + this.control = control; 1.20595 + this.store = store; 1.20596 + this.loads = undefined; 1.20597 + this.object = object; 1.20598 + this.name = name; 1.20599 + this.id = nextID[nextID.length - 1] += 1; 1.20600 + } 1.20601 + deletePropertyNode.prototype = extend(StoreDependent, 'DeleteProperty'); 1.20602 + deletePropertyNode.prototype.nodeName = 'DeleteProperty'; 1.20603 + deletePropertyNode.prototype.visitInputs = function (visitor) { 1.20604 + this.control && visitor(this.control); 1.20605 + this.store && visitor(this.store); 1.20606 + this.loads && visitArrayInputs(this.loads, visitor); 1.20607 + visitor(this.object); 1.20608 + visitor(this.name); 1.20609 + }; 1.20610 + return deletePropertyNode; 1.20611 + }(); 1.20612 + var ASDeleteProperty = function () { 1.20613 + function asDeletePropertyNode(control, store, object, name) { 1.20614 + true; 1.20615 + true; 1.20616 + true; 1.20617 + true; 1.20618 + true; 1.20619 + this.control = control; 1.20620 + this.store = store; 1.20621 + this.loads = undefined; 1.20622 + this.object = object; 1.20623 + this.name = name; 1.20624 + this.id = nextID[nextID.length - 1] += 1; 1.20625 + } 1.20626 + asDeletePropertyNode.prototype = extend(DeleteProperty, 'ASDeleteProperty'); 1.20627 + asDeletePropertyNode.prototype.nodeName = 'ASDeleteProperty'; 1.20628 + asDeletePropertyNode.prototype.visitInputs = function (visitor) { 1.20629 + this.control && visitor(this.control); 1.20630 + this.store && visitor(this.store); 1.20631 + this.loads && visitArrayInputs(this.loads, visitor); 1.20632 + visitor(this.object); 1.20633 + visitor(this.name); 1.20634 + }; 1.20635 + return asDeletePropertyNode; 1.20636 + }(); 1.20637 + var ASFindProperty = function () { 1.20638 + function asFindPropertyNode(control, store, scope, name, domain, strict) { 1.20639 + true; 1.20640 + true; 1.20641 + true; 1.20642 + true; 1.20643 + true; 1.20644 + true; 1.20645 + this.control = control; 1.20646 + this.store = store; 1.20647 + this.loads = undefined; 1.20648 + this.scope = scope; 1.20649 + this.name = name; 1.20650 + this.domain = domain; 1.20651 + this.strict = strict; 1.20652 + this.id = nextID[nextID.length - 1] += 1; 1.20653 + } 1.20654 + asFindPropertyNode.prototype = extend(StoreDependent, 'ASFindProperty'); 1.20655 + asFindPropertyNode.prototype.nodeName = 'ASFindProperty'; 1.20656 + asFindPropertyNode.prototype.visitInputs = function (visitor) { 1.20657 + this.control && visitor(this.control); 1.20658 + this.store && visitor(this.store); 1.20659 + this.loads && visitArrayInputs(this.loads, visitor); 1.20660 + visitor(this.scope); 1.20661 + visitor(this.name); 1.20662 + visitor(this.domain); 1.20663 + }; 1.20664 + return asFindPropertyNode; 1.20665 + }(); 1.20666 + var Store = function () { 1.20667 + function storeNode() { 1.20668 + true; 1.20669 + this.id = nextID[nextID.length - 1] += 1; 1.20670 + } 1.20671 + storeNode.prototype = extend(Value, 'Store'); 1.20672 + storeNode.prototype.nodeName = 'Store'; 1.20673 + storeNode.prototype.visitInputs = function (visitor) { 1.20674 + }; 1.20675 + return storeNode; 1.20676 + }(); 1.20677 + var Phi = function () { 1.20678 + function phiNode(control, value) { 1.20679 + true; 1.20680 + true; 1.20681 + this.control = control; 1.20682 + this.args = value ? [ 1.20683 + value 1.20684 + ] : []; 1.20685 + this.id = nextID[nextID.length - 1] += 1; 1.20686 + } 1.20687 + phiNode.prototype = extend(Value, 'Phi'); 1.20688 + phiNode.prototype.nodeName = 'Phi'; 1.20689 + phiNode.prototype.visitInputs = function (visitor) { 1.20690 + this.control && visitor(this.control); 1.20691 + visitArrayInputs(this.args, visitor); 1.20692 + }; 1.20693 + return phiNode; 1.20694 + }(); 1.20695 + var Variable = function () { 1.20696 + function variableNode(name) { 1.20697 + true; 1.20698 + this.name = name; 1.20699 + this.id = nextID[nextID.length - 1] += 1; 1.20700 + } 1.20701 + variableNode.prototype = extend(Value, 'Variable'); 1.20702 + variableNode.prototype.nodeName = 'Variable'; 1.20703 + variableNode.prototype.visitInputs = function (visitor) { 1.20704 + }; 1.20705 + return variableNode; 1.20706 + }(); 1.20707 + var Copy = function () { 1.20708 + function copyNode(argument) { 1.20709 + true; 1.20710 + this.argument = argument; 1.20711 + this.id = nextID[nextID.length - 1] += 1; 1.20712 + } 1.20713 + copyNode.prototype = extend(Value, 'Copy'); 1.20714 + copyNode.prototype.nodeName = 'Copy'; 1.20715 + copyNode.prototype.visitInputs = function (visitor) { 1.20716 + visitor(this.argument); 1.20717 + }; 1.20718 + return copyNode; 1.20719 + }(); 1.20720 + var Move = function () { 1.20721 + function moveNode(to, from) { 1.20722 + true; 1.20723 + this.to = to; 1.20724 + this.from = from; 1.20725 + this.id = nextID[nextID.length - 1] += 1; 1.20726 + } 1.20727 + moveNode.prototype = extend(Value, 'Move'); 1.20728 + moveNode.prototype.nodeName = 'Move'; 1.20729 + moveNode.prototype.visitInputs = function (visitor) { 1.20730 + visitor(this.to); 1.20731 + visitor(this.from); 1.20732 + }; 1.20733 + return moveNode; 1.20734 + }(); 1.20735 + var Projection = function () { 1.20736 + function projectionNode(argument, type, selector) { 1.20737 + true; 1.20738 + this.argument = argument; 1.20739 + this.type = type; 1.20740 + this.selector = selector; 1.20741 + this.id = nextID[nextID.length - 1] += 1; 1.20742 + } 1.20743 + projectionNode.prototype = extend(Value, 'Projection'); 1.20744 + projectionNode.prototype.nodeName = 'Projection'; 1.20745 + projectionNode.prototype.visitInputs = function (visitor) { 1.20746 + visitor(this.argument); 1.20747 + }; 1.20748 + return projectionNode; 1.20749 + }(); 1.20750 + var Latch = function () { 1.20751 + function latchNode(control, condition, left, right) { 1.20752 + true; 1.20753 + true; 1.20754 + this.control = control; 1.20755 + this.condition = condition; 1.20756 + this.left = left; 1.20757 + this.right = right; 1.20758 + this.id = nextID[nextID.length - 1] += 1; 1.20759 + } 1.20760 + latchNode.prototype = extend(Value, 'Latch'); 1.20761 + latchNode.prototype.nodeName = 'Latch'; 1.20762 + latchNode.prototype.visitInputs = function (visitor) { 1.20763 + this.control && visitor(this.control); 1.20764 + visitor(this.condition); 1.20765 + visitor(this.left); 1.20766 + visitor(this.right); 1.20767 + }; 1.20768 + return latchNode; 1.20769 + }(); 1.20770 + var Binary = function () { 1.20771 + function binaryNode(operator, left, right) { 1.20772 + true; 1.20773 + this.operator = operator; 1.20774 + this.left = left; 1.20775 + this.right = right; 1.20776 + this.id = nextID[nextID.length - 1] += 1; 1.20777 + } 1.20778 + binaryNode.prototype = extend(Value, 'Binary'); 1.20779 + binaryNode.prototype.nodeName = 'Binary'; 1.20780 + binaryNode.prototype.visitInputs = function (visitor) { 1.20781 + visitor(this.left); 1.20782 + visitor(this.right); 1.20783 + }; 1.20784 + return binaryNode; 1.20785 + }(); 1.20786 + var Unary = function () { 1.20787 + function unaryNode(operator, argument) { 1.20788 + true; 1.20789 + this.operator = operator; 1.20790 + this.argument = argument; 1.20791 + this.id = nextID[nextID.length - 1] += 1; 1.20792 + } 1.20793 + unaryNode.prototype = extend(Value, 'Unary'); 1.20794 + unaryNode.prototype.nodeName = 'Unary'; 1.20795 + unaryNode.prototype.visitInputs = function (visitor) { 1.20796 + visitor(this.argument); 1.20797 + }; 1.20798 + return unaryNode; 1.20799 + }(); 1.20800 + var Constant = function () { 1.20801 + function constantNode(value) { 1.20802 + true; 1.20803 + this.value = value; 1.20804 + this.id = nextID[nextID.length - 1] += 1; 1.20805 + } 1.20806 + constantNode.prototype = extend(Value, 'Constant'); 1.20807 + constantNode.prototype.nodeName = 'Constant'; 1.20808 + constantNode.prototype.visitInputs = function (visitor) { 1.20809 + }; 1.20810 + return constantNode; 1.20811 + }(); 1.20812 + var GlobalProperty = function () { 1.20813 + function globalPropertyNode(name) { 1.20814 + true; 1.20815 + this.name = name; 1.20816 + this.id = nextID[nextID.length - 1] += 1; 1.20817 + } 1.20818 + globalPropertyNode.prototype = extend(Value, 'GlobalProperty'); 1.20819 + globalPropertyNode.prototype.nodeName = 'GlobalProperty'; 1.20820 + globalPropertyNode.prototype.visitInputs = function (visitor) { 1.20821 + }; 1.20822 + return globalPropertyNode; 1.20823 + }(); 1.20824 + var This = function () { 1.20825 + function thisNode(control) { 1.20826 + true; 1.20827 + true; 1.20828 + this.control = control; 1.20829 + this.id = nextID[nextID.length - 1] += 1; 1.20830 + } 1.20831 + thisNode.prototype = extend(Value, 'This'); 1.20832 + thisNode.prototype.nodeName = 'This'; 1.20833 + thisNode.prototype.visitInputs = function (visitor) { 1.20834 + visitor(this.control); 1.20835 + }; 1.20836 + return thisNode; 1.20837 + }(); 1.20838 + var Throw = function () { 1.20839 + function throwNode(control, argument) { 1.20840 + true; 1.20841 + true; 1.20842 + this.control = control; 1.20843 + this.argument = argument; 1.20844 + this.id = nextID[nextID.length - 1] += 1; 1.20845 + } 1.20846 + throwNode.prototype = extend(Value, 'Throw'); 1.20847 + throwNode.prototype.nodeName = 'Throw'; 1.20848 + throwNode.prototype.visitInputs = function (visitor) { 1.20849 + visitor(this.control); 1.20850 + visitor(this.argument); 1.20851 + }; 1.20852 + return throwNode; 1.20853 + }(); 1.20854 + var Arguments = function () { 1.20855 + function argumentsNode(control) { 1.20856 + true; 1.20857 + true; 1.20858 + this.control = control; 1.20859 + this.id = nextID[nextID.length - 1] += 1; 1.20860 + } 1.20861 + argumentsNode.prototype = extend(Value, 'Arguments'); 1.20862 + argumentsNode.prototype.nodeName = 'Arguments'; 1.20863 + argumentsNode.prototype.visitInputs = function (visitor) { 1.20864 + visitor(this.control); 1.20865 + }; 1.20866 + return argumentsNode; 1.20867 + }(); 1.20868 + var Parameter = function () { 1.20869 + function parameterNode(control, index, name) { 1.20870 + true; 1.20871 + true; 1.20872 + this.control = control; 1.20873 + this.index = index; 1.20874 + this.name = name; 1.20875 + this.id = nextID[nextID.length - 1] += 1; 1.20876 + } 1.20877 + parameterNode.prototype = extend(Value, 'Parameter'); 1.20878 + parameterNode.prototype.nodeName = 'Parameter'; 1.20879 + parameterNode.prototype.visitInputs = function (visitor) { 1.20880 + visitor(this.control); 1.20881 + }; 1.20882 + return parameterNode; 1.20883 + }(); 1.20884 + var NewArray = function () { 1.20885 + function newArrayNode(control, elements) { 1.20886 + true; 1.20887 + true; 1.20888 + this.control = control; 1.20889 + this.elements = elements; 1.20890 + this.id = nextID[nextID.length - 1] += 1; 1.20891 + } 1.20892 + newArrayNode.prototype = extend(Value, 'NewArray'); 1.20893 + newArrayNode.prototype.nodeName = 'NewArray'; 1.20894 + newArrayNode.prototype.visitInputs = function (visitor) { 1.20895 + visitor(this.control); 1.20896 + visitArrayInputs(this.elements, visitor); 1.20897 + }; 1.20898 + return newArrayNode; 1.20899 + }(); 1.20900 + var NewObject = function () { 1.20901 + function newObjectNode(control, properties) { 1.20902 + true; 1.20903 + true; 1.20904 + this.control = control; 1.20905 + this.properties = properties; 1.20906 + this.id = nextID[nextID.length - 1] += 1; 1.20907 + } 1.20908 + newObjectNode.prototype = extend(Value, 'NewObject'); 1.20909 + newObjectNode.prototype.nodeName = 'NewObject'; 1.20910 + newObjectNode.prototype.visitInputs = function (visitor) { 1.20911 + visitor(this.control); 1.20912 + visitArrayInputs(this.properties, visitor); 1.20913 + }; 1.20914 + return newObjectNode; 1.20915 + }(); 1.20916 + var KeyValuePair = function () { 1.20917 + function keyValuePairNode(key, value) { 1.20918 + true; 1.20919 + this.key = key; 1.20920 + this.value = value; 1.20921 + this.id = nextID[nextID.length - 1] += 1; 1.20922 + } 1.20923 + keyValuePairNode.prototype = extend(Value, 'KeyValuePair'); 1.20924 + keyValuePairNode.prototype.nodeName = 'KeyValuePair'; 1.20925 + keyValuePairNode.prototype.visitInputs = function (visitor) { 1.20926 + visitor(this.key); 1.20927 + visitor(this.value); 1.20928 + }; 1.20929 + return keyValuePairNode; 1.20930 + }(); 1.20931 + var ASScope = function () { 1.20932 + function asScopeNode(parent, object, isWith) { 1.20933 + true; 1.20934 + this.parent = parent; 1.20935 + this.object = object; 1.20936 + this.isWith = isWith; 1.20937 + this.id = nextID[nextID.length - 1] += 1; 1.20938 + } 1.20939 + asScopeNode.prototype = extend(Value, 'ASScope'); 1.20940 + asScopeNode.prototype.nodeName = 'ASScope'; 1.20941 + asScopeNode.prototype.visitInputs = function (visitor) { 1.20942 + visitor(this.parent); 1.20943 + visitor(this.object); 1.20944 + }; 1.20945 + return asScopeNode; 1.20946 + }(); 1.20947 + var ASGlobal = function () { 1.20948 + function asGlobalNode(control, scope) { 1.20949 + true; 1.20950 + true; 1.20951 + true; 1.20952 + this.control = control; 1.20953 + this.scope = scope; 1.20954 + this.id = nextID[nextID.length - 1] += 1; 1.20955 + } 1.20956 + asGlobalNode.prototype = extend(Value, 'ASGlobal'); 1.20957 + asGlobalNode.prototype.nodeName = 'ASGlobal'; 1.20958 + asGlobalNode.prototype.visitInputs = function (visitor) { 1.20959 + this.control && visitor(this.control); 1.20960 + visitor(this.scope); 1.20961 + }; 1.20962 + return asGlobalNode; 1.20963 + }(); 1.20964 + var ASNewActivation = function () { 1.20965 + function asNewActivationNode(methodInfo) { 1.20966 + true; 1.20967 + this.methodInfo = methodInfo; 1.20968 + this.id = nextID[nextID.length - 1] += 1; 1.20969 + } 1.20970 + asNewActivationNode.prototype = extend(Value, 'ASNewActivation'); 1.20971 + asNewActivationNode.prototype.nodeName = 'ASNewActivation'; 1.20972 + asNewActivationNode.prototype.visitInputs = function (visitor) { 1.20973 + }; 1.20974 + return asNewActivationNode; 1.20975 + }(); 1.20976 + var ASMultiname = function () { 1.20977 + function asMultinameNode(namespaces, name, flags) { 1.20978 + true; 1.20979 + this.namespaces = namespaces; 1.20980 + this.name = name; 1.20981 + this.flags = flags; 1.20982 + this.id = nextID[nextID.length - 1] += 1; 1.20983 + } 1.20984 + asMultinameNode.prototype = extend(Value, 'ASMultiname'); 1.20985 + asMultinameNode.prototype.nodeName = 'ASMultiname'; 1.20986 + asMultinameNode.prototype.visitInputs = function (visitor) { 1.20987 + visitor(this.namespaces); 1.20988 + visitor(this.name); 1.20989 + }; 1.20990 + return asMultinameNode; 1.20991 + }(); 1.20992 + function node() { 1.20993 + this.id = nextID[nextID.length - 1] += 1; 1.20994 + } 1.20995 + Node.startNumbering = function () { 1.20996 + nextID.push(0); 1.20997 + }; 1.20998 + Node.stopNumbering = function () { 1.20999 + nextID.pop(); 1.21000 + }; 1.21001 + Node.prototype.toString = function (brief) { 1.21002 + if (brief) { 1.21003 + return nameOf(this); 1.21004 + } 1.21005 + var inputs = []; 1.21006 + this.visitInputs(function (input) { 1.21007 + inputs.push(nameOf(input)); 1.21008 + }); 1.21009 + var str = nameOf(this) + ' = ' + this.nodeName.toUpperCase(); 1.21010 + if (this.toStringDetails) { 1.21011 + str += ' ' + this.toStringDetails(); 1.21012 + } 1.21013 + if (inputs.length) { 1.21014 + str += ' ' + inputs.join(', '); 1.21015 + } 1.21016 + return str; 1.21017 + }; 1.21018 + Node.prototype.visitInputsNoConstants = function visitInputs(visitor) { 1.21019 + this.visitInputs(function (node) { 1.21020 + if (isConstant(node)) { 1.21021 + return; 1.21022 + } 1.21023 + visitor(node); 1.21024 + }); 1.21025 + }; 1.21026 + Node.prototype.replaceInput = function (oldInput, newInput) { 1.21027 + var count = 0; 1.21028 + for (var k in this) { 1.21029 + var v = this[k]; 1.21030 + if (v instanceof Node) { 1.21031 + if (v === oldInput) { 1.21032 + this[k] = newInput; 1.21033 + count++; 1.21034 + } 1.21035 + } 1.21036 + if (v instanceof Array) { 1.21037 + count += v.replace(oldInput, newInput); 1.21038 + } 1.21039 + } 1.21040 + return count; 1.21041 + }; 1.21042 + Projection.Type = { 1.21043 + CASE: 'case', 1.21044 + TRUE: 'true', 1.21045 + FALSE: 'false', 1.21046 + STORE: 'store', 1.21047 + SCOPE: 'scope' 1.21048 + }; 1.21049 + Projection.prototype.project = function () { 1.21050 + return this.argument; 1.21051 + }; 1.21052 + Phi.prototype.seal = function seal() { 1.21053 + this.sealed = true; 1.21054 + }; 1.21055 + Phi.prototype.pushValue = function pushValue(x) { 1.21056 + true; 1.21057 + true; 1.21058 + this.args.push(x); 1.21059 + }; 1.21060 + KeyValuePair.prototype.mustFloat = true; 1.21061 + ASMultiname.prototype.mustFloat = true; 1.21062 + ASMultiname.prototype.isAttribute = function () { 1.21063 + return this.flags & 1; 1.21064 + }; 1.21065 + var Flags = { 1.21066 + INDEXED: 1, 1.21067 + RESOLVED: 2, 1.21068 + PRISTINE: 4, 1.21069 + IS_METHOD: 8 1.21070 + }; 1.21071 + var Operator = function () { 1.21072 + var map = {}; 1.21073 + function operator(name, evaluate, binary) { 1.21074 + this.name = name; 1.21075 + this.binary = binary; 1.21076 + this.evaluate = evaluate; 1.21077 + map[name] = this; 1.21078 + } 1.21079 + operator.ADD = new operator('+', function (l, r) { 1.21080 + return l + r; 1.21081 + }, true); 1.21082 + operator.SUB = new operator('-', function (l, r) { 1.21083 + return l - r; 1.21084 + }, true); 1.21085 + operator.MUL = new operator('*', function (l, r) { 1.21086 + return l * r; 1.21087 + }, true); 1.21088 + operator.DIV = new operator('/', function (l, r) { 1.21089 + return l / r; 1.21090 + }, true); 1.21091 + operator.MOD = new operator('%', function (l, r) { 1.21092 + return l % r; 1.21093 + }, true); 1.21094 + operator.AND = new operator('&', function (l, r) { 1.21095 + return l & r; 1.21096 + }, true); 1.21097 + operator.OR = new operator('|', function (l, r) { 1.21098 + return l | r; 1.21099 + }, true); 1.21100 + operator.XOR = new operator('^', function (l, r) { 1.21101 + return l ^ r; 1.21102 + }, true); 1.21103 + operator.LSH = new operator('<<', function (l, r) { 1.21104 + return l << r; 1.21105 + }, true); 1.21106 + operator.RSH = new operator('>>', function (l, r) { 1.21107 + return l >> r; 1.21108 + }, true); 1.21109 + operator.URSH = new operator('>>>', function (l, r) { 1.21110 + return l >>> r; 1.21111 + }, true); 1.21112 + operator.SEQ = new operator('===', function (l, r) { 1.21113 + return l === r; 1.21114 + }, true); 1.21115 + operator.SNE = new operator('!==', function (l, r) { 1.21116 + return l !== r; 1.21117 + }, true); 1.21118 + operator.EQ = new operator('==', function (l, r) { 1.21119 + return l == r; 1.21120 + }, true); 1.21121 + operator.NE = new operator('!=', function (l, r) { 1.21122 + return l != r; 1.21123 + }, true); 1.21124 + operator.LE = new operator('<=', function (l, r) { 1.21125 + return l <= r; 1.21126 + }, true); 1.21127 + operator.GT = new operator('>', function (l, r) { 1.21128 + return l > r; 1.21129 + }, true); 1.21130 + operator.LT = new operator('<', function (l, r) { 1.21131 + return l < r; 1.21132 + }, true); 1.21133 + operator.GE = new operator('>=', function (l, r) { 1.21134 + return l >= r; 1.21135 + }, true); 1.21136 + operator.BITWISE_NOT = new operator('~', function (a) { 1.21137 + return ~a; 1.21138 + }, false); 1.21139 + operator.PLUS = new operator('+', function (a) { 1.21140 + return +a; 1.21141 + }, false); 1.21142 + operator.NEG = new operator('-', function (a) { 1.21143 + return -a; 1.21144 + }, false); 1.21145 + operator.TYPE_OF = new operator('typeof', function (a) { 1.21146 + return typeof a; 1.21147 + }, false); 1.21148 + operator.TRUE = new operator('!!', function (a) { 1.21149 + return !(!a); 1.21150 + }, false); 1.21151 + operator.FALSE = new operator('!', function (a) { 1.21152 + return !a; 1.21153 + }, false); 1.21154 + operator.AS_ADD = new operator('+', function (l, r) { 1.21155 + if (typeof l === 'string' || typeof r === 'string') { 1.21156 + return String(l) + String(r); 1.21157 + } 1.21158 + return l + r; 1.21159 + }, true); 1.21160 + function linkOpposites(a, b) { 1.21161 + a.not = b; 1.21162 + b.not = a; 1.21163 + } 1.21164 + linkOpposites(operator.SEQ, operator.SNE); 1.21165 + linkOpposites(operator.EQ, operator.NE); 1.21166 + linkOpposites(operator.TRUE, operator.FALSE); 1.21167 + operator.fromName = function fromName(name) { 1.21168 + return map[name]; 1.21169 + }; 1.21170 + operator.prototype.isBinary = function isBinary() { 1.21171 + return this.binary; 1.21172 + }; 1.21173 + operator.prototype.toString = function toString() { 1.21174 + return this.name; 1.21175 + }; 1.21176 + return operator; 1.21177 + }(); 1.21178 + function extend(c, name) { 1.21179 + true; 1.21180 + return Object.create(c.prototype, { 1.21181 + nodeName: { 1.21182 + value: name 1.21183 + } 1.21184 + }); 1.21185 + } 1.21186 + function nameOf(o) { 1.21187 + var useColors = false; 1.21188 + var result; 1.21189 + if (o instanceof Constant) { 1.21190 + if (o.value instanceof Multiname) { 1.21191 + return o.value.name; 1.21192 + } 1.21193 + return o.value; 1.21194 + } else if (o instanceof Variable) { 1.21195 + return o.name; 1.21196 + } else if (o instanceof Phi) { 1.21197 + return result = '|' + o.id + '|', useColors ? PURPLE + result + ENDC : result; 1.21198 + } else if (o instanceof Control) { 1.21199 + return result = '{' + o.id + '}', useColors ? RED + result + ENDC : result; 1.21200 + } else if (o instanceof Projection) { 1.21201 + if (o.type === Projection.Type.STORE) { 1.21202 + return result = '[' + o.id + '->' + o.argument.id + ']', useColors ? YELLOW + result + ENDC : result; 1.21203 + } 1.21204 + return result = '(' + o.id + ')', useColors ? GREEN + result + ENDC : result; 1.21205 + } else if (o instanceof Value) { 1.21206 + return result = '(' + o.id + ')', useColors ? GREEN + result + ENDC : result; 1.21207 + } else if (o instanceof Node) { 1.21208 + return o.id; 1.21209 + } 1.21210 + unexpected(o + ' ' + typeof o); 1.21211 + } 1.21212 + function toID(node) { 1.21213 + return node.id; 1.21214 + } 1.21215 + function visitArrayInputs(array, visitor) { 1.21216 + for (var i = 0; i < array.length; i++) { 1.21217 + visitor(array[i]); 1.21218 + } 1.21219 + } 1.21220 + function visitNothing() { 1.21221 + } 1.21222 + function isNotPhi(phi) { 1.21223 + return !isPhi(phi); 1.21224 + } 1.21225 + function isPhi(phi) { 1.21226 + return phi instanceof Phi; 1.21227 + } 1.21228 + function isScope(scope) { 1.21229 + return isPhi(scope) || scope instanceof ASScope || isProjection(scope, Projection.Type.SCOPE); 1.21230 + } 1.21231 + function isMultinameConstant(node) { 1.21232 + return node instanceof Constant && node.value instanceof Multiname; 1.21233 + } 1.21234 + function isMultiname(name) { 1.21235 + return isMultinameConstant(name) || name instanceof ASMultiname; 1.21236 + } 1.21237 + function isStore(store) { 1.21238 + return isPhi(store) || store instanceof Store || isProjection(store, Projection.Type.STORE); 1.21239 + } 1.21240 + function isConstant(constant) { 1.21241 + return constant instanceof Constant; 1.21242 + } 1.21243 + function isBoolean(boolean) { 1.21244 + return boolean === true || boolean === false; 1.21245 + } 1.21246 + function isInteger(integer) { 1.21247 + return integer | 0 === integer; 1.21248 + } 1.21249 + function isArray(array) { 1.21250 + return array instanceof Array; 1.21251 + } 1.21252 + function isControlOrNull(control) { 1.21253 + return isControl(control) || control === null; 1.21254 + } 1.21255 + function isStoreOrNull(store) { 1.21256 + return isStore(store) || store === null; 1.21257 + } 1.21258 + function isControl(control) { 1.21259 + return control instanceof Control; 1.21260 + } 1.21261 + function isValueOrNull(value) { 1.21262 + return isValue(value) || value === null; 1.21263 + } 1.21264 + function isValue(value) { 1.21265 + return value instanceof Value; 1.21266 + } 1.21267 + function isProjection(node, type) { 1.21268 + return node instanceof Projection && (!type || node.type === type); 1.21269 + } 1.21270 + var Null = new Constant(null); 1.21271 + var Undefined = new Constant(undefined); 1.21272 + Undefined.toString = function () { 1.21273 + return '_'; 1.21274 + }; 1.21275 + var Block = function () { 1.21276 + function block(id, start, end) { 1.21277 + if (start) { 1.21278 + true; 1.21279 + } 1.21280 + this.region = start; 1.21281 + this.id = id; 1.21282 + this.successors = []; 1.21283 + this.predecessors = []; 1.21284 + this.nodes = [ 1.21285 + start, 1.21286 + end 1.21287 + ]; 1.21288 + } 1.21289 + block.prototype.pushSuccessorAt = function pushSuccessor(successor, index, pushPredecessor) { 1.21290 + true; 1.21291 + true; 1.21292 + this.successors[index] = successor; 1.21293 + if (pushPredecessor) { 1.21294 + successor.pushPredecessor(this); 1.21295 + } 1.21296 + }; 1.21297 + block.prototype.pushSuccessor = function pushSuccessor(successor, pushPredecessor) { 1.21298 + true; 1.21299 + this.successors.push(successor); 1.21300 + if (pushPredecessor) { 1.21301 + successor.pushPredecessor(this); 1.21302 + } 1.21303 + }; 1.21304 + block.prototype.pushPredecessor = function pushPredecessor(predecessor) { 1.21305 + true; 1.21306 + this.predecessors.push(predecessor); 1.21307 + }; 1.21308 + block.prototype.visitNodes = function (fn) { 1.21309 + var nodes = this.nodes; 1.21310 + for (var i = 0, j = nodes.length; i < j; i++) { 1.21311 + fn(nodes[i]); 1.21312 + } 1.21313 + }; 1.21314 + block.prototype.visitSuccessors = function (fn) { 1.21315 + var successors = this.successors; 1.21316 + for (var i = 0, j = successors.length; i < j; i++) { 1.21317 + fn(successors[i]); 1.21318 + } 1.21319 + }; 1.21320 + block.prototype.visitPredecessors = function (fn) { 1.21321 + var predecessors = this.predecessors; 1.21322 + for (var i = 0, j = predecessors.length; i < j; i++) { 1.21323 + fn(predecessors[i]); 1.21324 + } 1.21325 + }; 1.21326 + block.prototype.append = function (node) { 1.21327 + true; 1.21328 + true; 1.21329 + true; 1.21330 + true; 1.21331 + if (node.mustFloat) { 1.21332 + return; 1.21333 + } 1.21334 + this.nodes.splice(this.nodes.length - 1, 0, node); 1.21335 + }; 1.21336 + block.prototype.toString = function () { 1.21337 + return 'B' + this.id + (this.name ? ' (' + this.name + ')' : ''); 1.21338 + }; 1.21339 + block.prototype.trace = function (writer) { 1.21340 + writer.writeLn(this); 1.21341 + }; 1.21342 + return block; 1.21343 + }(); 1.21344 + var DFG = function () { 1.21345 + function constructor(exit) { 1.21346 + this.exit = exit; 1.21347 + } 1.21348 + constructor.prototype.buildCFG = function () { 1.21349 + return CFG.fromDFG(this); 1.21350 + }; 1.21351 + function preOrderDepthFirstSearch(root, visitChildren, pre) { 1.21352 + var visited = []; 1.21353 + var worklist = [ 1.21354 + root 1.21355 + ]; 1.21356 + var push = worklist.push.bind(worklist); 1.21357 + var node; 1.21358 + while (node = worklist.pop()) { 1.21359 + if (visited[node.id] === 1) { 1.21360 + continue; 1.21361 + } 1.21362 + visited[node.id] = 1; 1.21363 + pre(node); 1.21364 + worklist.push(node); 1.21365 + visitChildren(node, push); 1.21366 + } 1.21367 + } 1.21368 + function postOrderDepthFirstSearch(root, visitChildren, post) { 1.21369 + var ONE_TIME = 1, MANY_TIMES = 2; 1.21370 + var visited = []; 1.21371 + var worklist = [ 1.21372 + root 1.21373 + ]; 1.21374 + function visitChild(child) { 1.21375 + if (!visited[child.id]) { 1.21376 + worklist.push(child); 1.21377 + } 1.21378 + } 1.21379 + var node; 1.21380 + while (node = worklist.top()) { 1.21381 + if (visited[node.id]) { 1.21382 + if (visited[node.id] === ONE_TIME) { 1.21383 + visited[node.id] = MANY_TIMES; 1.21384 + post(node); 1.21385 + } 1.21386 + worklist.pop(); 1.21387 + continue; 1.21388 + } 1.21389 + visited[node.id] = ONE_TIME; 1.21390 + visitChildren(node, visitChild); 1.21391 + } 1.21392 + } 1.21393 + constructor.prototype.forEachInPreOrderDepthFirstSearch = function forEachInPreOrderDepthFirstSearch(visitor) { 1.21394 + var visited = new Array(1024); 1.21395 + var worklist = [ 1.21396 + this.exit 1.21397 + ]; 1.21398 + function push(node) { 1.21399 + if (isConstant(node)) { 1.21400 + return; 1.21401 + } 1.21402 + true; 1.21403 + worklist.push(node); 1.21404 + } 1.21405 + var node; 1.21406 + while (node = worklist.pop()) { 1.21407 + if (visited[node.id]) { 1.21408 + continue; 1.21409 + } 1.21410 + visited[node.id] = 1; 1.21411 + visitor && visitor(node); 1.21412 + worklist.push(node); 1.21413 + node.visitInputs(push); 1.21414 + } 1.21415 + }; 1.21416 + constructor.prototype.forEach = function forEach(visitor, postOrder) { 1.21417 + var search = postOrder ? postOrderDepthFirstSearch : preOrderDepthFirstSearch; 1.21418 + search(this.exit, function (node, v) { 1.21419 + node.visitInputsNoConstants(v); 1.21420 + }, visitor); 1.21421 + }; 1.21422 + constructor.prototype.traceMetrics = function (writer) { 1.21423 + var counter = new metrics.Counter(true); 1.21424 + preOrderDepthFirstSearch(this.exit, function (node, visitor) { 1.21425 + node.visitInputsNoConstants(visitor); 1.21426 + }, function (node) { 1.21427 + counter.count(node.nodeName); 1.21428 + }); 1.21429 + counter.trace(writer); 1.21430 + }; 1.21431 + constructor.prototype.trace = function (writer) { 1.21432 + var nodes = []; 1.21433 + var visited = {}; 1.21434 + function colorOf(node) { 1.21435 + if (node instanceof Control) { 1.21436 + return 'yellow'; 1.21437 + } else if (node instanceof Phi) { 1.21438 + return 'purple'; 1.21439 + } else if (node instanceof Value) { 1.21440 + return 'green'; 1.21441 + } 1.21442 + return 'white'; 1.21443 + } 1.21444 + var blocks = []; 1.21445 + function followProjection(node) { 1.21446 + return node instanceof Projection ? node.project() : node; 1.21447 + } 1.21448 + function next(node) { 1.21449 + node = followProjection(node); 1.21450 + if (!visited[node.id]) { 1.21451 + visited[node.id] = true; 1.21452 + if (node.block) { 1.21453 + blocks.push(node.block); 1.21454 + } 1.21455 + nodes.push(node); 1.21456 + node.visitInputsNoConstants(next); 1.21457 + } 1.21458 + } 1.21459 + next(this.exit); 1.21460 + writer.writeLn(''); 1.21461 + writer.enter('digraph DFG {'); 1.21462 + writer.writeLn('graph [bgcolor = gray10];'); 1.21463 + writer.writeLn('edge [color = white];'); 1.21464 + writer.writeLn('node [shape = box, fontname = Consolas, fontsize = 11, color = white, fontcolor = white];'); 1.21465 + writer.writeLn('rankdir = BT;'); 1.21466 + function writeNode(node) { 1.21467 + writer.writeLn('N' + node.id + ' [label = "' + node.toString() + '", color = "' + colorOf(node) + '"];'); 1.21468 + } 1.21469 + function defineNode(node) { 1.21470 + writer.writeLn('N' + node.id + ';'); 1.21471 + } 1.21472 + blocks.forEach(function (block) { 1.21473 + writer.enter('subgraph cluster' + block.nodes[0].id + ' { bgcolor = gray20;'); 1.21474 + block.visitNodes(function (node) { 1.21475 + defineNode(followProjection(node)); 1.21476 + }); 1.21477 + writer.leave('}'); 1.21478 + }); 1.21479 + nodes.forEach(writeNode); 1.21480 + nodes.forEach(function (node) { 1.21481 + node.visitInputsNoConstants(function (input) { 1.21482 + input = followProjection(input); 1.21483 + writer.writeLn('N' + node.id + ' -> ' + 'N' + input.id + ' [color=' + colorOf(input) + '];'); 1.21484 + }); 1.21485 + }); 1.21486 + writer.leave('}'); 1.21487 + writer.writeLn(''); 1.21488 + }; 1.21489 + return constructor; 1.21490 + }(); 1.21491 + var CFG = function () { 1.21492 + function constructor() { 1.21493 + this.nextBlockID = 0; 1.21494 + this.blocks = []; 1.21495 + this.exit; 1.21496 + this.root; 1.21497 + } 1.21498 + constructor.fromDFG = function fromDFG(dfg) { 1.21499 + var cfg = new CFG(); 1.21500 + true; 1.21501 + cfg.dfg = dfg; 1.21502 + var visited = []; 1.21503 + function buildEnd(end) { 1.21504 + if (end instanceof Projection) { 1.21505 + end = end.project(); 1.21506 + } 1.21507 + true; 1.21508 + if (visited[end.id]) { 1.21509 + return; 1.21510 + } 1.21511 + visited[end.id] = true; 1.21512 + var start = end.control; 1.21513 + if (!(start instanceof Region)) { 1.21514 + start = end.control = new Region(start); 1.21515 + } 1.21516 + var block = start.block = cfg.buildBlock(start, end); 1.21517 + if (start instanceof Start) { 1.21518 + cfg.root = block; 1.21519 + } 1.21520 + for (var i = 0; i < start.predecessors.length; i++) { 1.21521 + var c = start.predecessors[i]; 1.21522 + var d; 1.21523 + var trueProjection = false; 1.21524 + if (c instanceof Projection) { 1.21525 + d = c.project(); 1.21526 + trueProjection = c.type === Projection.Type.TRUE; 1.21527 + } else { 1.21528 + d = c; 1.21529 + } 1.21530 + if (d instanceof Region) { 1.21531 + d = new Jump(c); 1.21532 + d = new Projection(d, Projection.Type.TRUE); 1.21533 + start.predecessors[i] = d; 1.21534 + d = d.project(); 1.21535 + trueProjection = true; 1.21536 + } 1.21537 + buildEnd(d); 1.21538 + var controlBlock = d.control.block; 1.21539 + if (d instanceof Switch) { 1.21540 + true; 1.21541 + controlBlock.pushSuccessorAt(block, c.selector.value, true); 1.21542 + } else if (trueProjection && controlBlock.successors.length > 0) { 1.21543 + controlBlock.pushSuccessor(block, true); 1.21544 + controlBlock.hasFlippedSuccessors = true; 1.21545 + } else { 1.21546 + controlBlock.pushSuccessor(block, true); 1.21547 + } 1.21548 + } 1.21549 + } 1.21550 + buildEnd(dfg.exit); 1.21551 + cfg.splitCriticalEdges(); 1.21552 + cfg.exit = dfg.exit.control.block; 1.21553 + cfg.computeDominators(true); 1.21554 + return cfg; 1.21555 + }; 1.21556 + constructor.prototype.buildRootAndExit = function buildRootAndExit() { 1.21557 + true; 1.21558 + if (this.blocks[0].predecessors.length > 0) { 1.21559 + this.root = new Block(this.nextBlockID++); 1.21560 + this.blocks.push(this.root); 1.21561 + this.root.pushSuccessor(this.blocks[0], true); 1.21562 + } else { 1.21563 + this.root = this.blocks[0]; 1.21564 + } 1.21565 + var exitBlocks = []; 1.21566 + for (var i = 0; i < this.blocks.length; i++) { 1.21567 + var block = this.blocks[i]; 1.21568 + if (block.successors.length === 0) { 1.21569 + exitBlocks.push(block); 1.21570 + } 1.21571 + } 1.21572 + if (exitBlocks.length === 0) { 1.21573 + unexpected('Must have an exit block.'); 1.21574 + } else if (exitBlocks.length === 1 && exitBlocks[0] !== this.root) { 1.21575 + this.exit = exitBlocks[0]; 1.21576 + } else { 1.21577 + this.exit = new Block(this.nextBlockID++); 1.21578 + this.blocks.push(this.exit); 1.21579 + for (var i = 0; i < exitBlocks.length; i++) { 1.21580 + exitBlocks[i].pushSuccessor(this.exit, true); 1.21581 + } 1.21582 + } 1.21583 + true; 1.21584 + true; 1.21585 + }; 1.21586 + constructor.prototype.fromString = function (list, rootName) { 1.21587 + var cfg = this; 1.21588 + var names = cfg.blockNames || (cfg.blockNames = {}); 1.21589 + var blocks = cfg.blocks; 1.21590 + var sets = list.replace(/\ /g, '').split(','); 1.21591 + sets.forEach(function (set) { 1.21592 + var edgeList = set.split('->'); 1.21593 + var last = null; 1.21594 + for (var i = 0; i < edgeList.length; i++) { 1.21595 + var next = edgeList[i]; 1.21596 + if (last) { 1.21597 + buildEdge(last, next); 1.21598 + } else { 1.21599 + buildBlock(next); 1.21600 + } 1.21601 + last = next; 1.21602 + } 1.21603 + }); 1.21604 + function buildBlock(name) { 1.21605 + var block = names[name]; 1.21606 + if (block) { 1.21607 + return block; 1.21608 + } 1.21609 + names[name] = block = new Block(cfg.nextBlockID++); 1.21610 + block.name = name; 1.21611 + blocks.push(block); 1.21612 + return block; 1.21613 + } 1.21614 + function buildEdge(from, to) { 1.21615 + buildBlock(from).pushSuccessor(buildBlock(to), true); 1.21616 + } 1.21617 + true; 1.21618 + this.root = names[rootName]; 1.21619 + }; 1.21620 + constructor.prototype.buildBlock = function (start, end) { 1.21621 + var block = new Block(this.nextBlockID++, start, end); 1.21622 + this.blocks.push(block); 1.21623 + return block; 1.21624 + }; 1.21625 + constructor.prototype.createBlockSet = function () { 1.21626 + if (!this.setConstructor) { 1.21627 + this.setConstructor = BitSetFunctor(this.blocks.length); 1.21628 + } 1.21629 + return new this.setConstructor(); 1.21630 + }; 1.21631 + constructor.prototype.computeReversePostOrder = function computeReversePostOrder() { 1.21632 + if (this.order) { 1.21633 + return this.order; 1.21634 + } 1.21635 + var order = this.order = []; 1.21636 + this.depthFirstSearch(null, order.push.bind(order)); 1.21637 + order.reverse(); 1.21638 + for (var i = 0; i < order.length; i++) { 1.21639 + order[i].rpo = i; 1.21640 + } 1.21641 + return order; 1.21642 + }; 1.21643 + constructor.prototype.depthFirstSearch = function depthFirstSearch(preFn, postFn) { 1.21644 + var visited = this.createBlockSet(); 1.21645 + function visit(node) { 1.21646 + visited.set(node.id); 1.21647 + if (preFn) 1.21648 + preFn(node); 1.21649 + var successors = node.successors; 1.21650 + for (var i = 0, j = successors.length; i < j; i++) { 1.21651 + var s = successors[i]; 1.21652 + if (!visited.get(s.id)) { 1.21653 + visit(s); 1.21654 + } 1.21655 + } 1.21656 + if (postFn) 1.21657 + postFn(node); 1.21658 + } 1.21659 + visit(this.root); 1.21660 + }; 1.21661 + constructor.prototype.computeDominators = function (apply) { 1.21662 + true; 1.21663 + var dom = new Int32Array(this.blocks.length); 1.21664 + for (var i = 0; i < dom.length; i++) { 1.21665 + dom[i] = -1; 1.21666 + } 1.21667 + var map = this.createBlockSet(); 1.21668 + function computeCommonDominator(a, b) { 1.21669 + map.clearAll(); 1.21670 + while (a >= 0) { 1.21671 + map.set(a); 1.21672 + a = dom[a]; 1.21673 + } 1.21674 + while (b >= 0 && !map.get(b)) { 1.21675 + b = dom[b]; 1.21676 + } 1.21677 + return b; 1.21678 + } 1.21679 + function computeDominator(blockID, parentID) { 1.21680 + if (dom[blockID] < 0) { 1.21681 + dom[blockID] = parentID; 1.21682 + } else { 1.21683 + dom[blockID] = computeCommonDominator(dom[blockID], parentID); 1.21684 + } 1.21685 + } 1.21686 + this.depthFirstSearch(function visit(block) { 1.21687 + var s = block.successors; 1.21688 + for (var i = 0, j = s.length; i < j; i++) { 1.21689 + computeDominator(s[i].id, block.id); 1.21690 + } 1.21691 + }); 1.21692 + if (apply) { 1.21693 + for (var i = 0, j = this.blocks.length; i < j; i++) { 1.21694 + this.blocks[i].dominator = this.blocks[dom[i]]; 1.21695 + } 1.21696 + function computeDominatorDepth(block) { 1.21697 + var dominatorDepth; 1.21698 + if (block.dominatorDepth !== undefined) { 1.21699 + return block.dominatorDepth; 1.21700 + } else if (!block.dominator) { 1.21701 + dominatorDepth = 0; 1.21702 + } else { 1.21703 + dominatorDepth = computeDominatorDepth(block.dominator) + 1; 1.21704 + } 1.21705 + return block.dominatorDepth = dominatorDepth; 1.21706 + } 1.21707 + for (var i = 0, j = this.blocks.length; i < j; i++) { 1.21708 + computeDominatorDepth(this.blocks[i]); 1.21709 + } 1.21710 + } 1.21711 + return dom; 1.21712 + }; 1.21713 + constructor.prototype.computeLoops = function computeLoops() { 1.21714 + var active = this.createBlockSet(); 1.21715 + var visited = this.createBlockSet(); 1.21716 + var nextLoop = 0; 1.21717 + function makeLoopHeader(block) { 1.21718 + if (!block.isLoopHeader) { 1.21719 + block.isLoopHeader = true; 1.21720 + block.loops = 1 << nextLoop; 1.21721 + nextLoop += 1; 1.21722 + } 1.21723 + } 1.21724 + function visit(block) { 1.21725 + if (visited.get(block.id)) { 1.21726 + if (active.get(block.id)) { 1.21727 + makeLoopHeader(block); 1.21728 + } 1.21729 + return block.loops; 1.21730 + } 1.21731 + visited.set(block.id); 1.21732 + active.set(block.id); 1.21733 + var loops = 0; 1.21734 + for (var i = 0, j = block.successors.length; i < j; i++) { 1.21735 + loops |= visit(block.successors[i]); 1.21736 + } 1.21737 + if (block.isLoopHeader) { 1.21738 + loops &= ~block.loops; 1.21739 + } 1.21740 + block.loops = loops; 1.21741 + active.clear(block.id); 1.21742 + return loops; 1.21743 + } 1.21744 + var loop = visit(this.root); 1.21745 + }; 1.21746 + function followProjection(node) { 1.21747 + return node instanceof Projection ? node.project() : node; 1.21748 + } 1.21749 + var Uses = function () { 1.21750 + function constructor() { 1.21751 + this.entries = []; 1.21752 + } 1.21753 + constructor.prototype.addUse = function addUse(def, use) { 1.21754 + var entry = this.entries[def.id]; 1.21755 + if (!entry) { 1.21756 + entry = this.entries[def.id] = { 1.21757 + def: def, 1.21758 + uses: [] 1.21759 + }; 1.21760 + } 1.21761 + entry.uses.pushUnique(use); 1.21762 + }; 1.21763 + constructor.prototype.trace = function (writer) { 1.21764 + writer.enter('> Uses'); 1.21765 + this.entries.forEach(function (entry) { 1.21766 + writer.writeLn(entry.def.id + ' -> [' + entry.uses.map(toID).join(', ') + '] ' + entry.def); 1.21767 + }); 1.21768 + writer.leave('<'); 1.21769 + }; 1.21770 + constructor.prototype.replace = function (def, value) { 1.21771 + var entry = this.entries[def.id]; 1.21772 + if (entry.uses.length === 0) { 1.21773 + return false; 1.21774 + } 1.21775 + var count = 0; 1.21776 + entry.uses.forEach(function (use) { 1.21777 + count += use.replaceInput(def, value); 1.21778 + }); 1.21779 + true; 1.21780 + entry.uses = []; 1.21781 + return true; 1.21782 + }; 1.21783 + function updateUses(def, value) { 1.21784 + debug && writer.writeLn('Update ' + def + ' with ' + value); 1.21785 + var entry = useEntries[def.id]; 1.21786 + if (entry.uses.length === 0) { 1.21787 + return false; 1.21788 + } 1.21789 + debug && writer.writeLn('Replacing: ' + def.id + ' in [' + entry.uses.map(toID).join(', ') + '] with ' + value.id); 1.21790 + var count = 0; 1.21791 + entry.uses.forEach(function (use) { 1.21792 + count += use.replaceInput(def, value); 1.21793 + }); 1.21794 + true; 1.21795 + entry.uses = []; 1.21796 + return true; 1.21797 + } 1.21798 + return constructor; 1.21799 + }(); 1.21800 + constructor.prototype.computeUses = function computeUses() { 1.21801 + Timer.start('computeUses'); 1.21802 + var writer = debug && new IndentingWriter(); 1.21803 + debug && writer.enter('> Compute Uses'); 1.21804 + var dfg = this.dfg; 1.21805 + var uses = new Uses(); 1.21806 + dfg.forEachInPreOrderDepthFirstSearch(function (use) { 1.21807 + use.visitInputs(function (def) { 1.21808 + uses.addUse(def, use); 1.21809 + }); 1.21810 + }); 1.21811 + if (debug) { 1.21812 + writer.enter('> Uses'); 1.21813 + uses.entries.forEach(function (entry) { 1.21814 + writer.writeLn(entry.def.id + ' -> [' + entry.uses.map(toID).join(', ') + '] ' + entry.def); 1.21815 + }); 1.21816 + writer.leave('<'); 1.21817 + writer.leave('<'); 1.21818 + } 1.21819 + Timer.stop(); 1.21820 + return uses; 1.21821 + }; 1.21822 + constructor.prototype.verify = function verify() { 1.21823 + var writer = debug && new IndentingWriter(); 1.21824 + debug && writer.enter('> Verify'); 1.21825 + var order = this.computeReversePostOrder(); 1.21826 + order.forEach(function (block) { 1.21827 + if (block.phis) { 1.21828 + block.phis.forEach(function (phi) { 1.21829 + true; 1.21830 + true; 1.21831 + }); 1.21832 + } 1.21833 + }); 1.21834 + debug && writer.leave('<'); 1.21835 + }; 1.21836 + constructor.prototype.optimizePhis = function optimizePhis() { 1.21837 + var writer = debug && new IndentingWriter(); 1.21838 + debug && writer.enter('> Optimize Phis'); 1.21839 + var phis = []; 1.21840 + var useEntries = this.computeUses().entries; 1.21841 + useEntries.forEach(function (entry) { 1.21842 + if (isPhi(entry.def)) { 1.21843 + phis.push(entry.def); 1.21844 + } 1.21845 + }); 1.21846 + debug && writer.writeLn('Trying to optimize ' + phis.length + ' phis.'); 1.21847 + function updateUses(def, value) { 1.21848 + debug && writer.writeLn('Update ' + def + ' with ' + value); 1.21849 + var entry = useEntries[def.id]; 1.21850 + if (entry.uses.length === 0) { 1.21851 + return false; 1.21852 + } 1.21853 + debug && writer.writeLn('Replacing: ' + def.id + ' in [' + entry.uses.map(toID).join(', ') + '] with ' + value.id); 1.21854 + var count = 0; 1.21855 + var entryUses = entry.uses; 1.21856 + for (var i = 0, j = entryUses.length; i < j; i++) { 1.21857 + count += entryUses[i].replaceInput(def, value); 1.21858 + } 1.21859 + true; 1.21860 + entry.uses = []; 1.21861 + return true; 1.21862 + } 1.21863 + function simplify(phi, args) { 1.21864 + args = args.unique(); 1.21865 + if (args.length === 1) { 1.21866 + return args[0]; 1.21867 + } else { 1.21868 + if (args.length === 2) { 1.21869 + if (args[0] === phi) { 1.21870 + return args[1]; 1.21871 + } else if (args[1] === phi) { 1.21872 + return args[0]; 1.21873 + } 1.21874 + return phi; 1.21875 + } 1.21876 + } 1.21877 + return phi; 1.21878 + } 1.21879 + var count = 0; 1.21880 + var iterations = 0; 1.21881 + var changed = true; 1.21882 + while (changed) { 1.21883 + iterations++; 1.21884 + changed = false; 1.21885 + phis.forEach(function (phi) { 1.21886 + var value = simplify(phi, phi.args); 1.21887 + if (value !== phi) { 1.21888 + if (updateUses(phi, value)) { 1.21889 + changed = true; 1.21890 + count++; 1.21891 + } 1.21892 + } 1.21893 + }); 1.21894 + } 1.21895 + if (debug) { 1.21896 + writer.writeLn('Simplified ' + count + ' phis, in ' + iterations + ' iterations.'); 1.21897 + writer.leave('<'); 1.21898 + } 1.21899 + }; 1.21900 + constructor.prototype.splitCriticalEdges = function splitCriticalEdges() { 1.21901 + var writer = debug && new IndentingWriter(); 1.21902 + var blocks = this.blocks; 1.21903 + var criticalEdges = []; 1.21904 + debug && writer.enter('> Splitting Critical Edges'); 1.21905 + for (var i = 0; i < blocks.length; i++) { 1.21906 + var successors = blocks[i].successors; 1.21907 + if (successors.length > 1) { 1.21908 + for (var j = 0; j < successors.length; j++) { 1.21909 + if (successors[j].predecessors.length > 1) { 1.21910 + criticalEdges.push({ 1.21911 + from: blocks[i], 1.21912 + to: successors[j] 1.21913 + }); 1.21914 + } 1.21915 + } 1.21916 + } 1.21917 + } 1.21918 + var criticalEdgeCount = criticalEdges.length; 1.21919 + if (criticalEdgeCount && debug) { 1.21920 + writer.writeLn('Splitting: ' + criticalEdgeCount); 1.21921 + this.trace(writer); 1.21922 + } 1.21923 + var edge; 1.21924 + while (edge = criticalEdges.pop()) { 1.21925 + var fromIndex = edge.from.successors.indexOf(edge.to); 1.21926 + var toIndex = edge.to.predecessors.indexOf(edge.from); 1.21927 + true; 1.21928 + debug && writer.writeLn('Splitting critical edge: ' + edge.from + ' -> ' + edge.to); 1.21929 + var toBlock = edge.to; 1.21930 + var toRegion = toBlock.region; 1.21931 + var control = toRegion.predecessors[toIndex]; 1.21932 + var region = new Region(control); 1.21933 + var jump = new Jump(region); 1.21934 + var block = this.buildBlock(region, jump); 1.21935 + toRegion.predecessors[toIndex] = new Projection(jump, Projection.Type.TRUE); 1.21936 + var fromBlock = edge.from; 1.21937 + fromBlock.successors[fromIndex] = block; 1.21938 + block.pushPredecessor(fromBlock); 1.21939 + block.pushSuccessor(toBlock); 1.21940 + toBlock.predecessors[toIndex] = block; 1.21941 + } 1.21942 + if (criticalEdgeCount && debug) { 1.21943 + this.trace(writer); 1.21944 + } 1.21945 + if (criticalEdgeCount && !true) { 1.21946 + true; 1.21947 + } 1.21948 + debug && writer.leave('<'); 1.21949 + return criticalEdgeCount; 1.21950 + }; 1.21951 + constructor.prototype.allocateVariables = function allocateVariables() { 1.21952 + var writer = debug && new IndentingWriter(); 1.21953 + debug && writer.enter('> Allocating Virtual Registers'); 1.21954 + var order = this.computeReversePostOrder(); 1.21955 + function allocate(node) { 1.21956 + if (isProjection(node, Projection.Type.STORE)) { 1.21957 + return; 1.21958 + } 1.21959 + if (node instanceof SetProperty) { 1.21960 + return; 1.21961 + } 1.21962 + if (node instanceof Value) { 1.21963 + node.variable = new Variable('v' + node.id); 1.21964 + debug && writer.writeLn('Allocated: ' + node.variable + ' to ' + node); 1.21965 + } 1.21966 + } 1.21967 + order.forEach(function (block) { 1.21968 + block.nodes.forEach(allocate); 1.21969 + if (block.phis) { 1.21970 + block.phis.forEach(allocate); 1.21971 + } 1.21972 + }); 1.21973 + var blockMoves = []; 1.21974 + for (var i = 0; i < order.length; i++) { 1.21975 + var block = order[i]; 1.21976 + var phis = block.phis; 1.21977 + var predecessors = block.predecessors; 1.21978 + if (phis) { 1.21979 + for (var j = 0; j < phis.length; j++) { 1.21980 + var phi = phis[j]; 1.21981 + debug && writer.writeLn('Emitting moves for: ' + phi); 1.21982 + var arguments = phi.args; 1.21983 + true; 1.21984 + for (var k = 0; k < predecessors.length; k++) { 1.21985 + var predecessor = predecessors[k]; 1.21986 + var argument = arguments[k]; 1.21987 + if (argument.abstract || isProjection(argument, Projection.Type.STORE)) { 1.21988 + continue; 1.21989 + } 1.21990 + var moves = blockMoves[predecessor.id] || (blockMoves[predecessor.id] = []); 1.21991 + argument = argument.variable || argument; 1.21992 + if (phi.variable !== argument) { 1.21993 + moves.push(new Move(phi.variable, argument)); 1.21994 + } 1.21995 + } 1.21996 + } 1.21997 + } 1.21998 + } 1.21999 + var blocks = this.blocks; 1.22000 + blockMoves.forEach(function (moves, blockID) { 1.22001 + var block = blocks[blockID]; 1.22002 + var temporary = 0; 1.22003 + debug && writer.writeLn(block + ' Moves: ' + moves); 1.22004 + while (moves.length) { 1.22005 + for (var i = 0; i < moves.length; i++) { 1.22006 + var move = moves[i]; 1.22007 + for (var j = 0; j < moves.length; j++) { 1.22008 + if (i === j) { 1.22009 + continue; 1.22010 + } 1.22011 + if (moves[j].from === move.to) { 1.22012 + move = null; 1.22013 + break; 1.22014 + } 1.22015 + } 1.22016 + if (move) { 1.22017 + moves.splice(i--, 1); 1.22018 + block.append(move); 1.22019 + } 1.22020 + } 1.22021 + if (moves.length) { 1.22022 + debug && writer.writeLn('Breaking Cycle'); 1.22023 + var move = moves[0]; 1.22024 + var temp = new Variable('t' + temporary++); 1.22025 + blocks[blockID].append(new Move(temp, move.to)); 1.22026 + for (var i = 1; i < moves.length; i++) { 1.22027 + if (moves[i].from === move.to) { 1.22028 + moves[i].from = temp; 1.22029 + } 1.22030 + } 1.22031 + } 1.22032 + } 1.22033 + }); 1.22034 + debug && writer.leave('<'); 1.22035 + }; 1.22036 + constructor.prototype.scheduleEarly = function scheduleEarly() { 1.22037 + var debugScheduler = false; 1.22038 + var writer = debugScheduler && new IndentingWriter(); 1.22039 + debugScheduler && writer.enter('> Schedule Early'); 1.22040 + var cfg = this; 1.22041 + var dfg = this.dfg; 1.22042 + var scheduled = []; 1.22043 + var roots = []; 1.22044 + dfg.forEachInPreOrderDepthFirstSearch(function (node) { 1.22045 + if (node instanceof Region || node instanceof Jump) { 1.22046 + return; 1.22047 + } 1.22048 + if (node.control) { 1.22049 + roots.push(node); 1.22050 + } 1.22051 + if (isPhi(node)) { 1.22052 + node.args.forEach(function (input) { 1.22053 + if (shouldFloat(input)) { 1.22054 + input.mustNotFloat = true; 1.22055 + } 1.22056 + }); 1.22057 + } 1.22058 + }, true); 1.22059 + if (debugScheduler) { 1.22060 + roots.forEach(function (node) { 1.22061 + print('Root: ' + node); 1.22062 + }); 1.22063 + } 1.22064 + for (var i = 0; i < roots.length; i++) { 1.22065 + var root = roots[i]; 1.22066 + if (root instanceof Phi) { 1.22067 + var block = root.control.block; 1.22068 + (block.phis || (block.phis = [])).push(root); 1.22069 + } 1.22070 + if (root.control) { 1.22071 + schedule(root); 1.22072 + } 1.22073 + } 1.22074 + function isScheduled(node) { 1.22075 + return scheduled[node.id]; 1.22076 + } 1.22077 + function shouldFloat(node) { 1.22078 + if (node.mustNotFloat || node.shouldNotFloat) { 1.22079 + return false; 1.22080 + } 1.22081 + if (node.mustFloat || node.shouldFloat) { 1.22082 + return true; 1.22083 + } 1.22084 + if (node instanceof Parameter || node instanceof This || node instanceof Arguments) { 1.22085 + return true; 1.22086 + } 1.22087 + return node instanceof Binary || node instanceof Unary || node instanceof Parameter; 1.22088 + } 1.22089 + function append(node) { 1.22090 + true; 1.22091 + scheduled[node.id] = true; 1.22092 + true; 1.22093 + if (shouldFloat(node)) { 1.22094 + } else { 1.22095 + node.control.block.append(node); 1.22096 + } 1.22097 + } 1.22098 + function scheduleIn(node, region) { 1.22099 + true; 1.22100 + true; 1.22101 + true; 1.22102 + debugScheduler && writer.writeLn('Scheduled: ' + node + ' in ' + region); 1.22103 + node.control = region; 1.22104 + append(node); 1.22105 + } 1.22106 + function schedule(node) { 1.22107 + debugScheduler && writer.enter('> Schedule: ' + node); 1.22108 + var inputs = []; 1.22109 + node.visitInputs(function (input) { 1.22110 + if (isConstant(input)) { 1.22111 + { 1.22112 + return; 1.22113 + } 1.22114 + } 1.22115 + if (isValue(input)) { 1.22116 + inputs.push(followProjection(input)); 1.22117 + } 1.22118 + }); 1.22119 + debugScheduler && writer.writeLn('Inputs: [' + inputs.map(toID) + '], length: ' + inputs.length); 1.22120 + for (var i = 0; i < inputs.length; i++) { 1.22121 + var input = inputs[i]; 1.22122 + if (isNotPhi(input) && !isScheduled(input)) { 1.22123 + schedule(input); 1.22124 + } 1.22125 + } 1.22126 + if (node.control) { 1.22127 + if (node instanceof End || node instanceof Phi || node instanceof Start || isScheduled(node)) { 1.22128 + } else { 1.22129 + append(node); 1.22130 + } 1.22131 + } else { 1.22132 + if (inputs.length) { 1.22133 + var x = inputs[0].control; 1.22134 + for (var i = 1; i < inputs.length; i++) { 1.22135 + var y = inputs[i].control; 1.22136 + if (x.block.dominatorDepth < y.block.dominatorDepth) { 1.22137 + x = y; 1.22138 + } 1.22139 + } 1.22140 + scheduleIn(node, x); 1.22141 + } else { 1.22142 + scheduleIn(node, cfg.root.region); 1.22143 + } 1.22144 + } 1.22145 + debugScheduler && writer.leave('<'); 1.22146 + } 1.22147 + debugScheduler && writer.leave('<'); 1.22148 + roots.forEach(function (node) { 1.22149 + node = followProjection(node); 1.22150 + if (node === dfg.start || node instanceof Region) { 1.22151 + return; 1.22152 + } 1.22153 + true; 1.22154 + }); 1.22155 + }; 1.22156 + constructor.prototype.trace = function (writer) { 1.22157 + var visited = []; 1.22158 + var blocks = []; 1.22159 + function next(block) { 1.22160 + if (!visited[block.id]) { 1.22161 + visited[block.id] = true; 1.22162 + blocks.push(block); 1.22163 + block.visitSuccessors(next); 1.22164 + } 1.22165 + } 1.22166 + var root = this.root; 1.22167 + var exit = this.exit; 1.22168 + next(root); 1.22169 + function colorOf(block) { 1.22170 + return 'black'; 1.22171 + } 1.22172 + function styleOf(block) { 1.22173 + return 'filled'; 1.22174 + } 1.22175 + function shapeOf(block) { 1.22176 + true; 1.22177 + if (block === root) { 1.22178 + return 'house'; 1.22179 + } else if (block === exit) { 1.22180 + return 'invhouse'; 1.22181 + } 1.22182 + return 'box'; 1.22183 + } 1.22184 + writer.writeLn(''); 1.22185 + writer.enter('digraph CFG {'); 1.22186 + writer.writeLn('graph [bgcolor = gray10];'); 1.22187 + writer.writeLn('edge [fontname = Consolas, fontsize = 11, color = white, fontcolor = white];'); 1.22188 + writer.writeLn('node [shape = box, fontname = Consolas, fontsize = 11, color = white, fontcolor = white, style = filled];'); 1.22189 + writer.writeLn('rankdir = TB;'); 1.22190 + blocks.forEach(function (block) { 1.22191 + var loopInfo = ''; 1.22192 + var blockInfo = ''; 1.22193 + var intervalInfo = ''; 1.22194 + if (block.loops !== undefined) { 1.22195 + } 1.22196 + if (block.name !== undefined) { 1.22197 + blockInfo += ' ' + block.name; 1.22198 + } 1.22199 + if (block.rpo !== undefined) { 1.22200 + blockInfo += ' O: ' + block.rpo; 1.22201 + } 1.22202 + writer.writeLn('B' + block.id + ' [label = "B' + block.id + blockInfo + loopInfo + '", fillcolor = "' + colorOf(block) + '", shape=' + shapeOf(block) + ', style=' + styleOf(block) + '];'); 1.22203 + }); 1.22204 + blocks.forEach(function (block) { 1.22205 + block.visitSuccessors(function (successor) { 1.22206 + writer.writeLn('B' + block.id + ' -> ' + 'B' + successor.id); 1.22207 + }); 1.22208 + if (block.dominator) { 1.22209 + writer.writeLn('B' + block.id + ' -> ' + 'B' + block.dominator.id + ' [color = orange];'); 1.22210 + } 1.22211 + if (block.follow) { 1.22212 + writer.writeLn('B' + block.id + ' -> ' + 'B' + block.follow.id + ' [color = purple];'); 1.22213 + } 1.22214 + }); 1.22215 + writer.leave('}'); 1.22216 + writer.writeLn(''); 1.22217 + }; 1.22218 + return constructor; 1.22219 + }(); 1.22220 + var PeepholeOptimizer = function () { 1.22221 + function constructor() { 1.22222 + } 1.22223 + function foldUnary(node, truthy) { 1.22224 + true; 1.22225 + if (isConstant(node.argument)) { 1.22226 + return new Constant(node.operator.evaluate(node.argument.value)); 1.22227 + } 1.22228 + if (truthy) { 1.22229 + var argument = fold(node.argument, true); 1.22230 + if (node.operator === Operator.TRUE) { 1.22231 + return argument; 1.22232 + } 1.22233 + if (argument instanceof Unary) { 1.22234 + if (node.operator === Operator.FALSE && argument.operator === Operator.FALSE) { 1.22235 + return argument.argument; 1.22236 + } 1.22237 + } else { 1.22238 + return new Unary(node.operator, argument); 1.22239 + } 1.22240 + } 1.22241 + return node; 1.22242 + } 1.22243 + function foldBinary(node, truthy) { 1.22244 + true; 1.22245 + if (isConstant(node.left) && isConstant(node.right)) { 1.22246 + return new Constant(node.operator.evaluate(node.left.value, node.right.value)); 1.22247 + } 1.22248 + return node; 1.22249 + } 1.22250 + function fold(node, truthy) { 1.22251 + if (node instanceof Unary) { 1.22252 + return foldUnary(node, truthy); 1.22253 + } else if (node instanceof Binary) { 1.22254 + return foldBinary(node, truthy); 1.22255 + } 1.22256 + return node; 1.22257 + } 1.22258 + constructor.prototype.tryFold = fold; 1.22259 + return constructor; 1.22260 + }(); 1.22261 + exports.isConstant = isConstant; 1.22262 + exports.Block = Block; 1.22263 + exports.Node = Node; 1.22264 + exports.Start = Start; 1.22265 + exports.Null = Null; 1.22266 + exports.Undefined = Undefined; 1.22267 + exports.This = This; 1.22268 + exports.Throw = Throw; 1.22269 + exports.Arguments = Arguments; 1.22270 + exports.ASGlobal = ASGlobal; 1.22271 + exports.Projection = Projection; 1.22272 + exports.Region = Region; 1.22273 + exports.Latch = Latch; 1.22274 + exports.Binary = Binary; 1.22275 + exports.Unary = Unary; 1.22276 + exports.Constant = Constant; 1.22277 + exports.ASFindProperty = ASFindProperty; 1.22278 + exports.GlobalProperty = GlobalProperty; 1.22279 + exports.GetProperty = GetProperty; 1.22280 + exports.SetProperty = SetProperty; 1.22281 + exports.CallProperty = CallProperty; 1.22282 + exports.ASCallProperty = ASCallProperty; 1.22283 + exports.ASCallSuper = ASCallSuper; 1.22284 + exports.ASGetProperty = ASGetProperty; 1.22285 + exports.ASGetSuper = ASGetSuper; 1.22286 + exports.ASHasProperty = ASHasProperty; 1.22287 + exports.ASDeleteProperty = ASDeleteProperty; 1.22288 + exports.ASGetDescendants = ASGetDescendants; 1.22289 + exports.ASSetProperty = ASSetProperty; 1.22290 + exports.ASSetSuper = ASSetSuper; 1.22291 + exports.ASGetSlot = ASGetSlot; 1.22292 + exports.ASSetSlot = ASSetSlot; 1.22293 + exports.Call = Call; 1.22294 + exports.ASNew = ASNew; 1.22295 + exports.Phi = Phi; 1.22296 + exports.Stop = Stop; 1.22297 + exports.If = If; 1.22298 + exports.Switch = Switch; 1.22299 + exports.End = End; 1.22300 + exports.Jump = Jump; 1.22301 + exports.ASScope = ASScope; 1.22302 + exports.Operator = Operator; 1.22303 + exports.Variable = Variable; 1.22304 + exports.Move = Move; 1.22305 + exports.Copy = Copy; 1.22306 + exports.Parameter = Parameter; 1.22307 + exports.NewArray = NewArray; 1.22308 + exports.NewObject = NewObject; 1.22309 + exports.ASNewActivation = ASNewActivation; 1.22310 + exports.KeyValuePair = KeyValuePair; 1.22311 + exports.ASMultiname = ASMultiname; 1.22312 + exports.DFG = DFG; 1.22313 + exports.CFG = CFG; 1.22314 + exports.Flags = Flags; 1.22315 + exports.PeepholeOptimizer = PeepholeOptimizer; 1.22316 +}(typeof exports === 'undefined' ? IR = {} : exports)); 1.22317 +var c4Options = systemOptions.register(new OptionSet('C4 Options')); 1.22318 +var enableC4 = c4Options.register(new Option('c4', 'c4', 'boolean', false, 'Enable the C4 compiler.')); 1.22319 +var c4TraceLevel = c4Options.register(new Option('tc4', 'tc4', 'number', 0, 'Compiler Trace Level')); 1.22320 +var enableRegisterAllocator = c4Options.register(new Option('ra', 'ra', 'boolean', false, 'Enable register allocator.')); 1.22321 +var getPublicQualifiedName = Multiname.getPublicQualifiedName; 1.22322 +var createName = function createName(namespaces, name) { 1.22323 + if (isNumeric(name) || isObject(name)) { 1.22324 + return name; 1.22325 + } 1.22326 + return new Multiname(namespaces, name); 1.22327 +}; 1.22328 +(function (exports) { 1.22329 + var Node = IR.Node; 1.22330 + var Start = IR.Start; 1.22331 + var Null = IR.Null; 1.22332 + var Undefined = IR.Undefined; 1.22333 + var This = IR.This; 1.22334 + var Projection = IR.Projection; 1.22335 + var Region = IR.Region; 1.22336 + var Binary = IR.Binary; 1.22337 + var Unary = IR.Unary; 1.22338 + var Constant = IR.Constant; 1.22339 + var Call = IR.Call; 1.22340 + var Phi = IR.Phi; 1.22341 + var Stop = IR.Stop; 1.22342 + var Operator = IR.Operator; 1.22343 + var Parameter = IR.Parameter; 1.22344 + var NewArray = IR.NewArray; 1.22345 + var NewObject = IR.NewObject; 1.22346 + var KeyValuePair = IR.KeyValuePair; 1.22347 + var isConstant = IR.isConstant; 1.22348 + var DFG = IR.DFG; 1.22349 + var CFG = IR.CFG; 1.22350 + var writer = new IndentingWriter(); 1.22351 + var peepholeOptimizer = new IR.PeepholeOptimizer(); 1.22352 + var USE_TYPE_OF_DEFAULT_ARGUMENT_CHECKING = false; 1.22353 + var State = function () { 1.22354 + var nextID = 0; 1.22355 + function constructor(index) { 1.22356 + this.id = nextID += 1; 1.22357 + this.index = index; 1.22358 + this.local = []; 1.22359 + this.stack = []; 1.22360 + this.scope = []; 1.22361 + this.store = Undefined; 1.22362 + this.loads = []; 1.22363 + this.saved = Undefined; 1.22364 + } 1.22365 + constructor.prototype.clone = function clone(index) { 1.22366 + var s = new State(); 1.22367 + s.index = index !== undefined ? index : this.index; 1.22368 + s.local = this.local.slice(0); 1.22369 + s.stack = this.stack.slice(0); 1.22370 + s.scope = this.scope.slice(0); 1.22371 + s.loads = this.loads.slice(0); 1.22372 + s.saved = this.saved; 1.22373 + s.store = this.store; 1.22374 + return s; 1.22375 + }; 1.22376 + constructor.prototype.matches = function matches(other) { 1.22377 + return this.stack.length === other.stack.length && this.scope.length === other.scope.length && this.local.length === other.local.length; 1.22378 + }; 1.22379 + constructor.prototype.makeLoopPhis = function makeLoopPhis(control) { 1.22380 + var s = new State(); 1.22381 + true; 1.22382 + function makePhi(x) { 1.22383 + var phi = new Phi(control, x); 1.22384 + phi.isLoop = true; 1.22385 + return phi; 1.22386 + } 1.22387 + s.index = this.index; 1.22388 + s.local = this.local.map(makePhi); 1.22389 + s.stack = this.stack.map(makePhi); 1.22390 + s.scope = this.scope.map(makePhi); 1.22391 + s.loads = this.loads.slice(0); 1.22392 + s.saved = this.saved; 1.22393 + s.store = makePhi(this.store); 1.22394 + return s; 1.22395 + }; 1.22396 + constructor.prototype.optimize = function optimize() { 1.22397 + function optimize(x) { 1.22398 + if (x instanceof Phi && !x.isLoop) { 1.22399 + var args = x.args.unique(); 1.22400 + if (args.length === 1) { 1.22401 + x.seal(); 1.22402 + Counter.count('Builder: OptimizedPhi'); 1.22403 + return args[0]; 1.22404 + } 1.22405 + } 1.22406 + return x; 1.22407 + } 1.22408 + this.local = this.local.map(optimize); 1.22409 + this.stack = this.stack.map(optimize); 1.22410 + this.scope = this.scope.map(optimize); 1.22411 + this.saved = optimize(this.saved); 1.22412 + this.store = optimize(this.store); 1.22413 + }; 1.22414 + function mergeValue(control, a, b) { 1.22415 + var phi = a instanceof Phi && a.control === control ? a : new Phi(control, a); 1.22416 + phi.pushValue(b); 1.22417 + return phi; 1.22418 + } 1.22419 + function mergeValues(control, a, b) { 1.22420 + for (var i = 0; i < a.length; i++) { 1.22421 + a[i] = mergeValue(control, a[i], b[i]); 1.22422 + } 1.22423 + } 1.22424 + constructor.prototype.merge = function merge(control, other) { 1.22425 + true; 1.22426 + true; 1.22427 + mergeValues(control, this.local, other.local); 1.22428 + mergeValues(control, this.stack, other.stack); 1.22429 + mergeValues(control, this.scope, other.scope); 1.22430 + this.store = mergeValue(control, this.store, other.store); 1.22431 + this.store.abstract = true; 1.22432 + }; 1.22433 + constructor.prototype.trace = function trace(writer) { 1.22434 + writer.writeLn(this.toString()); 1.22435 + }; 1.22436 + function toBriefString(x) { 1.22437 + if (x instanceof Node) { 1.22438 + return x.toString(true); 1.22439 + } 1.22440 + return x; 1.22441 + } 1.22442 + constructor.prototype.toString = function () { 1.22443 + return '<' + String(this.id + ' @ ' + this.index).padRight(' ', 10) + (' M: ' + toBriefString(this.store)).padRight(' ', 14) + (' X: ' + toBriefString(this.saved)).padRight(' ', 14) + (' $: ' + this.scope.map(toBriefString).join(', ')).padRight(' ', 20) + (' L: ' + this.local.map(toBriefString).join(', ')).padRight(' ', 40) + (' S: ' + this.stack.map(toBriefString).join(', ')).padRight(' ', 60); 1.22444 + }; 1.22445 + return constructor; 1.22446 + }(); 1.22447 + function isNumericConstant(node) { 1.22448 + return node instanceof Constant && isNumeric(node.value); 1.22449 + } 1.22450 + function isStringConstant(node) { 1.22451 + return node instanceof Constant && isString(node.value); 1.22452 + } 1.22453 + function isMultinameConstant(node) { 1.22454 + return node instanceof Constant && node.value instanceof Multiname; 1.22455 + } 1.22456 + function hasNumericType(node) { 1.22457 + if (isNumericConstant(node)) { 1.22458 + return true; 1.22459 + } 1.22460 + return node.ty && node.ty.isNumeric(); 1.22461 + } 1.22462 + function typesAreEqual(a, b) { 1.22463 + if (hasNumericType(a) && hasNumericType(b) || hasStringType(a) && hasStringType(b)) { 1.22464 + return true; 1.22465 + } 1.22466 + return false; 1.22467 + } 1.22468 + function hasStringType(node) { 1.22469 + if (isStringConstant(node)) { 1.22470 + return true; 1.22471 + } 1.22472 + return node.ty && node.ty.isString(); 1.22473 + } 1.22474 + function constant(value) { 1.22475 + return new Constant(value); 1.22476 + } 1.22477 + function qualifiedNameConstant(name) { 1.22478 + return constant(Multiname.getQualifiedName(name)); 1.22479 + } 1.22480 + function getJSPropertyWithState(state, object, path) { 1.22481 + true; 1.22482 + var names = path.split('.'); 1.22483 + var node = object; 1.22484 + for (var i = 0; i < names.length; i++) { 1.22485 + node = new IR.GetProperty(null, state.store, node, constant(names[i])); 1.22486 + node.shouldFloat = true; 1.22487 + state.loads.push(node); 1.22488 + } 1.22489 + return node; 1.22490 + } 1.22491 + function globalProperty(name) { 1.22492 + var node = new IR.GlobalProperty(name); 1.22493 + node.mustFloat = true; 1.22494 + return node; 1.22495 + } 1.22496 + function warn(message) { 1.22497 + } 1.22498 + function unary(operator, argument) { 1.22499 + var node = new Unary(operator, argument); 1.22500 + if (peepholeOptimizer) { 1.22501 + node = peepholeOptimizer.tryFold(node); 1.22502 + } 1.22503 + return node; 1.22504 + } 1.22505 + function binary(operator, left, right) { 1.22506 + var node = new Binary(operator, left, right); 1.22507 + if (left.ty && left.ty !== Type.Any && left.ty === right.ty) { 1.22508 + if (operator === Operator.EQ) { 1.22509 + node.operator = Operator.SEQ; 1.22510 + } else if (operator === Operator.NE) { 1.22511 + node.operator = Operator.SNE; 1.22512 + } 1.22513 + } 1.22514 + if (peepholeOptimizer) { 1.22515 + node = peepholeOptimizer.tryFold(node); 1.22516 + } 1.22517 + return node; 1.22518 + } 1.22519 + function coerceInt(value) { 1.22520 + return binary(Operator.OR, value, constant(0)); 1.22521 + } 1.22522 + function coerceUint(value) { 1.22523 + return binary(Operator.URSH, value, constant(0)); 1.22524 + } 1.22525 + function coerceNumber(value) { 1.22526 + if (hasNumericType(value)) { 1.22527 + return value; 1.22528 + } 1.22529 + return unary(Operator.PLUS, value); 1.22530 + } 1.22531 + function coerceBoolean(value) { 1.22532 + return unary(Operator.FALSE, unary(Operator.FALSE, value)); 1.22533 + } 1.22534 + function shouldNotFloat(node) { 1.22535 + node.shouldNotFloat = true; 1.22536 + return node; 1.22537 + } 1.22538 + function shouldFloat(node) { 1.22539 + true; 1.22540 + node.shouldFloat = true; 1.22541 + return node; 1.22542 + } 1.22543 + function mustFloat(node) { 1.22544 + node.mustFloat = true; 1.22545 + return node; 1.22546 + } 1.22547 + function callPure(callee, object, args) { 1.22548 + return new Call(null, null, callee, object, args, IR.Flags.PRISTINE); 1.22549 + } 1.22550 + function callGlobalProperty(name, value) { 1.22551 + return callPure(globalProperty(name), null, [ 1.22552 + value 1.22553 + ]); 1.22554 + } 1.22555 + function convertString(value) { 1.22556 + if (isStringConstant(value)) { 1.22557 + return value; 1.22558 + } 1.22559 + return callPure(globalProperty('String'), null, [ 1.22560 + value 1.22561 + ]); 1.22562 + } 1.22563 + function coerceString(value) { 1.22564 + if (isStringConstant(value)) { 1.22565 + return value; 1.22566 + } 1.22567 + return callPure(globalProperty('asCoerceString'), null, [ 1.22568 + value 1.22569 + ]); 1.22570 + } 1.22571 + var coerceObject = callGlobalProperty.bind(null, 'asCoerceObject'); 1.22572 + var coercers = createEmptyObject(); 1.22573 + coercers[Multiname.Int] = coerceInt; 1.22574 + coercers[Multiname.Uint] = coerceUint; 1.22575 + coercers[Multiname.Number] = coerceNumber; 1.22576 + coercers[Multiname.String] = coerceString; 1.22577 + coercers[Multiname.Object] = coerceObject; 1.22578 + coercers[Multiname.Boolean] = coerceBoolean; 1.22579 + function getCoercerForType(multiname) { 1.22580 + true; 1.22581 + return coercers[Multiname.getQualifiedName(multiname)]; 1.22582 + } 1.22583 + var callableConstructors = createEmptyObject(); 1.22584 + callableConstructors[Multiname.Int] = coerceInt; 1.22585 + callableConstructors[Multiname.Uint] = coerceUint; 1.22586 + callableConstructors[Multiname.Number] = callGlobalProperty.bind(null, 'Number'); 1.22587 + callableConstructors[Multiname.String] = callGlobalProperty.bind(null, 'String'); 1.22588 + callableConstructors[Multiname.Object] = callGlobalProperty.bind(null, 'Object'); 1.22589 + callableConstructors[Multiname.Boolean] = callGlobalProperty.bind(null, 'Boolean'); 1.22590 + function getCallableConstructorForType(multiname) { 1.22591 + true; 1.22592 + return callableConstructors[Multiname.getQualifiedName(multiname)]; 1.22593 + } 1.22594 + var Builder = function () { 1.22595 + function builder(methodInfo, scope, hasDynamicScope) { 1.22596 + true; 1.22597 + this.abc = methodInfo.abc; 1.22598 + this.scope = scope; 1.22599 + this.methodInfo = methodInfo; 1.22600 + this.hasDynamicScope = hasDynamicScope; 1.22601 + } 1.22602 + builder.prototype.buildStart = function (start) { 1.22603 + var mi = this.methodInfo; 1.22604 + var state = start.entryState = new State(0); 1.22605 + state.local.push(new This(start)); 1.22606 + var parameterIndexOffset = this.hasDynamicScope ? 1 : 0; 1.22607 + var parameterCount = mi.parameters.length; 1.22608 + for (var i = 0; i < parameterCount; i++) { 1.22609 + state.local.push(new Parameter(start, parameterIndexOffset + i, mi.parameters[i].name)); 1.22610 + } 1.22611 + for (var i = parameterCount; i < mi.localCount; i++) { 1.22612 + state.local.push(Undefined); 1.22613 + } 1.22614 + state.store = new Projection(start, Projection.Type.STORE); 1.22615 + if (this.hasDynamicScope) { 1.22616 + start.scope = new Parameter(start, 0, SAVED_SCOPE_NAME); 1.22617 + } else { 1.22618 + start.scope = new Constant(this.scope); 1.22619 + } 1.22620 + state.saved = new Projection(start, Projection.Type.SCOPE); 1.22621 + start.domain = new Constant(this.domain); 1.22622 + var args = new IR.Arguments(start); 1.22623 + if (mi.needsRest() || mi.needsArguments()) { 1.22624 + var offset = constant(parameterIndexOffset + (mi.needsRest() ? parameterCount : 0)); 1.22625 + state.local[parameterCount + 1] = new Call(start, state.store, globalProperty('sliceArguments'), null, [ 1.22626 + args, 1.22627 + offset 1.22628 + ], IR.Flags.PRISTINE); 1.22629 + } 1.22630 + var argumentsLength = getJSPropertyWithState(state, args, 'length'); 1.22631 + for (var i = 0; i < parameterCount; i++) { 1.22632 + var parameter = mi.parameters[i]; 1.22633 + var index = i + 1; 1.22634 + var local = state.local[index]; 1.22635 + if (parameter.value !== undefined) { 1.22636 + var condition; 1.22637 + if (USE_TYPE_OF_DEFAULT_ARGUMENT_CHECKING) { 1.22638 + condition = new IR.Binary(Operator.SEQ, new IR.Unary(Operator.TYPE_OF, local), constant('undefined')); 1.22639 + } else { 1.22640 + condition = new IR.Binary(Operator.LT, argumentsLength, constant(parameterIndexOffset + i + 1)); 1.22641 + } 1.22642 + local = new IR.Latch(null, condition, constant(parameter.value), local); 1.22643 + } 1.22644 + if (parameter.type && !parameter.type.isAnyName()) { 1.22645 + var coercer = getCoercerForType(parameter.type); 1.22646 + if (coercer) { 1.22647 + local = coercer(local); 1.22648 + } else if (c4CoerceNonPrimitiveParameters) { 1.22649 + local = new Call(start, state.store, globalProperty('asCoerceByMultiname'), null, [ 1.22650 + constant(this.abc.applicationDomain), 1.22651 + constant(parameter.type), 1.22652 + local 1.22653 + ], true); 1.22654 + } 1.22655 + } 1.22656 + state.local[index] = local; 1.22657 + } 1.22658 + return start; 1.22659 + }; 1.22660 + builder.prototype.buildGraph = function buildGraph(callerRegion, callerState, inlineArguments) { 1.22661 + var analysis = this.methodInfo.analysis; 1.22662 + var blocks = analysis.blocks; 1.22663 + var bytecodes = analysis.bytecodes; 1.22664 + var methodInfo = this.methodInfo; 1.22665 + var ints = this.abc.constantPool.ints; 1.22666 + var uints = this.abc.constantPool.uints; 1.22667 + var doubles = this.abc.constantPool.doubles; 1.22668 + var strings = this.abc.constantPool.strings; 1.22669 + var methods = this.abc.methods; 1.22670 + var classes = this.abc.classes; 1.22671 + var multinames = this.abc.constantPool.multinames; 1.22672 + var domain = new Constant(this.abc.applicationDomain); 1.22673 + var traceBuilder = c4TraceLevel.value > 2; 1.22674 + var stopPoints = []; 1.22675 + for (var i = 0; i < blocks.length; i++) { 1.22676 + blocks[i].blockDominatorOrder = i; 1.22677 + } 1.22678 + var worklist = new Shumway.SortedList(function compare(a, b) { 1.22679 + return a.block.blockDominatorOrder - b.block.blockDominatorOrder; 1.22680 + }); 1.22681 + var start = new Start(null); 1.22682 + this.buildStart(start); 1.22683 + var createFunctionCallee = globalProperty('createFunction'); 1.22684 + worklist.push({ 1.22685 + region: start, 1.22686 + block: blocks[0] 1.22687 + }); 1.22688 + var next; 1.22689 + while (next = worklist.pop()) { 1.22690 + buildBlock(next.region, next.block, next.region.entryState.clone()).forEach(function (stop) { 1.22691 + var target = stop.target; 1.22692 + var region = target.region; 1.22693 + if (region) { 1.22694 + traceBuilder && writer.enter('Merging into region: ' + region + ' @ ' + target.position + ', block ' + target.bid + ' {'); 1.22695 + traceBuilder && writer.writeLn(' R ' + region.entryState); 1.22696 + traceBuilder && writer.writeLn('+ I ' + stop.state); 1.22697 + region.entryState.merge(region, stop.state); 1.22698 + region.predecessors.push(stop.control); 1.22699 + traceBuilder && writer.writeLn(' = ' + region.entryState); 1.22700 + traceBuilder && writer.leave('}'); 1.22701 + } else { 1.22702 + region = target.region = new Region(stop.control); 1.22703 + if (target.loop) { 1.22704 + traceBuilder && writer.writeLn('Adding PHIs to loop region.'); 1.22705 + } 1.22706 + region.entryState = target.loop ? stop.state.makeLoopPhis(region) : stop.state.clone(target.position); 1.22707 + traceBuilder && writer.writeLn('Adding new region: ' + region + ' @ ' + target.position + ' to worklist.'); 1.22708 + worklist.push({ 1.22709 + region: region, 1.22710 + block: target 1.22711 + }); 1.22712 + } 1.22713 + }); 1.22714 + traceBuilder && writer.enter('Worklist: {'); 1.22715 + worklist.forEach(function (item) { 1.22716 + traceBuilder && writer.writeLn(item.region + ' ' + item.block.bdo + ' ' + item.region.entryState); 1.22717 + }); 1.22718 + traceBuilder && writer.leave('}'); 1.22719 + } 1.22720 + traceBuilder && writer.writeLn('Done'); 1.22721 + function buildBlock(region, block, state) { 1.22722 + true; 1.22723 + state.optimize(); 1.22724 + var typeState = block.entryState; 1.22725 + if (typeState) { 1.22726 + traceBuilder && writer.writeLn('Type State: ' + typeState); 1.22727 + for (var i = 0; i < typeState.local.length; i++) { 1.22728 + var type = typeState.local[i]; 1.22729 + var local = state.local[i]; 1.22730 + if (local.ty) { 1.22731 + } else { 1.22732 + local.ty = type; 1.22733 + } 1.22734 + } 1.22735 + } 1.22736 + var local = state.local; 1.22737 + var stack = state.stack; 1.22738 + var scope = state.scope; 1.22739 + function savedScope() { 1.22740 + return state.saved; 1.22741 + } 1.22742 + function topScope(depth) { 1.22743 + if (depth !== undefined) { 1.22744 + if (depth < scope.length) { 1.22745 + return scope[scope.length - 1 - depth]; 1.22746 + } else if (depth === scope.length) { 1.22747 + return savedScope(); 1.22748 + } else { 1.22749 + var s = savedScope(); 1.22750 + var savedScopeDepth = depth - scope.length; 1.22751 + for (var i = 0; i < savedScopeDepth; i++) { 1.22752 + s = getJSProperty(s, 'parent'); 1.22753 + } 1.22754 + return s; 1.22755 + } 1.22756 + } 1.22757 + if (scope.length > 0) { 1.22758 + return scope.top(); 1.22759 + } 1.22760 + return savedScope(); 1.22761 + } 1.22762 + var object, receiver, index, callee, value, multiname, type, args, pristine, left, right, operator; 1.22763 + function push(x) { 1.22764 + true; 1.22765 + if (bc.ti) { 1.22766 + if (x.ty) { 1.22767 + } else { 1.22768 + x.ty = bc.ti.type; 1.22769 + } 1.22770 + } 1.22771 + stack.push(x); 1.22772 + } 1.22773 + function pop() { 1.22774 + return stack.pop(); 1.22775 + } 1.22776 + function popMany(count) { 1.22777 + return stack.popMany(count); 1.22778 + } 1.22779 + function pushLocal(index) { 1.22780 + push(local[index]); 1.22781 + } 1.22782 + function popLocal(index) { 1.22783 + local[index] = shouldNotFloat(pop()); 1.22784 + } 1.22785 + function buildMultiname(index) { 1.22786 + var multiname = multinames[index]; 1.22787 + var namespaces, name, flags = multiname.flags; 1.22788 + if (multiname.isRuntimeName()) { 1.22789 + name = stack.pop(); 1.22790 + } else { 1.22791 + name = constant(multiname.name); 1.22792 + } 1.22793 + if (multiname.isRuntimeNamespace()) { 1.22794 + namespaces = shouldFloat(new NewArray(region, [ 1.22795 + pop() 1.22796 + ])); 1.22797 + } else { 1.22798 + namespaces = constant(multiname.namespaces); 1.22799 + } 1.22800 + return new IR.ASMultiname(namespaces, name, flags); 1.22801 + } 1.22802 + function simplifyName(name) { 1.22803 + if (isMultinameConstant(name) && Multiname.isQName(name.value)) { 1.22804 + return constant(Multiname.getQualifiedName(name.value)); 1.22805 + } 1.22806 + return name; 1.22807 + } 1.22808 + function getGlobalScope(ti) { 1.22809 + if (ti && ti.object) { 1.22810 + return constant(ti.object); 1.22811 + } 1.22812 + return new IR.ASGlobal(null, savedScope()); 1.22813 + } 1.22814 + function findProperty(multiname, strict, ti) { 1.22815 + var slowPath = new IR.ASFindProperty(region, state.store, topScope(), multiname, domain, strict); 1.22816 + if (ti) { 1.22817 + if (ti.object) { 1.22818 + if (ti.object instanceof Global && !ti.object.isExecuting()) { 1.22819 + warn('Can\'t optimize findProperty ' + multiname + ', global object is not yet executed or executing.'); 1.22820 + return slowPath; 1.22821 + } 1.22822 + return constant(ti.object); 1.22823 + } else if (ti.scopeDepth !== undefined) { 1.22824 + return getScopeObject(topScope(ti.scopeDepth)); 1.22825 + } 1.22826 + } 1.22827 + warn('Can\'t optimize findProperty ' + multiname); 1.22828 + return slowPath; 1.22829 + } 1.22830 + function getJSProperty(object, path) { 1.22831 + return getJSPropertyWithState(state, object, path); 1.22832 + } 1.22833 + function coerce(multiname, value) { 1.22834 + if (false && isConstant(value)) { 1.22835 + return constant(asCoerceByMultiname(domain.value, multiname, value.value)); 1.22836 + } else { 1.22837 + var coercer = getCoercerForType(multiname); 1.22838 + if (coercer) { 1.22839 + return coercer(value); 1.22840 + } 1.22841 + } 1.22842 + if (c4CoerceNonPrimitive) { 1.22843 + return call(globalProperty('asCoerceByMultiname'), null, [ 1.22844 + domain, 1.22845 + constant(multiname), 1.22846 + value 1.22847 + ]); 1.22848 + } 1.22849 + return value; 1.22850 + } 1.22851 + function getScopeObject(scope) { 1.22852 + if (scope instanceof IR.ASScope) { 1.22853 + return scope.object; 1.22854 + } 1.22855 + return getJSProperty(scope, 'object'); 1.22856 + } 1.22857 + function store(node) { 1.22858 + state.store = new Projection(node, Projection.Type.STORE); 1.22859 + node.loads = state.loads.slice(0); 1.22860 + state.loads.length = 0; 1.22861 + return node; 1.22862 + } 1.22863 + function load(node) { 1.22864 + state.loads.push(node); 1.22865 + return node; 1.22866 + } 1.22867 + function resolveMultinameGlobally(multiname) { 1.22868 + var namespaces = multiname.namespaces; 1.22869 + var name = multiname.name; 1.22870 + if (!Shumway.AVM2.Runtime.globalMultinameAnalysis.value) { 1.22871 + return; 1.22872 + } 1.22873 + if (!isConstant(namespaces) || !isConstant(name) || multiname.isAttribute()) { 1.22874 + Counter.count('GlobalMultinameResolver: Cannot resolve runtime multiname or attribute.'); 1.22875 + return; 1.22876 + } 1.22877 + if (isNumeric(name.value) || !isString(name.value) || !name.value) { 1.22878 + Counter.count('GlobalMultinameResolver: Cannot resolve numeric or any names.'); 1.22879 + return false; 1.22880 + } 1.22881 + return GlobalMultinameResolver.resolveMultiname(new Multiname(namespaces.value, name.value, multiname.flags)); 1.22882 + } 1.22883 + function callSuper(scope, object, multiname, args, ti) { 1.22884 + if (ti && ti.trait && ti.trait.isMethod() && ti.baseClass) { 1.22885 + var qn = VM_OPEN_METHOD_PREFIX + Multiname.getQualifiedName(ti.trait.name); 1.22886 + var callee = getJSProperty(constant(ti.baseClass), 'traitsPrototype.' + qn); 1.22887 + return call(callee, object, args); 1.22888 + } 1.22889 + return store(new IR.ASCallSuper(region, state.store, object, multiname, args, IR.Flags.PRISTINE, scope)); 1.22890 + } 1.22891 + function getSuper(scope, object, multiname, ti) { 1.22892 + if (ti && ti.trait && ti.trait.isGetter() && ti.baseClass) { 1.22893 + var qn = VM_OPEN_GET_METHOD_PREFIX + Multiname.getQualifiedName(ti.trait.name); 1.22894 + var callee = getJSProperty(constant(ti.baseClass), 'traitsPrototype.' + qn); 1.22895 + return call(callee, object, []); 1.22896 + } 1.22897 + return store(new IR.ASGetSuper(region, state.store, object, multiname, scope)); 1.22898 + } 1.22899 + function setSuper(scope, object, multiname, value, ti) { 1.22900 + if (ti && ti.trait && ti.trait.isSetter() && ti.baseClass) { 1.22901 + var qn = VM_OPEN_SET_METHOD_PREFIX + Multiname.getQualifiedName(ti.trait.name); 1.22902 + var callee = getJSProperty(constant(ti.baseClass), 'traitsPrototype.' + qn); 1.22903 + return call(callee, object, [ 1.22904 + value 1.22905 + ]); 1.22906 + } 1.22907 + return store(new IR.ASSetSuper(region, state.store, object, multiname, value, scope)); 1.22908 + } 1.22909 + function constructSuper(scope, object, args, ti) { 1.22910 + if (ti) { 1.22911 + if (ti.noCallSuperNeeded) { 1.22912 + return; 1.22913 + } else if (ti.baseClass) { 1.22914 + var callee = getJSProperty(constant(ti.baseClass), 'instanceConstructorNoInitialize'); 1.22915 + call(callee, object, args); 1.22916 + return; 1.22917 + } 1.22918 + } 1.22919 + callee = getJSProperty(scope, 'object.baseClass.instanceConstructorNoInitialize'); 1.22920 + call(callee, object, args); 1.22921 + return; 1.22922 + } 1.22923 + function callProperty(object, multiname, args, isLex, ti) { 1.22924 + if (ti && ti.trait) { 1.22925 + if (ti.trait.isMethod()) { 1.22926 + var openQn; 1.22927 + if (ti.trait.holder instanceof InstanceInfo && ti.trait.holder.isInterface()) { 1.22928 + openQn = Multiname.getPublicQualifiedName(Multiname.getName(ti.trait.name)); 1.22929 + } else { 1.22930 + openQn = Multiname.getQualifiedName(ti.trait.name); 1.22931 + } 1.22932 + openQn = VM_OPEN_METHOD_PREFIX + openQn; 1.22933 + return store(new IR.CallProperty(region, state.store, object, constant(openQn), args, IR.Flags.PRISTINE)); 1.22934 + } else if (ti.trait.isClass()) { 1.22935 + var constructor = getCallableConstructorForType(ti.trait.name); 1.22936 + if (constructor) { 1.22937 + return constructor(args[0]); 1.22938 + } 1.22939 + var qn = Multiname.getQualifiedName(ti.trait.name); 1.22940 + return store(new IR.CallProperty(region, state.store, object, constant(qn), args, 0)); 1.22941 + } 1.22942 + } else if (ti && ti.propertyQName) { 1.22943 + return store(new IR.CallProperty(region, state.store, object, constant(ti.propertyQName), args, IR.Flags.PRISTINE)); 1.22944 + } 1.22945 + var qn = resolveMultinameGlobally(multiname); 1.22946 + if (qn) { 1.22947 + return store(new IR.ASCallProperty(region, state.store, object, constant(Multiname.getQualifiedName(qn)), args, IR.Flags.PRISTINE | IR.Flags.RESOLVED, isLex)); 1.22948 + } 1.22949 + return store(new IR.ASCallProperty(region, state.store, object, multiname, args, IR.Flags.PRISTINE, isLex)); 1.22950 + } 1.22951 + function getProperty(object, multiname, ti, getOpenMethod) { 1.22952 + true; 1.22953 + getOpenMethod = !(!getOpenMethod); 1.22954 + if (ti) { 1.22955 + if (ti.trait) { 1.22956 + if (ti.trait.isConst() && ti.trait.hasDefaultValue) { 1.22957 + return constant(ti.trait.value); 1.22958 + } 1.22959 + var get = new IR.GetProperty(region, state.store, object, qualifiedNameConstant(ti.trait.name)); 1.22960 + return ti.trait.isGetter() ? store(get) : load(get); 1.22961 + } 1.22962 + if (ti.propertyQName) { 1.22963 + return store(new IR.GetProperty(region, state.store, object, constant(ti.propertyQName))); 1.22964 + } else if (ti.isDirectlyReadable) { 1.22965 + return store(new IR.GetProperty(region, state.store, object, multiname.name)); 1.22966 + } else if (ti.isIndexedReadable) { 1.22967 + return store(new IR.ASGetProperty(region, state.store, object, multiname, IR.Flags.INDEXED | (getOpenMethod ? IR.Flagas.IS_METHOD : 0))); 1.22968 + } 1.22969 + } 1.22970 + warn('Can\'t optimize getProperty ' + multiname); 1.22971 + var qn = resolveMultinameGlobally(multiname); 1.22972 + if (qn) { 1.22973 + return store(new IR.ASGetProperty(region, state.store, object, constant(Multiname.getQualifiedName(qn)), IR.Flags.RESOLVED | (getOpenMethod ? IR.Flagas.IS_METHOD : 0))); 1.22974 + } 1.22975 + Counter.count('Compiler: Slow ASGetProperty'); 1.22976 + return store(new IR.ASGetProperty(region, state.store, object, multiname, getOpenMethod ? IR.Flagas.IS_METHOD : 0)); 1.22977 + } 1.22978 + function setProperty(object, multiname, value, ti) { 1.22979 + true; 1.22980 + if (ti) { 1.22981 + if (ti.trait) { 1.22982 + var coercer = ti.trait.typeName ? getCoercerForType(ti.trait.typeName) : null; 1.22983 + if (coercer) { 1.22984 + value = coercer(value); 1.22985 + } 1.22986 + store(new IR.SetProperty(region, state.store, object, qualifiedNameConstant(ti.trait.name), value)); 1.22987 + return; 1.22988 + } 1.22989 + if (ti.propertyQName) { 1.22990 + return store(new IR.SetProperty(region, state.store, object, constant(ti.propertyQName), value)); 1.22991 + } else if (ti.isDirectlyWriteable) { 1.22992 + return store(new IR.SetProperty(region, state.store, object, multiname.name, value)); 1.22993 + } else if (ti.isIndexedWriteable) { 1.22994 + return store(new IR.ASSetProperty(region, state.store, object, multiname, value, IR.Flags.INDEXED)); 1.22995 + } 1.22996 + } 1.22997 + warn('Can\'t optimize setProperty ' + multiname); 1.22998 + var qn = resolveMultinameGlobally(multiname); 1.22999 + if (qn) { 1.23000 + } 1.23001 + return store(new IR.ASSetProperty(region, state.store, object, multiname, value, 0)); 1.23002 + } 1.23003 + function getDescendants(object, name, ti) { 1.23004 + name = simplifyName(name); 1.23005 + return new IR.ASGetDescendants(region, state.store, object, name); 1.23006 + } 1.23007 + function getSlot(object, index, ti) { 1.23008 + if (ti) { 1.23009 + var trait = ti.trait; 1.23010 + if (trait) { 1.23011 + if (trait.isConst() && ti.trait.hasDefaultValue) { 1.23012 + return constant(trait.value); 1.23013 + } 1.23014 + var slotQn = Multiname.getQualifiedName(trait.name); 1.23015 + return store(new IR.GetProperty(region, state.store, object, constant(slotQn))); 1.23016 + } 1.23017 + } 1.23018 + warn('Can\'t optimize getSlot ' + index); 1.23019 + return store(new IR.ASGetSlot(null, state.store, object, index)); 1.23020 + } 1.23021 + function setSlot(object, index, value, ti) { 1.23022 + if (ti) { 1.23023 + var trait = ti.trait; 1.23024 + if (trait) { 1.23025 + var slotQn = Multiname.getQualifiedName(trait.name); 1.23026 + store(new IR.SetProperty(region, state.store, object, constant(slotQn), value)); 1.23027 + return; 1.23028 + } 1.23029 + } 1.23030 + warn('Can\'t optimize setSlot ' + index); 1.23031 + store(new IR.ASSetSlot(region, state.store, object, index, value)); 1.23032 + } 1.23033 + function call(callee, object, args) { 1.23034 + return store(new Call(region, state.store, callee, object, args, IR.Flags.PRISTINE)); 1.23035 + } 1.23036 + function callCall(callee, object, args, pristine) { 1.23037 + return store(new Call(region, state.store, callee, object, args, pristine ? IR.Flags.PRISTINE : 0)); 1.23038 + } 1.23039 + function truthyCondition(operator) { 1.23040 + var right; 1.23041 + if (operator.isBinary()) { 1.23042 + right = pop(); 1.23043 + } 1.23044 + var left = pop(); 1.23045 + var node; 1.23046 + if (right) { 1.23047 + node = binary(operator, left, right); 1.23048 + } else { 1.23049 + node = unary(operator, left); 1.23050 + } 1.23051 + if (peepholeOptimizer) { 1.23052 + node = peepholeOptimizer.tryFold(node, true); 1.23053 + } 1.23054 + return node; 1.23055 + } 1.23056 + function negatedTruthyCondition(operator) { 1.23057 + var node = unary(Operator.FALSE, truthyCondition(operator)); 1.23058 + if (peepholeOptimizer) { 1.23059 + node = peepholeOptimizer.tryFold(node, true); 1.23060 + } 1.23061 + return node; 1.23062 + } 1.23063 + function pushExpression(operator, toInt) { 1.23064 + var left, right; 1.23065 + if (operator.isBinary()) { 1.23066 + right = pop(); 1.23067 + left = pop(); 1.23068 + if (toInt) { 1.23069 + right = coerceInt(right); 1.23070 + left = coerceInt(left); 1.23071 + } 1.23072 + push(binary(operator, left, right)); 1.23073 + } else { 1.23074 + left = pop(); 1.23075 + if (toInt) { 1.23076 + left = coerceInt(left); 1.23077 + } 1.23078 + push(unary(operator, left)); 1.23079 + } 1.23080 + } 1.23081 + var stops = null; 1.23082 + function buildIfStops(predicate) { 1.23083 + true; 1.23084 + var _if = new IR.If(region, predicate); 1.23085 + stops = [ 1.23086 + { 1.23087 + control: new Projection(_if, Projection.Type.FALSE), 1.23088 + target: bytecodes[bc.position + 1], 1.23089 + state: state 1.23090 + }, 1.23091 + { 1.23092 + control: new Projection(_if, Projection.Type.TRUE), 1.23093 + target: bc.target, 1.23094 + state: state 1.23095 + } 1.23096 + ]; 1.23097 + } 1.23098 + function buildJumpStop() { 1.23099 + true; 1.23100 + stops = [ 1.23101 + { 1.23102 + control: region, 1.23103 + target: bc.target, 1.23104 + state: state 1.23105 + } 1.23106 + ]; 1.23107 + } 1.23108 + function buildThrowStop() { 1.23109 + true; 1.23110 + stops = []; 1.23111 + } 1.23112 + function buildReturnStop() { 1.23113 + true; 1.23114 + stops = []; 1.23115 + } 1.23116 + function buildSwitchStops(determinant) { 1.23117 + true; 1.23118 + if (bc.targets.length > 2) { 1.23119 + stops = []; 1.23120 + var _switch = new IR.Switch(region, determinant); 1.23121 + for (var i = 0; i < bc.targets.length; i++) { 1.23122 + stops.push({ 1.23123 + control: new Projection(_switch, Projection.Type.CASE, constant(i)), 1.23124 + target: bc.targets[i], 1.23125 + state: state 1.23126 + }); 1.23127 + } 1.23128 + } else { 1.23129 + true; 1.23130 + var predicate = binary(Operator.SEQ, determinant, constant(0)); 1.23131 + var _if = new IR.If(region, predicate); 1.23132 + stops = [ 1.23133 + { 1.23134 + control: new Projection(_if, Projection.Type.FALSE), 1.23135 + target: bc.targets[1], 1.23136 + state: state 1.23137 + }, 1.23138 + { 1.23139 + control: new Projection(_if, Projection.Type.TRUE), 1.23140 + target: bc.targets[0], 1.23141 + state: state 1.23142 + } 1.23143 + ]; 1.23144 + } 1.23145 + } 1.23146 + if (traceBuilder) { 1.23147 + writer.writeLn('Processing Region: ' + region + ', Block: ' + block.bid); 1.23148 + writer.enter(('> state: ' + region.entryState.toString()).padRight(' ', 100)); 1.23149 + } 1.23150 + region.processed = true; 1.23151 + var bc; 1.23152 + for (var bci = block.position, end = block.end.position; bci <= end; bci++) { 1.23153 + bc = bytecodes[bci]; 1.23154 + var op = bc.op; 1.23155 + state.index = bci; 1.23156 + switch (op) { 1.23157 + case 3: 1.23158 + store(new IR.Throw(region, pop())); 1.23159 + stopPoints.push({ 1.23160 + region: region, 1.23161 + store: state.store, 1.23162 + value: Undefined 1.23163 + }); 1.23164 + buildThrowStop(); 1.23165 + break; 1.23166 + case 98: 1.23167 + pushLocal(bc.index); 1.23168 + break; 1.23169 + case 208: 1.23170 + case 209: 1.23171 + case 210: 1.23172 + case 211: 1.23173 + pushLocal(op - OP_getlocal0); 1.23174 + break; 1.23175 + case 99: 1.23176 + popLocal(bc.index); 1.23177 + break; 1.23178 + case 212: 1.23179 + case 213: 1.23180 + case 214: 1.23181 + case 215: 1.23182 + popLocal(op - OP_setlocal0); 1.23183 + break; 1.23184 + case 28: 1.23185 + scope.push(new IR.ASScope(topScope(), pop(), true)); 1.23186 + break; 1.23187 + case 48: 1.23188 + scope.push(new IR.ASScope(topScope(), pop(), false)); 1.23189 + break; 1.23190 + case 29: 1.23191 + scope.pop(); 1.23192 + break; 1.23193 + case 100: 1.23194 + push(getGlobalScope(bc.ti)); 1.23195 + break; 1.23196 + case 101: 1.23197 + push(getScopeObject(state.scope[bc.index])); 1.23198 + break; 1.23199 + case 93: 1.23200 + push(findProperty(buildMultiname(bc.index), true, bc.ti)); 1.23201 + break; 1.23202 + case 94: 1.23203 + push(findProperty(buildMultiname(bc.index), false, bc.ti)); 1.23204 + break; 1.23205 + case 102: 1.23206 + multiname = buildMultiname(bc.index); 1.23207 + object = pop(); 1.23208 + push(getProperty(object, multiname, bc.ti, false)); 1.23209 + break; 1.23210 + case 89: 1.23211 + multiname = buildMultiname(bc.index); 1.23212 + object = pop(); 1.23213 + push(getDescendants(object, multiname, bc.ti)); 1.23214 + break; 1.23215 + case 96: 1.23216 + multiname = buildMultiname(bc.index); 1.23217 + push(getProperty(findProperty(multiname, true, bc.ti), multiname, bc.ti, false)); 1.23218 + break; 1.23219 + case 104: 1.23220 + case 97: 1.23221 + value = pop(); 1.23222 + multiname = buildMultiname(bc.index); 1.23223 + object = pop(); 1.23224 + setProperty(object, multiname, value, bc.ti); 1.23225 + break; 1.23226 + case 106: 1.23227 + multiname = buildMultiname(bc.index); 1.23228 + object = pop(); 1.23229 + push(store(new IR.ASDeleteProperty(region, state.store, object, multiname))); 1.23230 + break; 1.23231 + case 108: 1.23232 + object = pop(); 1.23233 + push(getSlot(object, constant(bc.index), bc.ti)); 1.23234 + break; 1.23235 + case 109: 1.23236 + value = pop(); 1.23237 + object = pop(); 1.23238 + setSlot(object, constant(bc.index), value, bc.ti); 1.23239 + break; 1.23240 + case 4: 1.23241 + multiname = buildMultiname(bc.index); 1.23242 + object = pop(); 1.23243 + push(getSuper(savedScope(), object, multiname, bc.ti)); 1.23244 + break; 1.23245 + case 5: 1.23246 + value = pop(); 1.23247 + multiname = buildMultiname(bc.index); 1.23248 + object = pop(); 1.23249 + setSuper(savedScope(), object, multiname, value, bc.ti); 1.23250 + break; 1.23251 + case 241: 1.23252 + case 240: 1.23253 + break; 1.23254 + case 64: 1.23255 + push(callPure(createFunctionCallee, null, [ 1.23256 + constant(methods[bc.index]), 1.23257 + topScope(), 1.23258 + constant(true) 1.23259 + ])); 1.23260 + break; 1.23261 + case 65: 1.23262 + args = popMany(bc.argCount); 1.23263 + object = pop(); 1.23264 + callee = pop(); 1.23265 + push(callCall(callee, object, args)); 1.23266 + break; 1.23267 + case 70: 1.23268 + case 79: 1.23269 + case 76: 1.23270 + args = popMany(bc.argCount); 1.23271 + multiname = buildMultiname(bc.index); 1.23272 + object = pop(); 1.23273 + value = callProperty(object, multiname, args, op === OP_callproplex, bc.ti); 1.23274 + if (op !== OP_callpropvoid) { 1.23275 + push(value); 1.23276 + } 1.23277 + break; 1.23278 + case 69: 1.23279 + case 78: 1.23280 + multiname = buildMultiname(bc.index); 1.23281 + args = popMany(bc.argCount); 1.23282 + object = pop(); 1.23283 + value = callSuper(savedScope(), object, multiname, args, bc.ti); 1.23284 + if (op !== OP_callsupervoid) { 1.23285 + push(value); 1.23286 + } 1.23287 + break; 1.23288 + case 66: 1.23289 + args = popMany(bc.argCount); 1.23290 + object = pop(); 1.23291 + push(store(new IR.ASNew(region, state.store, object, args))); 1.23292 + break; 1.23293 + case 73: 1.23294 + args = popMany(bc.argCount); 1.23295 + object = pop(); 1.23296 + constructSuper(savedScope(), object, args, bc.ti); 1.23297 + break; 1.23298 + case 74: 1.23299 + args = popMany(bc.argCount); 1.23300 + multiname = buildMultiname(bc.index); 1.23301 + object = pop(); 1.23302 + callee = getProperty(object, multiname, bc.ti, false); 1.23303 + push(store(new IR.ASNew(region, state.store, callee, args))); 1.23304 + break; 1.23305 + case 128: 1.23306 + if (bc.ti && bc.ti.noCoercionNeeded) { 1.23307 + Counter.count('Compiler: NoCoercionNeeded'); 1.23308 + break; 1.23309 + } else { 1.23310 + Counter.count('Compiler: CoercionNeeded'); 1.23311 + } 1.23312 + value = pop(); 1.23313 + push(coerce(multinames[bc.index], value)); 1.23314 + break; 1.23315 + case 131: 1.23316 + case 115: 1.23317 + push(coerceInt(pop())); 1.23318 + break; 1.23319 + case 136: 1.23320 + case 116: 1.23321 + push(coerceUint(pop())); 1.23322 + break; 1.23323 + case 132: 1.23324 + case 117: 1.23325 + push(coerceNumber(pop())); 1.23326 + break; 1.23327 + case 129: 1.23328 + case 118: 1.23329 + push(coerceBoolean(pop())); 1.23330 + break; 1.23331 + case 120: 1.23332 + push(call(globalProperty('checkFilter'), null, [ 1.23333 + pop() 1.23334 + ])); 1.23335 + break; 1.23336 + case 130: 1.23337 + break; 1.23338 + case 133: 1.23339 + push(coerceString(pop())); 1.23340 + break; 1.23341 + case 112: 1.23342 + push(convertString(pop())); 1.23343 + break; 1.23344 + case 135: 1.23345 + type = pop(); 1.23346 + if (c4AsTypeLate) { 1.23347 + value = pop(); 1.23348 + push(call(globalProperty('asAsType'), null, [ 1.23349 + type, 1.23350 + value 1.23351 + ])); 1.23352 + } 1.23353 + break; 1.23354 + case 72: 1.23355 + case 71: 1.23356 + value = Undefined; 1.23357 + if (op === OP_returnvalue) { 1.23358 + value = pop(); 1.23359 + if (methodInfo.returnType) { 1.23360 + if (!(bc.ti && bc.ti.noCoercionNeeded)) { 1.23361 + value = coerce(methodInfo.returnType, value); 1.23362 + } 1.23363 + } 1.23364 + } 1.23365 + stopPoints.push({ 1.23366 + region: region, 1.23367 + store: state.store, 1.23368 + value: value 1.23369 + }); 1.23370 + buildReturnStop(); 1.23371 + break; 1.23372 + case 30: 1.23373 + case 35: 1.23374 + index = pop(); 1.23375 + object = pop(); 1.23376 + push(new IR.CallProperty(region, state.store, object, constant(op === OP_nextname ? 'asNextName' : 'asNextValue'), [ 1.23377 + index 1.23378 + ], IR.Flags.PRISTINE)); 1.23379 + break; 1.23380 + case 50: 1.23381 + var temp = call(globalProperty('asHasNext2'), null, [ 1.23382 + local[bc.object], 1.23383 + local[bc.index] 1.23384 + ]); 1.23385 + local[bc.object] = getJSProperty(temp, 'object'); 1.23386 + push(local[bc.index] = getJSProperty(temp, 'index')); 1.23387 + break; 1.23388 + case 32: 1.23389 + push(Null); 1.23390 + break; 1.23391 + case 33: 1.23392 + push(Undefined); 1.23393 + break; 1.23394 + case 34: 1.23395 + notImplemented(); 1.23396 + break; 1.23397 + case 36: 1.23398 + push(constant(bc.value)); 1.23399 + break; 1.23400 + case 37: 1.23401 + push(constant(bc.value)); 1.23402 + break; 1.23403 + case 44: 1.23404 + push(constant(strings[bc.index])); 1.23405 + break; 1.23406 + case 45: 1.23407 + push(constant(ints[bc.index])); 1.23408 + break; 1.23409 + case 46: 1.23410 + push(constant(uints[bc.index])); 1.23411 + break; 1.23412 + case 47: 1.23413 + push(constant(doubles[bc.index])); 1.23414 + break; 1.23415 + case 38: 1.23416 + push(constant(true)); 1.23417 + break; 1.23418 + case 39: 1.23419 + push(constant(false)); 1.23420 + break; 1.23421 + case 40: 1.23422 + push(constant(NaN)); 1.23423 + break; 1.23424 + case 41: 1.23425 + pop(); 1.23426 + break; 1.23427 + case 42: 1.23428 + value = shouldNotFloat(pop()); 1.23429 + push(value); 1.23430 + push(value); 1.23431 + break; 1.23432 + case 43: 1.23433 + state.stack.push(pop(), pop()); 1.23434 + break; 1.23435 + case 239: 1.23436 + case OP_debugline: 1.23437 + case OP_debugfile: 1.23438 + break; 1.23439 + case 12: 1.23440 + buildIfStops(negatedTruthyCondition(Operator.LT)); 1.23441 + break; 1.23442 + case 24: 1.23443 + buildIfStops(truthyCondition(Operator.GE)); 1.23444 + break; 1.23445 + case 13: 1.23446 + buildIfStops(negatedTruthyCondition(Operator.LE)); 1.23447 + break; 1.23448 + case 23: 1.23449 + buildIfStops(truthyCondition(Operator.GT)); 1.23450 + break; 1.23451 + case 14: 1.23452 + buildIfStops(negatedTruthyCondition(Operator.GT)); 1.23453 + break; 1.23454 + case 22: 1.23455 + buildIfStops(truthyCondition(Operator.LE)); 1.23456 + break; 1.23457 + case 15: 1.23458 + buildIfStops(negatedTruthyCondition(Operator.GE)); 1.23459 + break; 1.23460 + case 21: 1.23461 + buildIfStops(truthyCondition(Operator.LT)); 1.23462 + break; 1.23463 + case 16: 1.23464 + buildJumpStop(); 1.23465 + break; 1.23466 + case 17: 1.23467 + buildIfStops(truthyCondition(Operator.TRUE)); 1.23468 + break; 1.23469 + case 18: 1.23470 + buildIfStops(truthyCondition(Operator.FALSE)); 1.23471 + break; 1.23472 + case 19: 1.23473 + buildIfStops(truthyCondition(Operator.EQ)); 1.23474 + break; 1.23475 + case 20: 1.23476 + buildIfStops(truthyCondition(Operator.NE)); 1.23477 + break; 1.23478 + case 25: 1.23479 + buildIfStops(truthyCondition(Operator.SEQ)); 1.23480 + break; 1.23481 + case 26: 1.23482 + buildIfStops(truthyCondition(Operator.SNE)); 1.23483 + break; 1.23484 + case 27: 1.23485 + buildSwitchStops(pop()); 1.23486 + break; 1.23487 + case 150: 1.23488 + pushExpression(Operator.FALSE); 1.23489 + break; 1.23490 + case 151: 1.23491 + pushExpression(Operator.BITWISE_NOT); 1.23492 + break; 1.23493 + case 160: 1.23494 + right = pop(); 1.23495 + left = pop(); 1.23496 + if (typesAreEqual(left, right)) { 1.23497 + operator = Operator.ADD; 1.23498 + } else if (Shumway.AVM2.Runtime.useAsAdd) { 1.23499 + operator = Operator.AS_ADD; 1.23500 + } else { 1.23501 + operator = Operator.ADD; 1.23502 + } 1.23503 + push(binary(operator, left, right)); 1.23504 + break; 1.23505 + case 197: 1.23506 + pushExpression(Operator.ADD, true); 1.23507 + break; 1.23508 + case 161: 1.23509 + pushExpression(Operator.SUB); 1.23510 + break; 1.23511 + case 198: 1.23512 + pushExpression(Operator.SUB, true); 1.23513 + break; 1.23514 + case 162: 1.23515 + pushExpression(Operator.MUL); 1.23516 + break; 1.23517 + case 199: 1.23518 + pushExpression(Operator.MUL, true); 1.23519 + break; 1.23520 + case 163: 1.23521 + pushExpression(Operator.DIV); 1.23522 + break; 1.23523 + case 164: 1.23524 + pushExpression(Operator.MOD); 1.23525 + break; 1.23526 + case 165: 1.23527 + pushExpression(Operator.LSH); 1.23528 + break; 1.23529 + case 166: 1.23530 + pushExpression(Operator.RSH); 1.23531 + break; 1.23532 + case 167: 1.23533 + pushExpression(Operator.URSH); 1.23534 + break; 1.23535 + case 168: 1.23536 + pushExpression(Operator.AND); 1.23537 + break; 1.23538 + case 169: 1.23539 + pushExpression(Operator.OR); 1.23540 + break; 1.23541 + case 170: 1.23542 + pushExpression(Operator.XOR); 1.23543 + break; 1.23544 + case 171: 1.23545 + pushExpression(Operator.EQ); 1.23546 + break; 1.23547 + case 172: 1.23548 + pushExpression(Operator.SEQ); 1.23549 + break; 1.23550 + case 173: 1.23551 + pushExpression(Operator.LT); 1.23552 + break; 1.23553 + case 174: 1.23554 + pushExpression(Operator.LE); 1.23555 + break; 1.23556 + case 175: 1.23557 + pushExpression(Operator.GT); 1.23558 + break; 1.23559 + case 176: 1.23560 + pushExpression(Operator.GE); 1.23561 + break; 1.23562 + case 144: 1.23563 + pushExpression(Operator.NEG); 1.23564 + break; 1.23565 + case 196: 1.23566 + pushExpression(Operator.NEG, true); 1.23567 + break; 1.23568 + case 145: 1.23569 + case 192: 1.23570 + case 147: 1.23571 + case 193: 1.23572 + push(constant(1)); 1.23573 + if (op === OP_increment || op === OP_decrement) { 1.23574 + push(coerceNumber(pop())); 1.23575 + } else { 1.23576 + push(coerceInt(pop())); 1.23577 + } 1.23578 + if (op === OP_increment || op === OP_increment_i) { 1.23579 + pushExpression(Operator.ADD); 1.23580 + } else { 1.23581 + pushExpression(Operator.SUB); 1.23582 + } 1.23583 + break; 1.23584 + case 146: 1.23585 + case 194: 1.23586 + case 148: 1.23587 + case 195: 1.23588 + push(constant(1)); 1.23589 + if (op === OP_inclocal || op === OP_declocal) { 1.23590 + push(coerceNumber(local[bc.index])); 1.23591 + } else { 1.23592 + push(coerceInt(local[bc.index])); 1.23593 + } 1.23594 + if (op === OP_inclocal || op === OP_inclocal_i) { 1.23595 + pushExpression(Operator.ADD); 1.23596 + } else { 1.23597 + pushExpression(Operator.SUB); 1.23598 + } 1.23599 + popLocal(bc.index); 1.23600 + break; 1.23601 + case 177: 1.23602 + type = pop(); 1.23603 + value = pop(); 1.23604 + push(call(getJSProperty(type, 'isInstanceOf'), null, [ 1.23605 + value 1.23606 + ])); 1.23607 + break; 1.23608 + case 178: 1.23609 + value = pop(); 1.23610 + multiname = buildMultiname(bc.index); 1.23611 + type = getProperty(findProperty(multiname, false), multiname); 1.23612 + push(call(globalProperty('asIsType'), null, [ 1.23613 + type, 1.23614 + value 1.23615 + ])); 1.23616 + break; 1.23617 + case 179: 1.23618 + type = pop(); 1.23619 + value = pop(); 1.23620 + push(call(globalProperty('asIsType'), null, [ 1.23621 + type, 1.23622 + value 1.23623 + ])); 1.23624 + break; 1.23625 + case 180: 1.23626 + object = pop(); 1.23627 + value = pop(); 1.23628 + multiname = new IR.ASMultiname(Undefined, value, 0); 1.23629 + push(store(new IR.ASHasProperty(region, state.store, object, multiname))); 1.23630 + break; 1.23631 + case 149: 1.23632 + push(call(globalProperty('asTypeOf'), null, [ 1.23633 + pop() 1.23634 + ])); 1.23635 + break; 1.23636 + case 8: 1.23637 + push(Undefined); 1.23638 + popLocal(bc.index); 1.23639 + break; 1.23640 + case 83: 1.23641 + args = popMany(bc.argCount); 1.23642 + type = pop(); 1.23643 + callee = globalProperty('applyType'); 1.23644 + push(call(callee, null, [ 1.23645 + domain, 1.23646 + type, 1.23647 + new NewArray(region, args) 1.23648 + ])); 1.23649 + break; 1.23650 + case 86: 1.23651 + args = popMany(bc.argCount); 1.23652 + push(new NewArray(region, args)); 1.23653 + break; 1.23654 + case 85: 1.23655 + var properties = []; 1.23656 + for (var i = 0; i < bc.argCount; i++) { 1.23657 + var value = pop(); 1.23658 + var key = pop(); 1.23659 + true; 1.23660 + key = constant(Multiname.getPublicQualifiedName(key.value)); 1.23661 + properties.push(new KeyValuePair(key, value)); 1.23662 + } 1.23663 + push(new NewObject(region, properties)); 1.23664 + break; 1.23665 + case 87: 1.23666 + push(new IR.ASNewActivation(constant(methodInfo))); 1.23667 + break; 1.23668 + case 88: 1.23669 + callee = globalProperty('createClass'); 1.23670 + push(call(callee, null, [ 1.23671 + constant(classes[bc.index]), 1.23672 + pop(), 1.23673 + topScope() 1.23674 + ])); 1.23675 + break; 1.23676 + default: 1.23677 + unexpected('Not Implemented: ' + bc); 1.23678 + } 1.23679 + if (op === OP_debug || op === OP_debugfile || op === OP_debugline) { 1.23680 + continue; 1.23681 + } 1.23682 + if (traceBuilder) { 1.23683 + writer.writeLn(('state: ' + state.toString()).padRight(' ', 100) + ' : ' + bci + ', ' + bc.toString(this.abc)); 1.23684 + } 1.23685 + } 1.23686 + if (traceBuilder) { 1.23687 + writer.leave(('< state: ' + state.toString()).padRight(' ', 100)); 1.23688 + } 1.23689 + if (!stops) { 1.23690 + stops = []; 1.23691 + if (bc.position + 1 <= bytecodes.length) { 1.23692 + stops.push({ 1.23693 + control: region, 1.23694 + target: bytecodes[bc.position + 1], 1.23695 + state: state 1.23696 + }); 1.23697 + } 1.23698 + } 1.23699 + return stops; 1.23700 + } 1.23701 + var stop; 1.23702 + if (stopPoints.length > 1) { 1.23703 + var stopRegion = new Region(null); 1.23704 + var stopValuePhi = new Phi(stopRegion, null); 1.23705 + var stopStorePhi = new Phi(stopRegion, null); 1.23706 + stopPoints.forEach(function (stopPoint) { 1.23707 + stopRegion.predecessors.push(stopPoint.region); 1.23708 + stopValuePhi.pushValue(stopPoint.value); 1.23709 + stopStorePhi.pushValue(stopPoint.store); 1.23710 + }); 1.23711 + stop = new Stop(stopRegion, stopStorePhi, stopValuePhi); 1.23712 + } else { 1.23713 + stop = new Stop(stopPoints[0].region, stopPoints[0].store, stopPoints[0].value); 1.23714 + } 1.23715 + return new DFG(stop); 1.23716 + }; 1.23717 + return builder; 1.23718 + }(); 1.23719 + function buildMethod(verifier, methodInfo, scope, hasDynamicScope) { 1.23720 + true; 1.23721 + true; 1.23722 + true; 1.23723 + Counter.count('Compiler: Compiled Methods'); 1.23724 + Timer.start('Compiler'); 1.23725 + Timer.start('Mark Loops'); 1.23726 + methodInfo.analysis.markLoops(); 1.23727 + Timer.stop(); 1.23728 + if (Shumway.AVM2.Runtime.enableVerifier.value) { 1.23729 + Timer.start('Verify'); 1.23730 + verifier.verifyMethod(methodInfo, scope); 1.23731 + Timer.stop(); 1.23732 + } 1.23733 + var traceSource = c4TraceLevel.value > 0; 1.23734 + var traceIR = c4TraceLevel.value > 1; 1.23735 + Timer.start('Build IR'); 1.23736 + Node.startNumbering(); 1.23737 + var dfg = new Builder(methodInfo, scope, hasDynamicScope).buildGraph(); 1.23738 + Timer.stop(); 1.23739 + traceIR && dfg.trace(writer); 1.23740 + Timer.start('Build CFG'); 1.23741 + var cfg = dfg.buildCFG(); 1.23742 + Timer.stop(); 1.23743 + Timer.start('Optimize Phis'); 1.23744 + cfg.optimizePhis(); 1.23745 + Timer.stop(); 1.23746 + Timer.start('Schedule Nodes'); 1.23747 + cfg.scheduleEarly(); 1.23748 + Timer.stop(); 1.23749 + traceIR && cfg.trace(writer); 1.23750 + Timer.start('Verify IR'); 1.23751 + cfg.verify(); 1.23752 + Timer.stop(); 1.23753 + Timer.start('Allocate Variables'); 1.23754 + cfg.allocateVariables(); 1.23755 + Timer.stop(); 1.23756 + Timer.start('Generate Source'); 1.23757 + var result = Backend.generate(cfg, enableRegisterAllocator.value); 1.23758 + Timer.stop(); 1.23759 + traceSource && writer.writeLn(result.body); 1.23760 + Node.stopNumbering(); 1.23761 + Timer.stop(); 1.23762 + return result; 1.23763 + } 1.23764 + exports.buildMethod = buildMethod; 1.23765 +}(typeof exports === 'undefined' ? Builder = {} : exports)); 1.23766 +var Compiler = new (function () { 1.23767 + function constructor() { 1.23768 + this.verifier = new Verifier(); 1.23769 + } 1.23770 + constructor.prototype.compileMethod = function (methodInfo, scope, hasDynamicScope) { 1.23771 + return Builder.buildMethod(this.verifier, methodInfo, scope, hasDynamicScope); 1.23772 + }; 1.23773 + return constructor; 1.23774 + }())(); 1.23775 +(function (exports) { 1.23776 + var Control = function () { 1.23777 + var SEQ = 1; 1.23778 + var LOOP = 2; 1.23779 + var IF = 3; 1.23780 + var CASE = 4; 1.23781 + var SWITCH = 5; 1.23782 + var LABEL_CASE = 6; 1.23783 + var LABEL_SWITCH = 7; 1.23784 + var EXIT = 8; 1.23785 + var BREAK = 9; 1.23786 + var CONTINUE = 10; 1.23787 + var TRY = 11; 1.23788 + var CATCH = 12; 1.23789 + function Seq(body) { 1.23790 + this.kind = SEQ; 1.23791 + this.body = body; 1.23792 + } 1.23793 + Seq.prototype = { 1.23794 + trace: function (writer) { 1.23795 + var body = this.body; 1.23796 + for (var i = 0, j = body.length; i < j; i++) { 1.23797 + body[i].trace(writer); 1.23798 + } 1.23799 + }, 1.23800 + first: function () { 1.23801 + return this.body[0]; 1.23802 + }, 1.23803 + slice: function (begin, end) { 1.23804 + return new Seq(this.body.slice(begin, end)); 1.23805 + } 1.23806 + }; 1.23807 + function Loop(body) { 1.23808 + this.kind = LOOP; 1.23809 + this.body = body; 1.23810 + } 1.23811 + Loop.prototype = { 1.23812 + trace: function (writer) { 1.23813 + writer.enter('loop {'); 1.23814 + this.body.trace(writer); 1.23815 + writer.leave('}'); 1.23816 + } 1.23817 + }; 1.23818 + function If(cond, then, els, nothingThrownLabel) { 1.23819 + this.kind = IF; 1.23820 + this.cond = cond; 1.23821 + this.then = then; 1.23822 + this.else = els; 1.23823 + this.negated = false; 1.23824 + this.nothingThrownLabel = nothingThrownLabel; 1.23825 + } 1.23826 + If.prototype = { 1.23827 + trace: function (writer) { 1.23828 + this.cond.trace(writer); 1.23829 + if (this.nothingThrownLabel) { 1.23830 + writer.enter('if (label is ' + this.nothingThrownLabel + ') {'); 1.23831 + } 1.23832 + writer.enter('if' + (this.negated ? ' not' : '') + ' {'); 1.23833 + this.then && this.then.trace(writer); 1.23834 + if (this.else) { 1.23835 + writer.outdent(); 1.23836 + writer.enter('} else {'); 1.23837 + this.else.trace(writer); 1.23838 + } 1.23839 + writer.leave('}'); 1.23840 + if (this.nothingThrownLabel) { 1.23841 + writer.leave('}'); 1.23842 + } 1.23843 + } 1.23844 + }; 1.23845 + function Case(index, body) { 1.23846 + this.kind = CASE; 1.23847 + this.index = index; 1.23848 + this.body = body; 1.23849 + } 1.23850 + Case.prototype = { 1.23851 + trace: function (writer) { 1.23852 + if (this.index >= 0) { 1.23853 + writer.writeLn('case ' + this.index + ':'); 1.23854 + } else { 1.23855 + writer.writeLn('default:'); 1.23856 + } 1.23857 + writer.indent(); 1.23858 + this.body && this.body.trace(writer); 1.23859 + writer.outdent(); 1.23860 + } 1.23861 + }; 1.23862 + function Switch(determinant, cases, nothingThrownLabel) { 1.23863 + this.kind = SWITCH; 1.23864 + this.determinant = determinant; 1.23865 + this.cases = cases; 1.23866 + this.nothingThrownLabel = nothingThrownLabel; 1.23867 + } 1.23868 + Switch.prototype = { 1.23869 + trace: function (writer) { 1.23870 + if (this.nothingThrownLabel) { 1.23871 + writer.enter('if (label is ' + this.nothingThrownLabel + ') {'); 1.23872 + } 1.23873 + this.determinant.trace(writer); 1.23874 + writer.writeLn('switch {'); 1.23875 + for (var i = 0, j = this.cases.length; i < j; i++) { 1.23876 + this.cases[i].trace(writer); 1.23877 + } 1.23878 + writer.writeLn('}'); 1.23879 + if (this.nothingThrownLabel) { 1.23880 + writer.leave('}'); 1.23881 + } 1.23882 + } 1.23883 + }; 1.23884 + function LabelCase(labels, body) { 1.23885 + this.kind = LABEL_CASE; 1.23886 + this.labels = labels; 1.23887 + this.body = body; 1.23888 + } 1.23889 + LabelCase.prototype = { 1.23890 + trace: function (writer) { 1.23891 + writer.enter('if (label is ' + this.labels.join(' or ') + ') {'); 1.23892 + this.body && this.body.trace(writer); 1.23893 + writer.leave('}'); 1.23894 + } 1.23895 + }; 1.23896 + function LabelSwitch(cases) { 1.23897 + var labelMap = {}; 1.23898 + for (var i = 0, j = cases.length; i < j; i++) { 1.23899 + var c = cases[i]; 1.23900 + if (!c.labels) { 1.23901 + print(c.toSource()); 1.23902 + } 1.23903 + for (var k = 0, l = c.labels.length; k < l; k++) { 1.23904 + labelMap[c.labels[k]] = c; 1.23905 + } 1.23906 + } 1.23907 + this.kind = LABEL_SWITCH; 1.23908 + this.cases = cases; 1.23909 + this.labelMap = labelMap; 1.23910 + } 1.23911 + LabelSwitch.prototype = { 1.23912 + trace: function (writer) { 1.23913 + for (var i = 0, j = this.cases.length; i < j; i++) { 1.23914 + this.cases[i].trace(writer); 1.23915 + } 1.23916 + } 1.23917 + }; 1.23918 + function Exit(label) { 1.23919 + this.kind = EXIT; 1.23920 + this.label = label; 1.23921 + } 1.23922 + Exit.prototype = { 1.23923 + trace: function (writer) { 1.23924 + writer.writeLn('label = ' + this.label); 1.23925 + } 1.23926 + }; 1.23927 + function Break(label, head) { 1.23928 + this.kind = BREAK; 1.23929 + this.label = label; 1.23930 + this.head = head; 1.23931 + } 1.23932 + Break.prototype = { 1.23933 + trace: function (writer) { 1.23934 + this.label && writer.writeLn('label = ' + this.label); 1.23935 + writer.writeLn('break'); 1.23936 + } 1.23937 + }; 1.23938 + function Continue(label, head) { 1.23939 + this.kind = CONTINUE; 1.23940 + this.label = label; 1.23941 + this.head = head; 1.23942 + this.necessary = true; 1.23943 + } 1.23944 + Continue.prototype = { 1.23945 + trace: function (writer) { 1.23946 + this.label && writer.writeLn('label = ' + this.label); 1.23947 + this.necessary && writer.writeLn('continue'); 1.23948 + } 1.23949 + }; 1.23950 + function Try(body, catches) { 1.23951 + this.kind = TRY; 1.23952 + this.body = body; 1.23953 + this.catches = catches; 1.23954 + } 1.23955 + Try.prototype = { 1.23956 + trace: function (writer) { 1.23957 + writer.enter('try {'); 1.23958 + this.body.trace(writer); 1.23959 + writer.writeLn('label = ' + this.nothingThrownLabel); 1.23960 + for (var i = 0, j = this.catches.length; i < j; i++) { 1.23961 + this.catches[i].trace(writer); 1.23962 + } 1.23963 + writer.leave('}'); 1.23964 + } 1.23965 + }; 1.23966 + function Catch(varName, typeName, body) { 1.23967 + this.kind = CATCH; 1.23968 + this.varName = varName; 1.23969 + this.typeName = typeName; 1.23970 + this.body = body; 1.23971 + } 1.23972 + Catch.prototype = { 1.23973 + trace: function (writer) { 1.23974 + writer.outdent(); 1.23975 + writer.enter('} catch (' + (this.varName || 'e') + (this.typeName ? ' : ' + this.typeName : '') + ') {'); 1.23976 + this.body.trace(writer); 1.23977 + } 1.23978 + }; 1.23979 + return { 1.23980 + SEQ: SEQ, 1.23981 + LOOP: LOOP, 1.23982 + IF: IF, 1.23983 + CASE: CASE, 1.23984 + SWITCH: SWITCH, 1.23985 + LABEL_CASE: LABEL_CASE, 1.23986 + LABEL_SWITCH: LABEL_SWITCH, 1.23987 + EXIT: EXIT, 1.23988 + BREAK: BREAK, 1.23989 + CONTINUE: CONTINUE, 1.23990 + TRY: TRY, 1.23991 + CATCH: CATCH, 1.23992 + Seq: Seq, 1.23993 + Loop: Loop, 1.23994 + If: If, 1.23995 + Case: Case, 1.23996 + Switch: Switch, 1.23997 + LabelCase: LabelCase, 1.23998 + LabelSwitch: LabelSwitch, 1.23999 + Exit: Exit, 1.24000 + Break: Break, 1.24001 + Continue: Continue, 1.24002 + Try: Try, 1.24003 + Catch: Catch 1.24004 + }; 1.24005 + }(); 1.24006 + var Analysis = function () { 1.24007 + function blockSetClass(length, blockById) { 1.24008 + var BlockSet = BitSetFunctor(length); 1.24009 + var ADDRESS_BITS_PER_WORD = BlockSet.ADDRESS_BITS_PER_WORD; 1.24010 + var BITS_PER_WORD = BlockSet.BITS_PER_WORD; 1.24011 + var BIT_INDEX_MASK = BlockSet.BIT_INDEX_MASK; 1.24012 + BlockSet.singleton = function singleton(b) { 1.24013 + var bs = new BlockSet(); 1.24014 + bs.set(b.id); 1.24015 + bs.count = 1; 1.24016 + bs.dirty = 0; 1.24017 + return bs; 1.24018 + }; 1.24019 + BlockSet.fromBlocks = function fromArray(other) { 1.24020 + var bs = new BlockSet(); 1.24021 + bs.setBlocks(other); 1.24022 + return bs; 1.24023 + }; 1.24024 + var Bsp = BlockSet.prototype; 1.24025 + if (BlockSet.singleword) { 1.24026 + Bsp.forEachBlock = function forEach(fn) { 1.24027 + true; 1.24028 + var byId = blockById; 1.24029 + var word = this.bits; 1.24030 + if (word) { 1.24031 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.24032 + if (word & 1 << k) { 1.24033 + fn(byId[k]); 1.24034 + } 1.24035 + } 1.24036 + } 1.24037 + }; 1.24038 + Bsp.choose = function choose() { 1.24039 + var byId = blockById; 1.24040 + var word = this.bits; 1.24041 + if (word) { 1.24042 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.24043 + if (word & 1 << k) { 1.24044 + return byId[k]; 1.24045 + } 1.24046 + } 1.24047 + } 1.24048 + }; 1.24049 + Bsp.members = function members() { 1.24050 + var byId = blockById; 1.24051 + var set = []; 1.24052 + var word = this.bits; 1.24053 + if (word) { 1.24054 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.24055 + if (word & 1 << k) { 1.24056 + set.push(byId[k]); 1.24057 + } 1.24058 + } 1.24059 + } 1.24060 + return set; 1.24061 + }; 1.24062 + Bsp.setBlocks = function setBlocks(bs) { 1.24063 + var bits = this.bits; 1.24064 + for (var i = 0, j = bs.length; i < j; i++) { 1.24065 + var id = bs[i].id; 1.24066 + bits |= 1 << (id & BIT_INDEX_MASK); 1.24067 + } 1.24068 + this.bits = bits; 1.24069 + }; 1.24070 + } else { 1.24071 + Bsp.forEachBlock = function forEach(fn) { 1.24072 + true; 1.24073 + var byId = blockById; 1.24074 + var bits = this.bits; 1.24075 + for (var i = 0, j = bits.length; i < j; i++) { 1.24076 + var word = bits[i]; 1.24077 + if (word) { 1.24078 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.24079 + if (word & 1 << k) { 1.24080 + fn(byId[i * BITS_PER_WORD + k]); 1.24081 + } 1.24082 + } 1.24083 + } 1.24084 + } 1.24085 + }; 1.24086 + Bsp.choose = function choose() { 1.24087 + var byId = blockById; 1.24088 + var bits = this.bits; 1.24089 + for (var i = 0, j = bits.length; i < j; i++) { 1.24090 + var word = bits[i]; 1.24091 + if (word) { 1.24092 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.24093 + if (word & 1 << k) { 1.24094 + return byId[i * BITS_PER_WORD + k]; 1.24095 + } 1.24096 + } 1.24097 + } 1.24098 + } 1.24099 + }; 1.24100 + Bsp.members = function members() { 1.24101 + var byId = blockById; 1.24102 + var set = []; 1.24103 + var bits = this.bits; 1.24104 + for (var i = 0, j = bits.length; i < j; i++) { 1.24105 + var word = bits[i]; 1.24106 + if (word) { 1.24107 + for (var k = 0; k < BITS_PER_WORD; k++) { 1.24108 + if (word & 1 << k) { 1.24109 + set.push(byId[i * BITS_PER_WORD + k]); 1.24110 + } 1.24111 + } 1.24112 + } 1.24113 + } 1.24114 + return set; 1.24115 + }; 1.24116 + Bsp.setBlocks = function setBlocks(bs) { 1.24117 + var bits = this.bits; 1.24118 + for (var i = 0, j = bs.length; i < j; i++) { 1.24119 + var id = bs[i].id; 1.24120 + bits[id >> ADDRESS_BITS_PER_WORD] |= 1 << (id & BIT_INDEX_MASK); 1.24121 + } 1.24122 + }; 1.24123 + } 1.24124 + return BlockSet; 1.24125 + } 1.24126 + function Analysis(cfg, options) { 1.24127 + this.options = options || {}; 1.24128 + this.BlockSet = blockSetClass(cfg.blocks.length, cfg.blocks); 1.24129 + this.hasExceptions = false; 1.24130 + this.normalizeReachableBlocks(cfg.root); 1.24131 + } 1.24132 + Analysis.prototype = { 1.24133 + normalizeReachableBlocks: function normalizeReachableBlocks(root) { 1.24134 + true; 1.24135 + var ONCE = 1; 1.24136 + var BUNCH_OF_TIMES = 2; 1.24137 + var BlockSet = this.BlockSet; 1.24138 + var blocks = []; 1.24139 + var visited = {}; 1.24140 + var ancestors = {}; 1.24141 + var worklist = [ 1.24142 + root 1.24143 + ]; 1.24144 + var node; 1.24145 + ancestors[root.id] = true; 1.24146 + while (node = worklist.top()) { 1.24147 + if (visited[node.id]) { 1.24148 + if (visited[node.id] === ONCE) { 1.24149 + visited[node.id] = BUNCH_OF_TIMES; 1.24150 + blocks.push(node); 1.24151 + } 1.24152 + ancestors[node.id] = false; 1.24153 + worklist.pop(); 1.24154 + continue; 1.24155 + } 1.24156 + visited[node.id] = ONCE; 1.24157 + ancestors[node.id] = true; 1.24158 + var successors = node.successors; 1.24159 + for (var i = 0, j = successors.length; i < j; i++) { 1.24160 + var s = successors[i]; 1.24161 + if (ancestors[s.id]) { 1.24162 + if (!node.spbacks) { 1.24163 + node.spbacks = new BlockSet(); 1.24164 + } 1.24165 + node.spbacks.set(s.id); 1.24166 + } 1.24167 + !visited[s.id] && worklist.push(s); 1.24168 + } 1.24169 + } 1.24170 + this.blocks = blocks.reverse(); 1.24171 + }, 1.24172 + computeDominance: function computeDominance() { 1.24173 + function intersectDominators(doms, b1, b2) { 1.24174 + var finger1 = b1; 1.24175 + var finger2 = b2; 1.24176 + while (finger1 !== finger2) { 1.24177 + while (finger1 > finger2) { 1.24178 + finger1 = doms[finger1]; 1.24179 + } 1.24180 + while (finger2 > finger1) { 1.24181 + finger2 = doms[finger2]; 1.24182 + } 1.24183 + } 1.24184 + return finger1; 1.24185 + } 1.24186 + var blocks = this.blocks; 1.24187 + var n = blocks.length; 1.24188 + var doms = new Array(n); 1.24189 + doms[0] = 0; 1.24190 + var rpo = []; 1.24191 + for (var b = 0; b < n; b++) { 1.24192 + rpo[blocks[b].id] = b; 1.24193 + blocks[b].dominatees = []; 1.24194 + } 1.24195 + var changed = true; 1.24196 + while (changed) { 1.24197 + changed = false; 1.24198 + for (var b = 1; b < n; b++) { 1.24199 + var predecessors = blocks[b].predecessors; 1.24200 + var j = predecessors.length; 1.24201 + var newIdom = rpo[predecessors[0].id]; 1.24202 + if (!(newIdom in doms)) { 1.24203 + for (var i = 1; i < j; i++) { 1.24204 + newIdom = rpo[predecessors[i].id]; 1.24205 + if (newIdom in doms) { 1.24206 + break; 1.24207 + } 1.24208 + } 1.24209 + } 1.24210 + true; 1.24211 + for (var i = 0; i < j; i++) { 1.24212 + var p = rpo[predecessors[i].id]; 1.24213 + if (p === newIdom) { 1.24214 + continue; 1.24215 + } 1.24216 + if (p in doms) { 1.24217 + newIdom = intersectDominators(doms, p, newIdom); 1.24218 + } 1.24219 + } 1.24220 + if (doms[b] !== newIdom) { 1.24221 + doms[b] = newIdom; 1.24222 + changed = true; 1.24223 + } 1.24224 + } 1.24225 + } 1.24226 + blocks[0].dominator = blocks[0]; 1.24227 + var block; 1.24228 + for (var b = 1; b < n; b++) { 1.24229 + block = blocks[b]; 1.24230 + var idom = blocks[doms[b]]; 1.24231 + block.dominator = idom; 1.24232 + idom.dominatees.push(block); 1.24233 + block.npredecessors = block.predecessors.length; 1.24234 + } 1.24235 + var worklist = [ 1.24236 + blocks[0] 1.24237 + ]; 1.24238 + blocks[0].level || (blocks[0].level = 0); 1.24239 + while (block = worklist.shift()) { 1.24240 + var dominatees = block.dominatees; 1.24241 + for (var i = 0, j = dominatees.length; i < j; i++) { 1.24242 + dominatees[i].level = block.level + 1; 1.24243 + } 1.24244 + worklist.push.apply(worklist, dominatees); 1.24245 + } 1.24246 + }, 1.24247 + computeFrontiers: function computeFrontiers() { 1.24248 + var BlockSet = this.BlockSet; 1.24249 + var blocks = this.blocks; 1.24250 + for (var b = 0, n = blocks.length; b < n; b++) { 1.24251 + blocks[b].frontier = new BlockSet(); 1.24252 + } 1.24253 + for (var b = 1, n = blocks.length; b < n; b++) { 1.24254 + var block = blocks[b]; 1.24255 + var predecessors = block.predecessors; 1.24256 + if (predecessors.length >= 2) { 1.24257 + var idom = block.dominator; 1.24258 + for (var i = 0, j = predecessors.length; i < j; i++) { 1.24259 + var runner = predecessors[i]; 1.24260 + while (runner !== idom) { 1.24261 + runner.frontier.set(block.id); 1.24262 + runner = runner.dominator; 1.24263 + } 1.24264 + } 1.24265 + } 1.24266 + } 1.24267 + }, 1.24268 + analyzeControlFlow: function analyzeControlFlow() { 1.24269 + this.computeDominance(); 1.24270 + this.analyzedControlFlow = true; 1.24271 + return true; 1.24272 + }, 1.24273 + markLoops: function markLoops() { 1.24274 + if (!this.analyzedControlFlow && !this.analyzeControlFlow()) { 1.24275 + return false; 1.24276 + } 1.24277 + var BlockSet = this.BlockSet; 1.24278 + function findSCCs(root) { 1.24279 + var preorderId = 1; 1.24280 + var preorder = {}; 1.24281 + var assigned = {}; 1.24282 + var unconnectedNodes = []; 1.24283 + var pendingNodes = []; 1.24284 + var sccs = []; 1.24285 + var level = root.level + 1; 1.24286 + var worklist = [ 1.24287 + root 1.24288 + ]; 1.24289 + var node; 1.24290 + var u, s; 1.24291 + while (node = worklist.top()) { 1.24292 + if (preorder[node.id]) { 1.24293 + if (pendingNodes.peek() === node) { 1.24294 + pendingNodes.pop(); 1.24295 + var scc = []; 1.24296 + do { 1.24297 + u = unconnectedNodes.pop(); 1.24298 + assigned[u.id] = true; 1.24299 + scc.push(u); 1.24300 + } while (u !== node); 1.24301 + if (scc.length > 1 || u.spbacks && u.spbacks.get(u.id)) { 1.24302 + sccs.push(scc); 1.24303 + } 1.24304 + } 1.24305 + worklist.pop(); 1.24306 + continue; 1.24307 + } 1.24308 + preorder[node.id] = preorderId++; 1.24309 + unconnectedNodes.push(node); 1.24310 + pendingNodes.push(node); 1.24311 + var successors = node.successors; 1.24312 + for (var i = 0, j = successors.length; i < j; i++) { 1.24313 + s = successors[i]; 1.24314 + if (s.level < level) { 1.24315 + continue; 1.24316 + } 1.24317 + var sid = s.id; 1.24318 + if (!preorder[sid]) { 1.24319 + worklist.push(s); 1.24320 + } else if (!assigned[sid]) { 1.24321 + while (preorder[pendingNodes.peek().id] > preorder[sid]) { 1.24322 + pendingNodes.pop(); 1.24323 + } 1.24324 + } 1.24325 + } 1.24326 + } 1.24327 + return sccs; 1.24328 + } 1.24329 + function findLoopHeads(blocks) { 1.24330 + var heads = new BlockSet(); 1.24331 + for (var i = 0, j = blocks.length; i < j; i++) { 1.24332 + var block = blocks[i]; 1.24333 + var spbacks = block.spbacks; 1.24334 + if (!spbacks) { 1.24335 + continue; 1.24336 + } 1.24337 + var successors = block.successors; 1.24338 + for (var k = 0, l = successors.length; k < l; k++) { 1.24339 + var s = successors[k]; 1.24340 + if (spbacks.get(s.id)) { 1.24341 + heads.set(s.dominator.id); 1.24342 + } 1.24343 + } 1.24344 + } 1.24345 + return heads.members(); 1.24346 + } 1.24347 + function LoopInfo(scc, loopId) { 1.24348 + var body = new BlockSet(); 1.24349 + body.setBlocks(scc); 1.24350 + body.recount(); 1.24351 + this.id = loopId; 1.24352 + this.body = body; 1.24353 + this.exit = new BlockSet(); 1.24354 + this.save = {}; 1.24355 + this.head = new BlockSet(); 1.24356 + this.npredecessors = 0; 1.24357 + } 1.24358 + var heads = findLoopHeads(this.blocks); 1.24359 + if (heads.length <= 0) { 1.24360 + this.markedLoops = true; 1.24361 + return true; 1.24362 + } 1.24363 + var worklist = heads.sort(function (a, b) { 1.24364 + return a.level - b.level; 1.24365 + }); 1.24366 + var loopId = 0; 1.24367 + for (var n = worklist.length - 1; n >= 0; n--) { 1.24368 + var top = worklist[n]; 1.24369 + var sccs = findSCCs(top); 1.24370 + if (sccs.length === 0) { 1.24371 + continue; 1.24372 + } 1.24373 + for (var i = 0, j = sccs.length; i < j; i++) { 1.24374 + var scc = sccs[i]; 1.24375 + var loop = new LoopInfo(scc, loopId++); 1.24376 + for (var k = 0, l = scc.length; k < l; k++) { 1.24377 + var h = scc[k]; 1.24378 + if (h.level === top.level + 1 && !h.loop) { 1.24379 + h.loop = loop; 1.24380 + loop.head.set(h.id); 1.24381 + var predecessors = h.predecessors; 1.24382 + for (var pi = 0, pj = predecessors.length; pi < pj; pi++) { 1.24383 + loop.body.get(predecessors[pi].id) && h.npredecessors--; 1.24384 + } 1.24385 + loop.npredecessors += h.npredecessors; 1.24386 + } 1.24387 + } 1.24388 + for (var k = 0, l = scc.length; k < l; k++) { 1.24389 + var h = scc[k]; 1.24390 + if (h.level === top.level + 1) { 1.24391 + h.npredecessors = loop.npredecessors; 1.24392 + } 1.24393 + } 1.24394 + loop.head.recount(); 1.24395 + } 1.24396 + } 1.24397 + this.markedLoops = true; 1.24398 + return true; 1.24399 + }, 1.24400 + induceControlTree: function induceControlTree() { 1.24401 + var hasExceptions = this.hasExceptions; 1.24402 + var BlockSet = this.BlockSet; 1.24403 + function maybe(exit, save) { 1.24404 + exit.recount(); 1.24405 + if (exit.count === 0) { 1.24406 + return null; 1.24407 + } 1.24408 + exit.save = save; 1.24409 + return exit; 1.24410 + } 1.24411 + var exceptionId = this.blocks.length; 1.24412 + function induce(head, exit, save, loop, inLoopHead, lookupSwitch, fallthrough) { 1.24413 + var v = []; 1.24414 + while (head) { 1.24415 + if (head.count > 1) { 1.24416 + var exit2 = new BlockSet(); 1.24417 + var save2 = {}; 1.24418 + var cases = []; 1.24419 + var heads = head.members(); 1.24420 + for (var i = 0, j = heads.length; i < j; i++) { 1.24421 + var h = heads[i]; 1.24422 + var bid = h.id; 1.24423 + var c; 1.24424 + if (h.loop && head.contains(h.loop.head)) { 1.24425 + var loop2 = h.loop; 1.24426 + if (!loop2.induced) { 1.24427 + var lheads = loop2.head.members(); 1.24428 + var lheadsave = 0; 1.24429 + for (k = 0, l = lheads.length; k < l; k++) { 1.24430 + lheadsave += head.save[lheads[k].id]; 1.24431 + } 1.24432 + if (h.npredecessors - lheadsave > 0) { 1.24433 + h.npredecessors -= head.save[bid]; 1.24434 + h.save = head.save[bid]; 1.24435 + c = induce(h, exit2, save2, loop); 1.24436 + cases.push(new Control.LabelCase([ 1.24437 + bid 1.24438 + ], c)); 1.24439 + } else { 1.24440 + for (k = 0, l = lheads.length; k < l; k++) { 1.24441 + var lh = lheads[k]; 1.24442 + lh.npredecessors -= lheadsave; 1.24443 + lh.save = lheadsave; 1.24444 + } 1.24445 + c = induce(h, exit2, save2, loop); 1.24446 + cases.push(new Control.LabelCase(loop2.head.toArray(), c)); 1.24447 + loop2.induced = true; 1.24448 + } 1.24449 + } 1.24450 + } else { 1.24451 + h.npredecessors -= head.save[bid]; 1.24452 + h.save = head.save[bid]; 1.24453 + c = induce(h, exit2, save2, loop); 1.24454 + cases.push(new Control.LabelCase([ 1.24455 + bid 1.24456 + ], c)); 1.24457 + } 1.24458 + } 1.24459 + var pruned = []; 1.24460 + var k = 0; 1.24461 + var c; 1.24462 + for (var i = 0, j = cases.length; i < j; i++) { 1.24463 + c = cases[i]; 1.24464 + var labels = c.labels; 1.24465 + var lk = 0; 1.24466 + for (var ln = 0, nlabels = labels.length; ln < nlabels; ln++) { 1.24467 + var bid = labels[ln]; 1.24468 + if (exit2.get(bid) && heads[i].npredecessors - head.save[bid] > 0) { 1.24469 + pruned.push(bid); 1.24470 + } else { 1.24471 + labels[lk++] = bid; 1.24472 + } 1.24473 + } 1.24474 + labels.length = lk; 1.24475 + if (labels.length > 0) { 1.24476 + cases[k++] = c; 1.24477 + } 1.24478 + } 1.24479 + cases.length = k; 1.24480 + if (cases.length === 0) { 1.24481 + for (var i = 0, j = pruned.length; i < j; i++) { 1.24482 + var bid = pruned[i]; 1.24483 + save[bid] = (save[bid] || 0) + head.save[bid]; 1.24484 + exit.set(bid); 1.24485 + } 1.24486 + break; 1.24487 + } 1.24488 + v.push(new Control.LabelSwitch(cases)); 1.24489 + head = maybe(exit2, save2); 1.24490 + continue; 1.24491 + } 1.24492 + var h, bid, c; 1.24493 + if (head.count === 1) { 1.24494 + h = head.choose(); 1.24495 + bid = h.id; 1.24496 + h.npredecessors -= head.save[bid]; 1.24497 + h.save = head.save[bid]; 1.24498 + } else { 1.24499 + h = head; 1.24500 + bid = h.id; 1.24501 + } 1.24502 + if (inLoopHead) { 1.24503 + inLoopHead = false; 1.24504 + } else { 1.24505 + if (loop && !loop.body.get(bid)) { 1.24506 + h.npredecessors += h.save; 1.24507 + loop.exit.set(bid); 1.24508 + loop.save[bid] = (loop.save[bid] || 0) + h.save; 1.24509 + v.push(new Control.Break(bid, loop)); 1.24510 + break; 1.24511 + } 1.24512 + if (loop && h.loop === loop) { 1.24513 + h.npredecessors += h.save; 1.24514 + v.push(new Control.Continue(bid, loop)); 1.24515 + break; 1.24516 + } 1.24517 + if (h === fallthrough) { 1.24518 + break; 1.24519 + } 1.24520 + if (h.npredecessors > 0) { 1.24521 + h.npredecessors += h.save; 1.24522 + save[bid] = (save[bid] || 0) + h.save; 1.24523 + exit.set(bid); 1.24524 + v.push(lookupSwitch ? new Control.Break(bid, lookupSwitch) : new Control.Exit(bid)); 1.24525 + break; 1.24526 + } 1.24527 + if (h.loop) { 1.24528 + var l = h.loop; 1.24529 + var body; 1.24530 + if (l.head.count === 1) { 1.24531 + body = induce(l.head.choose(), null, null, l, true); 1.24532 + } else { 1.24533 + var lcases = []; 1.24534 + var lheads = l.head.members(); 1.24535 + for (var i = 0, j = lheads.length; i < j; i++) { 1.24536 + var lh = lheads[i]; 1.24537 + var lbid = lh.id; 1.24538 + var c = induce(lh, null, null, l, true); 1.24539 + lcases.push(new Control.LabelCase([ 1.24540 + lbid 1.24541 + ], c)); 1.24542 + } 1.24543 + body = new Control.LabelSwitch(lcases); 1.24544 + } 1.24545 + v.push(new Control.Loop(body)); 1.24546 + head = maybe(l.exit, l.save); 1.24547 + continue; 1.24548 + } 1.24549 + } 1.24550 + var sv; 1.24551 + var successors; 1.24552 + var exit2 = new BlockSet(); 1.24553 + var save2 = {}; 1.24554 + if (hasExceptions && h.hasCatches) { 1.24555 + var allsuccessors = h.successors; 1.24556 + var catchsuccessors = []; 1.24557 + successors = []; 1.24558 + for (var i = 0, j = allsuccessors.length; i < j; i++) { 1.24559 + var s = allsuccessors[i]; 1.24560 + (s.exception ? catchsuccessors : successors).push(s); 1.24561 + } 1.24562 + var catches = []; 1.24563 + for (var i = 0, j = catchsuccessors.length; i < j; i++) { 1.24564 + var t = catchsuccessors[i]; 1.24565 + t.npredecessors -= 1; 1.24566 + t.save = 1; 1.24567 + var c = induce(t, exit2, save2, loop); 1.24568 + var ex = t.exception; 1.24569 + catches.push(new Control.Catch(ex.varName, ex.typeName, c)); 1.24570 + } 1.24571 + sv = new Control.Try(h, catches); 1.24572 + } else { 1.24573 + successors = h.successors; 1.24574 + sv = h; 1.24575 + } 1.24576 + if (successors.length > 2) { 1.24577 + var cases = []; 1.24578 + var targets = successors; 1.24579 + for (var i = targets.length - 1; i >= 0; i--) { 1.24580 + var t = targets[i]; 1.24581 + t.npredecessors -= 1; 1.24582 + t.save = 1; 1.24583 + c = induce(t, exit2, save2, loop, null, h, targets[i + 1]); 1.24584 + cases.unshift(new Control.Case(i, c)); 1.24585 + } 1.24586 + cases.top().index = undefined; 1.24587 + if (hasExceptions && h.hasCatches) { 1.24588 + sv.nothingThrownLabel = exceptionId; 1.24589 + sv = new Control.Switch(sv, cases, exceptionId++); 1.24590 + } else { 1.24591 + sv = new Control.Switch(sv, cases); 1.24592 + } 1.24593 + head = maybe(exit2, save2); 1.24594 + } else if (successors.length === 2) { 1.24595 + var branch1 = h.hasFlippedSuccessors ? successors[1] : successors[0]; 1.24596 + var branch2 = h.hasFlippedSuccessors ? successors[0] : successors[1]; 1.24597 + branch1.npredecessors -= 1; 1.24598 + branch1.save = 1; 1.24599 + var c1 = induce(branch1, exit2, save2, loop); 1.24600 + branch2.npredecessors -= 1; 1.24601 + branch2.save = 1; 1.24602 + var c2 = induce(branch2, exit2, save2, loop); 1.24603 + if (hasExceptions && h.hasCatches) { 1.24604 + sv.nothingThrownLabel = exceptionId; 1.24605 + sv = new Control.If(sv, c1, c2, exceptionId++); 1.24606 + } else { 1.24607 + sv = new Control.If(sv, c1, c2); 1.24608 + } 1.24609 + head = maybe(exit2, save2); 1.24610 + } else { 1.24611 + c = successors[0]; 1.24612 + if (c) { 1.24613 + if (hasExceptions && h.hasCatches) { 1.24614 + sv.nothingThrownLabel = c.id; 1.24615 + save2[c.id] = (save2[c.id] || 0) + 1; 1.24616 + exit2.set(c.id); 1.24617 + head = maybe(exit2, save2); 1.24618 + } else { 1.24619 + c.npredecessors -= 1; 1.24620 + c.save = 1; 1.24621 + head = c; 1.24622 + } 1.24623 + } else { 1.24624 + if (hasExceptions && h.hasCatches) { 1.24625 + sv.nothingThrownLabel = -1; 1.24626 + head = maybe(exit2, save2); 1.24627 + } else { 1.24628 + head = c; 1.24629 + } 1.24630 + } 1.24631 + } 1.24632 + v.push(sv); 1.24633 + } 1.24634 + if (v.length > 1) { 1.24635 + return new Control.Seq(v); 1.24636 + } 1.24637 + return v[0]; 1.24638 + } 1.24639 + var root = this.blocks[0]; 1.24640 + this.controlTree = induce(root, new BlockSet(), {}); 1.24641 + }, 1.24642 + restructureControlFlow: function restructureControlFlow() { 1.24643 + Timer.start('Restructure Control Flow'); 1.24644 + if (!this.markedLoops && !this.markLoops()) { 1.24645 + Timer.stop(); 1.24646 + return false; 1.24647 + } 1.24648 + this.induceControlTree(); 1.24649 + this.restructuredControlFlow = true; 1.24650 + Timer.stop(); 1.24651 + return true; 1.24652 + }, 1.24653 + trace: function (writer) { 1.24654 + function bid(node) { 1.24655 + return node.id; 1.24656 + } 1.24657 + function traceBlock(block) { 1.24658 + if (!block.dominator) { 1.24659 + writer.enter('block unreachable {'); 1.24660 + } else { 1.24661 + writer.enter('block ' + block.id + (block.successors.length > 0 ? ' -> ' + block.successors.map(bid).join(',') : '') + ' {'); 1.24662 + writer.writeLn('npredecessors'.padRight(' ', 10) + block.npredecessors); 1.24663 + writer.writeLn('idom'.padRight(' ', 10) + block.dominator.id); 1.24664 + writer.writeLn('domcs'.padRight(' ', 10) + block.dominatees.map(bid).join(',')); 1.24665 + if (block.frontier) { 1.24666 + writer.writeLn('frontier'.padRight(' ', 10) + '{' + block.frontier.toArray().join(',') + '}'); 1.24667 + } 1.24668 + writer.writeLn('level'.padRight(' ', 10) + block.level); 1.24669 + } 1.24670 + if (block.loop) { 1.24671 + writer.writeLn('loop'.padRight(' ', 10) + '{' + block.loop.body.toArray().join(',') + '}'); 1.24672 + writer.writeLn(' id'.padRight(' ', 10) + block.loop.id); 1.24673 + writer.writeLn(' head'.padRight(' ', 10) + '{' + block.loop.head.toArray().join(',') + '}'); 1.24674 + writer.writeLn(' exit'.padRight(' ', 10) + '{' + block.loop.exit.toArray().join(',') + '}'); 1.24675 + writer.writeLn(' npredecessors'.padRight(' ', 10) + block.loop.npredecessors); 1.24676 + } 1.24677 + writer.writeLn(''); 1.24678 + if (block.position >= 0) { 1.24679 + for (var bci = block.position; bci <= block.end.position; bci++) { 1.24680 + writer.writeLn(('' + bci).padRight(' ', 5) + bytecodes[bci]); 1.24681 + } 1.24682 + } else { 1.24683 + writer.writeLn('abstract'); 1.24684 + } 1.24685 + writer.leave('}'); 1.24686 + } 1.24687 + var bytecodes = this.bytecodes; 1.24688 + writer.enter('analysis {'); 1.24689 + writer.enter('cfg {'); 1.24690 + this.blocks.forEach(traceBlock); 1.24691 + writer.leave('}'); 1.24692 + if (this.controlTree) { 1.24693 + writer.enter('control-tree {'); 1.24694 + this.controlTree.trace(writer); 1.24695 + writer.leave('}'); 1.24696 + } 1.24697 + writer.leave('}'); 1.24698 + }, 1.24699 + traceCFG: makeVizTrace([ 1.24700 + { 1.24701 + fn: function (n) { 1.24702 + return n.successors || []; 1.24703 + }, 1.24704 + style: '' 1.24705 + } 1.24706 + ], [ 1.24707 + { 1.24708 + fn: function (n) { 1.24709 + return n.predecessors || []; 1.24710 + }, 1.24711 + style: '' 1.24712 + } 1.24713 + ]), 1.24714 + traceDJ: makeVizTrace([ 1.24715 + { 1.24716 + fn: function (n) { 1.24717 + return n.dominatees || []; 1.24718 + }, 1.24719 + style: 'style=dashed' 1.24720 + }, 1.24721 + { 1.24722 + fn: function (n) { 1.24723 + var crosses = new this.BlockSet(); 1.24724 + crosses.setBlocks(n.successors); 1.24725 + crosses.subtract(this.BlockSet.fromBlocks(n.dominatees)); 1.24726 + n.spbacks && crosses.subtract(n.spbacks); 1.24727 + return crosses.members(); 1.24728 + }, 1.24729 + style: '' 1.24730 + }, 1.24731 + { 1.24732 + fn: function (n) { 1.24733 + return n.spbacks ? n.spbacks.members() : []; 1.24734 + }, 1.24735 + style: 'style=bold' 1.24736 + } 1.24737 + ], [ 1.24738 + { 1.24739 + fn: function (n) { 1.24740 + return n.predecessors || []; 1.24741 + }, 1.24742 + style: '' 1.24743 + } 1.24744 + ], function (idFn, writer) { 1.24745 + var root = this.bytecodes[0]; 1.24746 + var worklist = [ 1.24747 + root 1.24748 + ]; 1.24749 + var n; 1.24750 + var level = root.level; 1.24751 + var currentLevel = []; 1.24752 + while (n = worklist.shift()) { 1.24753 + if (level != n.level) { 1.24754 + writer.writeLn('{rank=same; ' + currentLevel.map(function (n) { 1.24755 + return 'block_' + idFn(n); 1.24756 + }).join(' ') + '}'); 1.24757 + currentLevel.length = 0; 1.24758 + level = n.level; 1.24759 + } 1.24760 + currentLevel.push(n); 1.24761 + worklist.push.apply(worklist, n.dominatees); 1.24762 + } 1.24763 + }) 1.24764 + }; 1.24765 + function makeVizTrace(successorFns, predecessorFns, postHook) { 1.24766 + return function (writer, name, prefix) { 1.24767 + function idFn(n) { 1.24768 + return prefix + n.id; 1.24769 + } 1.24770 + var analysis = this; 1.24771 + function bindToThis(x) { 1.24772 + x.fn = x.fn.bind(analysis); 1.24773 + } 1.24774 + prefix = prefix || ''; 1.24775 + var bytecodes = this.bytecodes; 1.24776 + if (!bytecodes) { 1.24777 + return; 1.24778 + } 1.24779 + successorFns.forEach(bindToThis); 1.24780 + predecessorFns.forEach(bindToThis); 1.24781 + writeGraphViz(writer, name.toString(), bytecodes[0], idFn, function (n) { 1.24782 + return n.successors || []; 1.24783 + }, successorFns, predecessorFns, function (n) { 1.24784 + var str = 'Block: ' + n.id + '\\l'; 1.24785 + return str; 1.24786 + }, postHook && postHook.bind(this, idFn)); 1.24787 + }; 1.24788 + } 1.24789 + return Analysis; 1.24790 + }(); 1.24791 + exports.Control = Control; 1.24792 + exports.analyze = function (cfg) { 1.24793 + var analysis = new Analysis(cfg); 1.24794 + analysis.restructureControlFlow(); 1.24795 + return analysis.controlTree; 1.24796 + }; 1.24797 +}(typeof exports === 'undefined' ? Looper = {} : exports)); 1.24798 +(function (exports) { 1.24799 + var TRACE_REGISTER_ALLOCATOR = false; 1.24800 + var T = estransform; 1.24801 + var Node = T.Node; 1.24802 + var Identifier = T.Identifier; 1.24803 + var VariableDeclaration = T.VariableDeclaration; 1.24804 + var VariableDeclarator = T.VariableDeclarator; 1.24805 + var AssignmentExpression = T.AssignmentExpression; 1.24806 + var MemberExpression = T.MemberExpression; 1.24807 + var IfStatement = T.IfStatement; 1.24808 + var WhileStatement = T.WhileStatement; 1.24809 + var FunctionDeclaration = T.FunctionDeclaration; 1.24810 + var writer = new IndentingWriter(); 1.24811 + var LinearScan = function () { 1.24812 + function Interval(id, start, end) { 1.24813 + this.id = id; 1.24814 + this.start = start; 1.24815 + this.end = end; 1.24816 + } 1.24817 + Interval.prototype.toString = function () { 1.24818 + return '[' + this.start + ',' + this.end + ']'; 1.24819 + }; 1.24820 + function linearScan(intervals, maxRegisters) { 1.24821 + this.intervals = intervals.slice(0); 1.24822 + this.maxRegisters = maxRegisters; 1.24823 + } 1.24824 + linearScan.prototype.allocate = function () { 1.24825 + var intervals = this.intervals; 1.24826 + this.intervals.sort(function (a, b) { 1.24827 + return a.start - b.start; 1.24828 + }); 1.24829 + var active = new SortedList(function (a, b) { 1.24830 + return a.end - b.end; 1.24831 + }); 1.24832 + var maxRegisters = this.maxRegisters; 1.24833 + var freeRegisters = []; 1.24834 + for (var i = maxRegisters - 1; i >= 0; i--) { 1.24835 + freeRegisters.push('R' + i); 1.24836 + } 1.24837 + intervals.forEach(function (i) { 1.24838 + expireOldIntervals(i); 1.24839 + if (active.length === maxRegisters) { 1.24840 + notImplemented('Cannot Spill'); 1.24841 + } else { 1.24842 + i.register = freeRegisters.pop(); 1.24843 + TRACE_REGISTER_ALLOCATOR && writer.writeLn('Allocate: ' + i + ' ' + i.id + ' -> ' + i.register); 1.24844 + active.push(i); 1.24845 + } 1.24846 + }); 1.24847 + function expireOldIntervals(i) { 1.24848 + active.forEach(function (j) { 1.24849 + if (j.end >= i.start) { 1.24850 + return SortedList.RETURN; 1.24851 + } 1.24852 + freeRegisters.push(j.register); 1.24853 + TRACE_REGISTER_ALLOCATOR && writer.writeLn('Release: ' + j + ' -> ' + j.register); 1.24854 + return SortedList.DELETE; 1.24855 + }); 1.24856 + } 1.24857 + }; 1.24858 + linearScan.Interval = Interval; 1.24859 + return linearScan; 1.24860 + }(); 1.24861 + function allocateRegisters(program) { 1.24862 + var scan = T.makePass('scan', 'scanNode'); 1.24863 + var label = 0; 1.24864 + Node.prototype.scan = function (o) { 1.24865 + this.position = label++; 1.24866 + return scan.apply(this, o); 1.24867 + }; 1.24868 + var variables = []; 1.24869 + var variableIndexMap = {}; 1.24870 + var identifiers = []; 1.24871 + FunctionDeclaration.prototype.scan = function () { 1.24872 + this.params.forEach(function (identifier) { 1.24873 + if (!(identifier.name in variableIndexMap)) { 1.24874 + variableIndexMap[identifier.name] = variables.length; 1.24875 + variables.push(identifier.name); 1.24876 + } 1.24877 + }); 1.24878 + this.body.scan(); 1.24879 + return this; 1.24880 + }; 1.24881 + VariableDeclarator.prototype.scan = function () { 1.24882 + this.position = label++; 1.24883 + if (!(this.id.name in variableIndexMap)) { 1.24884 + variableIndexMap[this.id.name] = variables.length; 1.24885 + variables.push(this.id.name); 1.24886 + } 1.24887 + return this; 1.24888 + }; 1.24889 + AssignmentExpression.prototype.scan = function (o) { 1.24890 + this.left.scan(o); 1.24891 + this.right.scan(o); 1.24892 + this.position = label++; 1.24893 + return this; 1.24894 + }; 1.24895 + WhileStatement.prototype.scan = function (o) { 1.24896 + this.position = label++; 1.24897 + this.test.scan(o); 1.24898 + this.body.scan(o); 1.24899 + this.afterPosition = label++; 1.24900 + return this; 1.24901 + }; 1.24902 + program.scan(); 1.24903 + TRACE_REGISTER_ALLOCATOR && writer.writeLn('Local Variables: ' + variables); 1.24904 + var Set = BitSetFunctor(variables.length); 1.24905 + var Range = BitSetFunctor(label); 1.24906 + var ranges = []; 1.24907 + for (var i = 0; i < variables.length; i++) { 1.24908 + ranges.push(new Range()); 1.24909 + } 1.24910 + function fill(range) { 1.24911 + var start = -1; 1.24912 + for (var i = 0; i < range.length; i++) { 1.24913 + if (range.get(i)) { 1.24914 + start = i; 1.24915 + break; 1.24916 + } 1.24917 + } 1.24918 + for (var i = range.length - 1; i >= 0; i--) { 1.24919 + if (range.get(i)) { 1.24920 + end = i; 1.24921 + break; 1.24922 + } 1.24923 + } 1.24924 + for (var i = start; i < end; i++) { 1.24925 + range.set(i); 1.24926 + } 1.24927 + } 1.24928 + function getRange(range) { 1.24929 + var start = -1, end = -1; 1.24930 + for (var i = 0; i < range.length; i++) { 1.24931 + if (range.get(i)) { 1.24932 + start = i; 1.24933 + break; 1.24934 + } 1.24935 + } 1.24936 + for (var i = range.length - 1; i >= 0; i--) { 1.24937 + if (range.get(i)) { 1.24938 + end = i; 1.24939 + break; 1.24940 + } 1.24941 + } 1.24942 + return [ 1.24943 + start, 1.24944 + end 1.24945 + ]; 1.24946 + } 1.24947 + function use(set, name, position) { 1.24948 + var index = variableIndexMap[name]; 1.24949 + ranges[index].set(position); 1.24950 + set.set(index); 1.24951 + } 1.24952 + function def(set, name, position) { 1.24953 + var index = variableIndexMap[name]; 1.24954 + ranges[index].set(position); 1.24955 + set.clear(index); 1.24956 + } 1.24957 + Node.prototype.markLiveness = T.makePass('markLiveness', 'markLivenessNode', true); 1.24958 + Identifier.prototype.markLiveness = function (o) { 1.24959 + var name = this.name; 1.24960 + if (name === 'undefined') { 1.24961 + return this; 1.24962 + } 1.24963 + if (o && o.isProperty) { 1.24964 + return this; 1.24965 + } 1.24966 + if (!(name in variableIndexMap)) { 1.24967 + return this; 1.24968 + } 1.24969 + identifiers.push(this); 1.24970 + var live = o.live; 1.24971 + use(live, name, this.position); 1.24972 + return this; 1.24973 + }; 1.24974 + VariableDeclarator.prototype.markLiveness = function (o) { 1.24975 + var live = o.live; 1.24976 + identifiers.push(this.id); 1.24977 + return this; 1.24978 + }; 1.24979 + IfStatement.prototype.markLiveness = function (o) { 1.24980 + var a = o.live.clone(); 1.24981 + var b = o.live.clone(); 1.24982 + this.alternate && this.alternate.markLiveness({ 1.24983 + live: a 1.24984 + }); 1.24985 + this.consequent && this.consequent.markLiveness({ 1.24986 + live: b 1.24987 + }); 1.24988 + o.live.assign(a); 1.24989 + o.live._union(b); 1.24990 + this.test.markLiveness(o); 1.24991 + return this; 1.24992 + }; 1.24993 + WhileStatement.prototype.markLiveness = function (o) { 1.24994 + var a = o.live.clone(); 1.24995 + TRACE_REGISTER_ALLOCATOR && writer.writeLn('END OF LOOP: ' + a); 1.24996 + var afterPosition = this.afterPosition; 1.24997 + do { 1.24998 + var b = a.clone(); 1.24999 + this.body.markLiveness({ 1.25000 + live: a 1.25001 + }); 1.25002 + this.test.markLiveness({ 1.25003 + live: a 1.25004 + }); 1.25005 + TRACE_REGISTER_ALLOCATOR && writer.writeLn('TOP OF LOOP: ' + a); 1.25006 + var iterate = !b.equals(a); 1.25007 + if (iterate) { 1.25008 + TRACE_REGISTER_ALLOCATOR && writer.writeLn('ITERATE'); 1.25009 + a.forEach(function (i) { 1.25010 + ranges[i].set(afterPosition); 1.25011 + }); 1.25012 + } 1.25013 + } while (iterate); 1.25014 + o.live.assign(a); 1.25015 + return this; 1.25016 + }; 1.25017 + AssignmentExpression.prototype.markLiveness = function (o) { 1.25018 + this.right.markLiveness(o); 1.25019 + if (this.left instanceof Identifier) { 1.25020 + def(o.live, this.left.name, this.position); 1.25021 + identifiers.push(this.left); 1.25022 + } else { 1.25023 + this.left.markLiveness(o); 1.25024 + } 1.25025 + return this; 1.25026 + }; 1.25027 + MemberExpression.prototype.markLiveness = function (o) { 1.25028 + if (this.computed || !(this.property instanceof Identifier)) { 1.25029 + this.property.markLiveness(o); 1.25030 + } 1.25031 + this.object.markLiveness(o); 1.25032 + return this; 1.25033 + }; 1.25034 + program.markLiveness({ 1.25035 + live: new Set() 1.25036 + }); 1.25037 + var intervals = []; 1.25038 + for (var i = 0; i < ranges.length; i++) { 1.25039 + var r = getRange(ranges[i]); 1.25040 + intervals.push(new LinearScan.Interval(i, r[0], r[1])); 1.25041 + } 1.25042 + var allocator = new LinearScan(intervals, 1024); 1.25043 + allocator.allocate(); 1.25044 + var map = createEmptyObject(); 1.25045 + for (var i = 0; i < variables.length; i++) { 1.25046 + map[variables[i]] = intervals[i].register; 1.25047 + } 1.25048 + if (true) { 1.25049 + for (var i = 0; i < identifiers.length; i++) { 1.25050 + if (identifiers[i].patched) { 1.25051 + continue; 1.25052 + } 1.25053 + identifiers[i].name = map[identifiers[i].name]; 1.25054 + identifiers[i].patched = true; 1.25055 + } 1.25056 + } 1.25057 + if (TRACE_REGISTER_ALLOCATOR) { 1.25058 + for (var i = 0; i < ranges.length; i++) { 1.25059 + fill(ranges[i]); 1.25060 + writer.writeLn(String(i).padLeft(' ', 3) + ' ' + variables[i].padRight(' ', 5) + ': ' + ranges[i].toBitString('=', ' ') + ' ' + intervals[i].register); 1.25061 + } 1.25062 + } 1.25063 + return program; 1.25064 + } 1.25065 + Transform.transform = function (program) { 1.25066 + allocateRegisters(program); 1.25067 + }; 1.25068 +}(typeof exports === 'undefined' ? Transform = {} : exports)); 1.25069 +(function (exports) { 1.25070 + var T = estransform; 1.25071 + var Literal = T.Literal; 1.25072 + var Identifier = T.Identifier; 1.25073 + var VariableDeclaration = T.VariableDeclaration; 1.25074 + var VariableDeclarator = T.VariableDeclarator; 1.25075 + var MemberExpression = T.MemberExpression; 1.25076 + var BinaryExpression = T.BinaryExpression; 1.25077 + var CallExpression = T.CallExpression; 1.25078 + var AssignmentExpression = T.AssignmentExpression; 1.25079 + var ExpressionStatement = T.ExpressionStatement; 1.25080 + var ReturnStatement = T.ReturnStatement; 1.25081 + var FunctionDeclaration = T.FunctionDeclaration; 1.25082 + var ConditionalExpression = T.ConditionalExpression; 1.25083 + var ObjectExpression = T.ObjectExpression; 1.25084 + var ArrayExpression = T.ArrayExpression; 1.25085 + var UnaryExpression = T.UnaryExpression; 1.25086 + var NewExpression = T.NewExpression; 1.25087 + var Property = T.Property; 1.25088 + var BlockStatement = T.BlockStatement; 1.25089 + var ThisExpression = T.ThisExpression; 1.25090 + var ThrowStatement = T.ThrowStatement; 1.25091 + var IfStatement = T.IfStatement; 1.25092 + var WhileStatement = T.WhileStatement; 1.25093 + var BreakStatement = T.BreakStatement; 1.25094 + var ContinueStatement = T.ContinueStatement; 1.25095 + var SwitchStatement = T.SwitchStatement; 1.25096 + var SwitchCase = T.SwitchCase; 1.25097 + var Block = IR.Block; 1.25098 + var Operator = IR.Operator; 1.25099 + var Projection = IR.Projection; 1.25100 + var Start = IR.Start; 1.25101 + var Control = Looper.Control; 1.25102 + var Variable = IR.Variable; 1.25103 + Control.Break.prototype.compile = function (cx, state) { 1.25104 + return cx.compileBreak(this, state); 1.25105 + }; 1.25106 + Control.Continue.prototype.compile = function (cx, state) { 1.25107 + return cx.compileContinue(this, state); 1.25108 + }; 1.25109 + Control.Exit.prototype.compile = function (cx, state) { 1.25110 + return cx.compileExit(this, state); 1.25111 + }; 1.25112 + Control.LabelSwitch.prototype.compile = function (cx, state) { 1.25113 + return cx.compileLabelSwitch(this, state); 1.25114 + }; 1.25115 + Control.Seq.prototype.compile = function (cx, state) { 1.25116 + return cx.compileSequence(this, state); 1.25117 + }; 1.25118 + Block.prototype.compile = function (cx, state) { 1.25119 + return cx.compileBlock(this, state); 1.25120 + }; 1.25121 + Control.Loop.prototype.compile = function (cx, state) { 1.25122 + return cx.compileLoop(this, state); 1.25123 + }; 1.25124 + Control.Switch.prototype.compile = function (cx, state) { 1.25125 + return cx.compileSwitch(this, state); 1.25126 + }; 1.25127 + Control.If.prototype.compile = function (cx, state) { 1.25128 + return cx.compileIf(this, state); 1.25129 + }; 1.25130 + Control.Try.prototype.compile = function (cx, state) { 1.25131 + return cx.compileTry(this, state); 1.25132 + }; 1.25133 + function constant(value) { 1.25134 + if (typeof value === 'string' || value === null || value === true || value === false) { 1.25135 + return new Literal(value); 1.25136 + } else if (value === undefined) { 1.25137 + return new Identifier('undefined'); 1.25138 + } else if (typeof value === 'object' || typeof value === 'function') { 1.25139 + return new Identifier(objectConstantName(value)); 1.25140 + } else if (typeof value === 'number' && isNaN(value)) { 1.25141 + return new Identifier('NaN'); 1.25142 + } else if (value === Infinity) { 1.25143 + return new Identifier('Infinity'); 1.25144 + } else if (value === -Infinity) { 1.25145 + return new UnaryExpression('-', new Identifier('Infinity')); 1.25146 + } else if (typeof value === 'number' && 1 / value < 0) { 1.25147 + return new UnaryExpression('-', new Literal(Math.abs(value))); 1.25148 + } else if (typeof value === 'number') { 1.25149 + return new Literal(value); 1.25150 + } else { 1.25151 + unexpected('Cannot emit constant for value: ', value); 1.25152 + } 1.25153 + } 1.25154 + function id(name) { 1.25155 + true; 1.25156 + return new Identifier(name); 1.25157 + } 1.25158 + function isIdentifierStart(c) { 1.25159 + return c === '$' || c === '_' || c === '\\' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z'; 1.25160 + } 1.25161 + function isIdentifierPart(c) { 1.25162 + return c === '$' || c === '_' || c === '\\' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9'; 1.25163 + } 1.25164 + function isIdentifierName(s) { 1.25165 + if (!isIdentifierStart(s[0])) { 1.25166 + return false; 1.25167 + } 1.25168 + for (var i = 1; i < s.length; i++) { 1.25169 + if (!isIdentifierPart(s[i])) { 1.25170 + return false; 1.25171 + } 1.25172 + } 1.25173 + return true; 1.25174 + } 1.25175 + function property(obj) { 1.25176 + for (var i = 1; i < arguments.length; i++) { 1.25177 + var x = arguments[i]; 1.25178 + if (typeof x === 'string') { 1.25179 + if (isIdentifierName(x)) { 1.25180 + obj = new MemberExpression(obj, new Identifier(x), false); 1.25181 + } else { 1.25182 + obj = new MemberExpression(obj, new Literal(x), true); 1.25183 + } 1.25184 + } else if (x instanceof Literal && isIdentifierName(x.value)) { 1.25185 + obj = new MemberExpression(obj, new Identifier(x.value), false); 1.25186 + } else { 1.25187 + obj = new MemberExpression(obj, x, true); 1.25188 + } 1.25189 + } 1.25190 + return obj; 1.25191 + } 1.25192 + function call(callee, args) { 1.25193 + true; 1.25194 + true; 1.25195 + return new CallExpression(callee, args); 1.25196 + } 1.25197 + function callCall(callee, object, args) { 1.25198 + return call(property(callee, 'call'), [ 1.25199 + object 1.25200 + ].concat(args)); 1.25201 + } 1.25202 + function assignment(left, right) { 1.25203 + true; 1.25204 + return new AssignmentExpression(left, '=', right); 1.25205 + } 1.25206 + function variableDeclaration(declarations) { 1.25207 + return new VariableDeclaration('var', declarations); 1.25208 + } 1.25209 + function negate(node) { 1.25210 + if (node instanceof Constant) { 1.25211 + if (node.value === true || node.value === false) { 1.25212 + return constant(!node.value); 1.25213 + } 1.25214 + } else if (node instanceof Identifier) { 1.25215 + return new UnaryExpression(Operator.FALSE.name, node); 1.25216 + } 1.25217 + true; 1.25218 + var left = node instanceof BinaryExpression ? node.left : node.argument; 1.25219 + var right = node.right; 1.25220 + var operator = Operator.fromName(node.operator); 1.25221 + if (operator === Operator.EQ && right instanceof Literal && right.value === false) { 1.25222 + return left; 1.25223 + } 1.25224 + if (operator === Operator.FALSE) { 1.25225 + return left; 1.25226 + } 1.25227 + if (operator.not) { 1.25228 + if (node instanceof BinaryExpression) { 1.25229 + return new BinaryExpression(operator.not.name, left, right); 1.25230 + } else { 1.25231 + return new UnaryExpression(operator.not.name, left); 1.25232 + } 1.25233 + } 1.25234 + return new UnaryExpression(Operator.FALSE.name, node); 1.25235 + } 1.25236 + function Context() { 1.25237 + this.label = new Variable('$L'); 1.25238 + this.variables = []; 1.25239 + this.parameters = []; 1.25240 + } 1.25241 + Context.prototype.useVariable = function (variable) { 1.25242 + true; 1.25243 + return this.variables.pushUnique(variable); 1.25244 + }; 1.25245 + Context.prototype.useParameter = function (parameter) { 1.25246 + return this.parameters[parameter.index] = parameter; 1.25247 + }; 1.25248 + Context.prototype.compileLabelBody = function compileLabelBody(node) { 1.25249 + var body = []; 1.25250 + if (node.label !== undefined) { 1.25251 + this.useVariable(this.label); 1.25252 + body.push(new ExpressionStatement(assignment(id(this.label.name), new Literal(node.label)))); 1.25253 + } 1.25254 + return body; 1.25255 + }; 1.25256 + Context.prototype.compileBreak = function compileBreak(node) { 1.25257 + var body = this.compileLabelBody(node); 1.25258 + body.push(new BreakStatement(null)); 1.25259 + return new BlockStatement(body); 1.25260 + }; 1.25261 + Context.prototype.compileContinue = function compileContinue(node) { 1.25262 + var body = this.compileLabelBody(node); 1.25263 + body.push(new ContinueStatement(null)); 1.25264 + return new BlockStatement(body); 1.25265 + }; 1.25266 + Context.prototype.compileExit = function compileExit(node) { 1.25267 + return new BlockStatement(this.compileLabelBody(node)); 1.25268 + }; 1.25269 + Context.prototype.compileIf = function compileIf(node) { 1.25270 + var cr = node.cond.compile(this); 1.25271 + var tr = null, er = null; 1.25272 + if (node.then) { 1.25273 + tr = node.then.compile(this); 1.25274 + } 1.25275 + if (node.else) { 1.25276 + er = node.else.compile(this); 1.25277 + } 1.25278 + var condition = compileValue(cr.end.predicate, this); 1.25279 + condition = node.negated ? negate(condition) : condition; 1.25280 + cr.body.push(new IfStatement(condition, tr || new BlockStatement([]), er || null)); 1.25281 + return cr; 1.25282 + }; 1.25283 + Context.prototype.compileSwitch = function compileSwitch(node) { 1.25284 + var dr = node.determinant.compile(this); 1.25285 + var cases = []; 1.25286 + node.cases.forEach(function (x) { 1.25287 + var br; 1.25288 + if (x.body) { 1.25289 + br = x.body.compile(this); 1.25290 + } 1.25291 + var test = typeof x.index === 'number' ? new Literal(x.index) : undefined; 1.25292 + cases.push(new SwitchCase(test, br ? [ 1.25293 + br 1.25294 + ] : [])); 1.25295 + }, this); 1.25296 + var determinant = compileValue(dr.end.determinant, this); 1.25297 + dr.body.push(new SwitchStatement(determinant, cases, false)); 1.25298 + return dr; 1.25299 + }; 1.25300 + Context.prototype.compileLabelSwitch = function compileLabelSwitch(node) { 1.25301 + var statement = null; 1.25302 + var labelName = id(this.label.name); 1.25303 + function compileLabelTest(labelID) { 1.25304 + true; 1.25305 + return new BinaryExpression('===', labelName, new Literal(labelID)); 1.25306 + } 1.25307 + for (var i = node.cases.length - 1; i >= 0; i--) { 1.25308 + var c = node.cases[i]; 1.25309 + var labels = c.labels; 1.25310 + var labelTest = compileLabelTest(labels[0]); 1.25311 + for (var j = 1; j < labels.length; j++) { 1.25312 + labelTest = new BinaryExpression('||', labelTest, compileLabelTest(labels[j])); 1.25313 + } 1.25314 + statement = new IfStatement(labelTest, c.body ? c.body.compile(this) : new BlockStatement(), statement); 1.25315 + } 1.25316 + return statement; 1.25317 + }; 1.25318 + Context.prototype.compileLoop = function compileLoop(node) { 1.25319 + var br = node.body.compile(this); 1.25320 + return new WhileStatement(constant(true), br); 1.25321 + }; 1.25322 + Context.prototype.compileSequence = function compileSequence(node) { 1.25323 + var cx = this; 1.25324 + var body = []; 1.25325 + node.body.forEach(function (x) { 1.25326 + var result = x.compile(cx); 1.25327 + if (result instanceof BlockStatement) { 1.25328 + body = body.concat(result.body); 1.25329 + } else { 1.25330 + body.push(result); 1.25331 + } 1.25332 + }); 1.25333 + return new BlockStatement(body); 1.25334 + }; 1.25335 + Context.prototype.compileBlock = function compileBlock(block) { 1.25336 + var body = []; 1.25337 + for (var i = 1; i < block.nodes.length - 1; i++) { 1.25338 + var node = block.nodes[i]; 1.25339 + var statement; 1.25340 + var to; 1.25341 + var from; 1.25342 + if (node instanceof IR.Throw) { 1.25343 + statement = compileValue(node, this, true); 1.25344 + } else { 1.25345 + if (node instanceof IR.Move) { 1.25346 + to = id(node.to.name); 1.25347 + this.useVariable(node.to); 1.25348 + from = compileValue(node.from, this); 1.25349 + } else { 1.25350 + if (node.variable) { 1.25351 + to = id(node.variable.name); 1.25352 + this.useVariable(node.variable); 1.25353 + } else { 1.25354 + to = null; 1.25355 + } 1.25356 + from = compileValue(node, this, true); 1.25357 + } 1.25358 + if (to) { 1.25359 + statement = new ExpressionStatement(assignment(to, from)); 1.25360 + } else { 1.25361 + statement = new ExpressionStatement(from); 1.25362 + } 1.25363 + } 1.25364 + body.push(statement); 1.25365 + } 1.25366 + var end = block.nodes.last(); 1.25367 + if (end instanceof IR.Stop) { 1.25368 + body.push(new ReturnStatement(compileValue(end.argument, this))); 1.25369 + } 1.25370 + var result = new BlockStatement(body); 1.25371 + result.end = block.nodes.last(); 1.25372 + true; 1.25373 + return result; 1.25374 + }; 1.25375 + function compileValue(value, cx, noVariable) { 1.25376 + true; 1.25377 + true; 1.25378 + true; 1.25379 + true; 1.25380 + if (noVariable || !value.variable) { 1.25381 + var node = value.compile(cx); 1.25382 + return node; 1.25383 + } 1.25384 + true; 1.25385 + return id(value.variable.name); 1.25386 + } 1.25387 + function compileMultiname(name, cx) { 1.25388 + return [ 1.25389 + compileValue(name.namespaces, cx), 1.25390 + compileValue(name.name, cx), 1.25391 + constant(name.flags) 1.25392 + ]; 1.25393 + } 1.25394 + function isArray(array) { 1.25395 + return array instanceof Array; 1.25396 + } 1.25397 + function compileValues(values, cx) { 1.25398 + true; 1.25399 + return values.map(function (value) { 1.25400 + return compileValue(value, cx); 1.25401 + }); 1.25402 + } 1.25403 + IR.Parameter.prototype.compile = function (cx) { 1.25404 + cx.useParameter(this); 1.25405 + return id(this.name); 1.25406 + }; 1.25407 + IR.Constant.prototype.compile = function (cx) { 1.25408 + return constant(this.value); 1.25409 + }; 1.25410 + IR.Variable.prototype.compile = function (cx) { 1.25411 + return id(this.name); 1.25412 + }; 1.25413 + IR.Phi.prototype.compile = function (cx) { 1.25414 + true; 1.25415 + return compileValue(this.variable, cx); 1.25416 + }; 1.25417 + IR.ASScope.prototype.compile = function (cx) { 1.25418 + var parent = compileValue(this.parent, cx); 1.25419 + var object = compileValue(this.object, cx); 1.25420 + var isWith = new Literal(this.isWith); 1.25421 + return new NewExpression(id('Scope'), [ 1.25422 + parent, 1.25423 + object, 1.25424 + isWith 1.25425 + ]); 1.25426 + }; 1.25427 + IR.ASFindProperty.prototype.compile = function (cx) { 1.25428 + var scope = compileValue(this.scope, cx); 1.25429 + var name = compileMultiname(this.name, cx); 1.25430 + var domain = compileValue(this.domain, cx); 1.25431 + var strict = new Literal(this.strict); 1.25432 + return call(property(scope, 'findScopeProperty'), name.concat([ 1.25433 + domain, 1.25434 + strict 1.25435 + ])); 1.25436 + }; 1.25437 + IR.ASGetProperty.prototype.compile = function (cx) { 1.25438 + var object = compileValue(this.object, cx); 1.25439 + if (this.flags & IR.Flags.INDEXED) { 1.25440 + true; 1.25441 + return call(property(object, 'asGetNumericProperty'), [ 1.25442 + compileValue(this.name.name, cx) 1.25443 + ]); 1.25444 + } else if (this.flags & IR.Flags.RESOLVED) { 1.25445 + return call(property(object, 'asGetResolvedStringProperty'), [ 1.25446 + compileValue(this.name, cx) 1.25447 + ]); 1.25448 + } 1.25449 + var name = compileMultiname(this.name, cx); 1.25450 + var isMethod = new Literal(this.flags & IR.Flags.IS_METHOD); 1.25451 + return call(property(object, 'asGetProperty'), name.concat(isMethod)); 1.25452 + }; 1.25453 + IR.ASGetSuper.prototype.compile = function (cx) { 1.25454 + var scope = compileValue(this.scope, cx); 1.25455 + var object = compileValue(this.object, cx); 1.25456 + var name = compileMultiname(this.name, cx); 1.25457 + return call(property(object, 'asGetSuper'), [ 1.25458 + scope 1.25459 + ].concat(name)); 1.25460 + }; 1.25461 + IR.Latch.prototype.compile = function (cx) { 1.25462 + return new ConditionalExpression(compileValue(this.condition, cx), compileValue(this.left, cx), compileValue(this.right, cx)); 1.25463 + }; 1.25464 + IR.Unary.prototype.compile = function (cx) { 1.25465 + return new UnaryExpression(this.operator.name, compileValue(this.argument, cx)); 1.25466 + }; 1.25467 + IR.Copy.prototype.compile = function (cx) { 1.25468 + return compileValue(this.argument, cx); 1.25469 + }; 1.25470 + IR.Binary.prototype.compile = function (cx) { 1.25471 + var left = compileValue(this.left, cx); 1.25472 + var right = compileValue(this.right, cx); 1.25473 + if (this.operator === Operator.AS_ADD) { 1.25474 + return call(id('asAdd'), [ 1.25475 + left, 1.25476 + right 1.25477 + ]); 1.25478 + } 1.25479 + return new BinaryExpression(this.operator.name, left, right); 1.25480 + }; 1.25481 + IR.CallProperty.prototype.compile = function (cx) { 1.25482 + var object = compileValue(this.object, cx); 1.25483 + var name = compileValue(this.name, cx); 1.25484 + var callee = property(object, name); 1.25485 + var args = this.args.map(function (arg) { 1.25486 + return compileValue(arg, cx); 1.25487 + }); 1.25488 + if (this.flags & IR.Flags.PRISTINE) { 1.25489 + return call(callee, args); 1.25490 + } else { 1.25491 + return callCall(callee, object, args); 1.25492 + } 1.25493 + }; 1.25494 + IR.ASCallProperty.prototype.compile = function (cx) { 1.25495 + var object = compileValue(this.object, cx); 1.25496 + var args = this.args.map(function (arg) { 1.25497 + return compileValue(arg, cx); 1.25498 + }); 1.25499 + if (this.flags & IR.Flags.RESOLVED) { 1.25500 + return call(property(object, 'asCallResolvedStringProperty'), [ 1.25501 + compileValue(this.name, cx), 1.25502 + new Literal(this.isLex), 1.25503 + new ArrayExpression(args) 1.25504 + ]); 1.25505 + } 1.25506 + var name = compileMultiname(this.name, cx); 1.25507 + return call(property(object, 'asCallProperty'), name.concat([ 1.25508 + new Literal(this.isLex), 1.25509 + new ArrayExpression(args) 1.25510 + ])); 1.25511 + }; 1.25512 + IR.ASCallSuper.prototype.compile = function (cx) { 1.25513 + var scope = compileValue(this.scope, cx); 1.25514 + var object = compileValue(this.object, cx); 1.25515 + var args = this.args.map(function (arg) { 1.25516 + return compileValue(arg, cx); 1.25517 + }); 1.25518 + var name = compileMultiname(this.name, cx); 1.25519 + return call(property(object, 'asCallSuper'), [ 1.25520 + scope 1.25521 + ].concat(name).concat(new ArrayExpression(args))); 1.25522 + }; 1.25523 + IR.Call.prototype.compile = function (cx) { 1.25524 + var args = this.args.map(function (arg) { 1.25525 + return compileValue(arg, cx); 1.25526 + }); 1.25527 + var callee = compileValue(this.callee, cx); 1.25528 + var object; 1.25529 + if (this.object) { 1.25530 + object = compileValue(this.object, cx); 1.25531 + } else { 1.25532 + object = new Literal(null); 1.25533 + } 1.25534 + if (false && this.pristine && (this.callee instanceof IR.GetProperty && this.callee.object === this.object) || this.object === null) { 1.25535 + return call(callee, args); 1.25536 + } else { 1.25537 + return callCall(callee, object, args); 1.25538 + } 1.25539 + }; 1.25540 + IR.ASNew.prototype.compile = function (cx) { 1.25541 + var args = this.args.map(function (arg) { 1.25542 + return compileValue(arg, cx); 1.25543 + }); 1.25544 + var callee = compileValue(this.callee, cx); 1.25545 + callee = property(callee, 'instanceConstructor'); 1.25546 + return new NewExpression(callee, args); 1.25547 + }; 1.25548 + IR.This.prototype.compile = function (cx) { 1.25549 + return new ThisExpression(); 1.25550 + }; 1.25551 + IR.Throw.prototype.compile = function (cx) { 1.25552 + var argument = compileValue(this.argument, cx); 1.25553 + return new ThrowStatement(argument); 1.25554 + }; 1.25555 + IR.Arguments.prototype.compile = function (cx) { 1.25556 + return id('arguments'); 1.25557 + }; 1.25558 + IR.ASGlobal.prototype.compile = function (cx) { 1.25559 + var scope = compileValue(this.scope, cx); 1.25560 + return property(scope, 'global', 'object'); 1.25561 + }; 1.25562 + IR.ASSetProperty.prototype.compile = function (cx) { 1.25563 + var object = compileValue(this.object, cx); 1.25564 + var value = compileValue(this.value, cx); 1.25565 + if (this.flags & IR.Flags.INDEXED) { 1.25566 + return call(property(object, 'asSetNumericProperty'), [ 1.25567 + compileValue(this.name.name, cx), 1.25568 + value 1.25569 + ]); 1.25570 + } 1.25571 + var name = compileMultiname(this.name, cx); 1.25572 + return call(property(object, 'asSetProperty'), name.concat(value)); 1.25573 + }; 1.25574 + IR.ASSetSuper.prototype.compile = function (cx) { 1.25575 + var scope = compileValue(this.scope, cx); 1.25576 + var object = compileValue(this.object, cx); 1.25577 + var name = compileMultiname(this.name, cx); 1.25578 + var value = compileValue(this.value, cx); 1.25579 + return call(property(object, 'asSetSuper'), [ 1.25580 + scope 1.25581 + ].concat(name).concat([ 1.25582 + value 1.25583 + ])); 1.25584 + }; 1.25585 + IR.ASDeleteProperty.prototype.compile = function (cx) { 1.25586 + var object = compileValue(this.object, cx); 1.25587 + var name = compileMultiname(this.name, cx); 1.25588 + return call(property(object, 'asDeleteProperty'), name); 1.25589 + }; 1.25590 + IR.ASHasProperty.prototype.compile = function (cx) { 1.25591 + var object = compileValue(this.object, cx); 1.25592 + var name = compileMultiname(this.name, cx); 1.25593 + return call(property(object, 'asHasProperty'), name); 1.25594 + }; 1.25595 + IR.GlobalProperty.prototype.compile = function (cx) { 1.25596 + return id(this.name); 1.25597 + }; 1.25598 + IR.GetProperty.prototype.compile = function (cx) { 1.25599 + var object = compileValue(this.object, cx); 1.25600 + var name = compileValue(this.name, cx); 1.25601 + return property(object, name); 1.25602 + }; 1.25603 + IR.SetProperty.prototype.compile = function (cx) { 1.25604 + var object = compileValue(this.object, cx); 1.25605 + var name = compileValue(this.name, cx); 1.25606 + var value = compileValue(this.value, cx); 1.25607 + return assignment(property(object, name), value); 1.25608 + }; 1.25609 + IR.ASGetDescendants.prototype.compile = function (cx) { 1.25610 + var object = compileValue(this.object, cx); 1.25611 + var name = compileValue(this.name, cx); 1.25612 + return call(id('getDescendants'), [ 1.25613 + object, 1.25614 + name 1.25615 + ]); 1.25616 + }; 1.25617 + IR.ASSetSlot.prototype.compile = function (cx) { 1.25618 + var object = compileValue(this.object, cx); 1.25619 + var name = compileValue(this.name, cx); 1.25620 + var value = compileValue(this.value, cx); 1.25621 + return call(id('asSetSlot'), [ 1.25622 + object, 1.25623 + name, 1.25624 + value 1.25625 + ]); 1.25626 + }; 1.25627 + IR.ASGetSlot.prototype.compile = function (cx) { 1.25628 + var object = compileValue(this.object, cx); 1.25629 + var name = compileValue(this.name, cx); 1.25630 + return call(id('asGetSlot'), [ 1.25631 + object, 1.25632 + name 1.25633 + ]); 1.25634 + }; 1.25635 + IR.Projection.prototype.compile = function (cx) { 1.25636 + true; 1.25637 + true; 1.25638 + return compileValue(this.argument.scope, cx); 1.25639 + }; 1.25640 + IR.NewArray.prototype.compile = function (cx) { 1.25641 + return new ArrayExpression(compileValues(this.elements, cx)); 1.25642 + }; 1.25643 + IR.NewObject.prototype.compile = function (cx) { 1.25644 + var properties = this.properties.map(function (property) { 1.25645 + var key = compileValue(property.key, cx); 1.25646 + var value = compileValue(property.value, cx); 1.25647 + return new Property(key, value, 'init'); 1.25648 + }); 1.25649 + return new ObjectExpression(properties); 1.25650 + }; 1.25651 + IR.ASNewActivation.prototype.compile = function (cx) { 1.25652 + var methodInfo = compileValue(this.methodInfo, cx); 1.25653 + return call(id('asCreateActivation'), [ 1.25654 + methodInfo 1.25655 + ]); 1.25656 + }; 1.25657 + IR.ASMultiname.prototype.compile = function (cx) { 1.25658 + var namespaces = compileValue(this.namespaces, cx); 1.25659 + var name = compileValue(this.name, cx); 1.25660 + return call(id('createName'), [ 1.25661 + namespaces, 1.25662 + name 1.25663 + ]); 1.25664 + }; 1.25665 + function generateSource(node) { 1.25666 + return escodegen.generate(node, { 1.25667 + base: '', 1.25668 + indent: ' ', 1.25669 + comment: true, 1.25670 + format: { 1.25671 + compact: false 1.25672 + } 1.25673 + }); 1.25674 + } 1.25675 + function generate(cfg, useRegisterAllocator) { 1.25676 + Timer.start('Looper'); 1.25677 + var root = Looper.analyze(cfg); 1.25678 + Timer.stop(); 1.25679 + var writer = new IndentingWriter(); 1.25680 + var cx = new Context(); 1.25681 + Timer.start('Construct AST'); 1.25682 + var code = root.compile(cx); 1.25683 + Timer.stop(); 1.25684 + var parameters = []; 1.25685 + for (var i = 0; i < cx.parameters.length; i++) { 1.25686 + var name = cx.parameters[i] ? cx.parameters[i].name : '_' + i; 1.25687 + parameters.push(id(name)); 1.25688 + } 1.25689 + if (cx.variables.length) { 1.25690 + Counter.count('Backend: Locals', cx.variables.length); 1.25691 + var variables = variableDeclaration(cx.variables.map(function (variable) { 1.25692 + return new VariableDeclarator(id(variable.name)); 1.25693 + })); 1.25694 + code.body.unshift(variables); 1.25695 + } 1.25696 + var node = new FunctionDeclaration(id('fn'), parameters, code); 1.25697 + if (useRegisterAllocator) { 1.25698 + if (c4TraceLevel.value > 0) { 1.25699 + writer.writeLn('=== BEFORE ==============================='); 1.25700 + writer.writeLn(generateSource(node)); 1.25701 + writer.writeLn('=== TRANSFORMING ========================='); 1.25702 + } 1.25703 + Transform.transform(node); 1.25704 + if (c4TraceLevel.value > 0) { 1.25705 + writer.writeLn('=== AFTER ================================'); 1.25706 + writer.writeLn(generateSource(node)); 1.25707 + writer.writeLn('=========================================='); 1.25708 + } 1.25709 + var body = generateSource(code); 1.25710 + return { 1.25711 + parameters: parameters.map(function (p) { 1.25712 + return p.name; 1.25713 + }), 1.25714 + body: body 1.25715 + }; 1.25716 + } 1.25717 + Timer.start('Serialize AST'); 1.25718 + var source = generateSource(code); 1.25719 + Timer.stop(); 1.25720 + return { 1.25721 + parameters: parameters.map(function (p) { 1.25722 + return p.name; 1.25723 + }), 1.25724 + body: source 1.25725 + }; 1.25726 + } 1.25727 + Backend.generate = generate; 1.25728 +}(typeof exports === 'undefined' ? Backend = {} : exports)); 1.25729 +var Shumway; 1.25730 +(function (Shumway) { 1.25731 + (function (AVM2) { 1.25732 + (function (Runtime) { 1.25733 + var Multiname = Shumway.AVM2.ABC.Multiname; 1.25734 + var Namespace = Shumway.AVM2.ABC.Namespace; 1.25735 + var ClassInfo = Shumway.AVM2.ABC.ClassInfo; 1.25736 + var InstanceInfo = Shumway.AVM2.ABC.InstanceInfo; 1.25737 + var Trait = Shumway.AVM2.ABC.Trait; 1.25738 + var IndentingWriter = Shumway.IndentingWriter; 1.25739 + var createMap = Shumway.ObjectUtilities.createMap; 1.25740 + var defineNonEnumerableGetterOrSetter = Shumway.ObjectUtilities.defineNonEnumerableGetterOrSetter; 1.25741 + var defineNonEnumerableProperty = Shumway.ObjectUtilities.defineNonEnumerableProperty; 1.25742 + var defineReadOnlyProperty = Shumway.ObjectUtilities.defineReadOnlyProperty; 1.25743 + var bindSafely = Shumway.FunctionUtilities.bindSafely; 1.25744 + var vmNextTrampolineId = 1; 1.25745 + var vmNextMemoizerId = 1; 1.25746 + function getMethodOverrideKey(methodInfo) { 1.25747 + var key; 1.25748 + if (methodInfo.holder instanceof ClassInfo) { 1.25749 + key = 'static ' + methodInfo.holder.instanceInfo.name.getOriginalName() + '::' + methodInfo.name.getOriginalName(); 1.25750 + } else if (methodInfo.holder instanceof InstanceInfo) { 1.25751 + key = methodInfo.holder.name.getOriginalName() + '::' + methodInfo.name.getOriginalName(); 1.25752 + } else { 1.25753 + key = methodInfo.name.getOriginalName(); 1.25754 + } 1.25755 + return key; 1.25756 + } 1.25757 + Runtime.getMethodOverrideKey = getMethodOverrideKey; 1.25758 + function checkMethodOverrides(methodInfo) { 1.25759 + if (methodInfo.name) { 1.25760 + var key = getMethodOverrideKey(methodInfo); 1.25761 + if (key in Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES) { 1.25762 + Shumway.Debug.warning('Overriding Method: ' + key); 1.25763 + return Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES[key]; 1.25764 + } 1.25765 + } 1.25766 + } 1.25767 + Runtime.checkMethodOverrides = checkMethodOverrides; 1.25768 + function makeTrampoline(forward, parameterLength, description) { 1.25769 + true; 1.25770 + return function trampolineContext() { 1.25771 + var target = null; 1.25772 + var trampoline = function execute() { 1.25773 + if (Shumway.AVM2.Runtime.traceExecution.value >= 3) { 1.25774 + log('Trampolining'); 1.25775 + } 1.25776 + Counter.count('Executing Trampoline'); 1.25777 + Shumway.AVM2.Runtime.traceCallExecution.value > 1 && callWriter.writeLn('Trampoline: ' + description); 1.25778 + if (!target) { 1.25779 + target = forward(trampoline); 1.25780 + true; 1.25781 + } 1.25782 + return target.apply(this, arguments); 1.25783 + }; 1.25784 + trampoline.trigger = function trigger() { 1.25785 + Counter.count('Triggering Trampoline'); 1.25786 + if (!target) { 1.25787 + target = forward(trampoline); 1.25788 + true; 1.25789 + } 1.25790 + }; 1.25791 + trampoline.isTrampoline = true; 1.25792 + trampoline.debugName = 'Trampoline #' + vmNextTrampolineId++; 1.25793 + defineReadOnlyProperty(trampoline, Shumway.AVM2.Runtime.VM_LENGTH, parameterLength); 1.25794 + return trampoline; 1.25795 + }(); 1.25796 + } 1.25797 + Runtime.makeTrampoline = makeTrampoline; 1.25798 + function makeMemoizer(qn, target) { 1.25799 + function memoizer() { 1.25800 + Counter.count('Runtime: Memoizing'); 1.25801 + if (Shumway.AVM2.Runtime.traceExecution.value >= 3) { 1.25802 + log('Memoizing: ' + qn); 1.25803 + } 1.25804 + Shumway.AVM2.Runtime.traceCallExecution.value > 1 && callWriter.writeLn('Memoizing: ' + qn); 1.25805 + if (Shumway.AVM2.Runtime.isNativePrototype(this)) { 1.25806 + Counter.count('Runtime: Method Closures'); 1.25807 + return bindSafely(target.value, this); 1.25808 + } 1.25809 + if (isTrampoline(target.value)) { 1.25810 + target.value.trigger(); 1.25811 + } 1.25812 + true; 1.25813 + var mc = null; 1.25814 + if (Shumway.AVM2.Runtime.isClass(this)) { 1.25815 + Counter.count('Runtime: Static Method Closures'); 1.25816 + mc = bindSafely(target.value, this); 1.25817 + defineReadOnlyProperty(this, qn, mc); 1.25818 + return mc; 1.25819 + } 1.25820 + if (Object.prototype.hasOwnProperty.call(this, qn)) { 1.25821 + var pd = Object.getOwnPropertyDescriptor(this, qn); 1.25822 + if (pd.get) { 1.25823 + Counter.count('Runtime: Method Closures'); 1.25824 + return bindSafely(target.value, this); 1.25825 + } 1.25826 + Counter.count('Runtime: Unpatched Memoizer'); 1.25827 + return this[qn]; 1.25828 + } 1.25829 + mc = bindSafely(target.value, this); 1.25830 + mc.methodInfo = target.value.methodInfo; 1.25831 + defineReadOnlyProperty(mc, Multiname.getPublicQualifiedName('prototype'), null); 1.25832 + defineReadOnlyProperty(this, qn, mc); 1.25833 + return mc; 1.25834 + } 1.25835 + var m = memoizer; 1.25836 + Counter.count('Runtime: Memoizers'); 1.25837 + m.isMemoizer = true; 1.25838 + m.debugName = 'Memoizer #' + vmNextMemoizerId++; 1.25839 + return m; 1.25840 + } 1.25841 + Runtime.makeMemoizer = makeMemoizer; 1.25842 + function isTrampoline(fn) { 1.25843 + true; 1.25844 + return fn.isTrampoline; 1.25845 + } 1.25846 + Runtime.isTrampoline = isTrampoline; 1.25847 + function isMemoizer(fn) { 1.25848 + true; 1.25849 + return fn.isMemoizer; 1.25850 + } 1.25851 + Runtime.isMemoizer = isMemoizer; 1.25852 + }(AVM2.Runtime || (AVM2.Runtime = {}))); 1.25853 + var Runtime = AVM2.Runtime; 1.25854 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.25855 + var AVM2 = Shumway.AVM2; 1.25856 +}(Shumway || (Shumway = {}))); 1.25857 +var __extends = this.__extends || function (d, b) { 1.25858 + for (var p in b) 1.25859 + if (b.hasOwnProperty(p)) 1.25860 + d[p] = b[p]; 1.25861 + function __() { 1.25862 + this.constructor = d; 1.25863 + } 1.25864 + __.prototype = b.prototype; 1.25865 + d.prototype = new __(); 1.25866 + }; 1.25867 +var Shumway; 1.25868 +(function (Shumway) { 1.25869 + (function (AVM2) { 1.25870 + (function (Runtime) { 1.25871 + var Multiname = Shumway.AVM2.ABC.Multiname; 1.25872 + var Namespace = Shumway.AVM2.ABC.Namespace; 1.25873 + var MethodInfo = Shumway.AVM2.ABC.MethodInfo; 1.25874 + var ClassInfo = Shumway.AVM2.ABC.ClassInfo; 1.25875 + var InstanceInfo = Shumway.AVM2.ABC.InstanceInfo; 1.25876 + var ScriptInfo = Shumway.AVM2.ABC.ScriptInfo; 1.25877 + var Trait = Shumway.AVM2.ABC.Trait; 1.25878 + var IndentingWriter = Shumway.IndentingWriter; 1.25879 + var hasOwnProperty = Shumway.ObjectUtilities.hasOwnProperty; 1.25880 + var createMap = Shumway.ObjectUtilities.createMap; 1.25881 + var cloneObject = Shumway.ObjectUtilities.cloneObject; 1.25882 + var copyProperties = Shumway.ObjectUtilities.copyProperties; 1.25883 + var createEmptyObject = Shumway.ObjectUtilities.createEmptyObject; 1.25884 + var bindSafely = Shumway.FunctionUtilities.bindSafely; 1.25885 + var defineNonEnumerableGetterOrSetter = Shumway.ObjectUtilities.defineNonEnumerableGetterOrSetter; 1.25886 + var defineNonEnumerableProperty = Shumway.ObjectUtilities.defineNonEnumerableProperty; 1.25887 + var defineReadOnlyProperty = Shumway.ObjectUtilities.defineReadOnlyProperty; 1.25888 + var defineNonEnumerableGetter = Shumway.ObjectUtilities.defineNonEnumerableGetter; 1.25889 + var makeForwardingGetter = Shumway.FunctionUtilities.makeForwardingGetter; 1.25890 + var makeForwardingSetter = Shumway.FunctionUtilities.makeForwardingSetter; 1.25891 + var Binding = function () { 1.25892 + function Binding(trait) { 1.25893 + this.trait = trait; 1.25894 + } 1.25895 + Binding.getKey = function (qn, trait) { 1.25896 + var key = qn; 1.25897 + if (trait.isGetter()) { 1.25898 + key = Binding.GET_PREFIX + qn; 1.25899 + } else if (trait.isSetter()) { 1.25900 + key = Binding.SET_PREFIX + qn; 1.25901 + } 1.25902 + return key; 1.25903 + }; 1.25904 + Binding.prototype.toString = function () { 1.25905 + return String(this.trait); 1.25906 + }; 1.25907 + Binding.SET_PREFIX = 'set '; 1.25908 + Binding.GET_PREFIX = 'get '; 1.25909 + Binding.KEY_PREFIX_LENGTH = 4; 1.25910 + return Binding; 1.25911 + }(); 1.25912 + Runtime.Binding = Binding; 1.25913 + var SlotInfo = function () { 1.25914 + function SlotInfo(name, isConst, type, trait) { 1.25915 + this.name = name; 1.25916 + this.isConst = isConst; 1.25917 + this.type = type; 1.25918 + this.trait = trait; 1.25919 + } 1.25920 + return SlotInfo; 1.25921 + }(); 1.25922 + Runtime.SlotInfo = SlotInfo; 1.25923 + var SlotInfoMap = function () { 1.25924 + function SlotInfoMap() { 1.25925 + this.byID = createMap(); 1.25926 + this.byQN = createMap(); 1.25927 + } 1.25928 + return SlotInfoMap; 1.25929 + }(); 1.25930 + Runtime.SlotInfoMap = SlotInfoMap; 1.25931 + var Bindings = function () { 1.25932 + function Bindings() { 1.25933 + this.map = createMap(); 1.25934 + this.slots = []; 1.25935 + this.nextSlotId = 1; 1.25936 + } 1.25937 + Bindings.prototype.assignNextSlot = function (trait) { 1.25938 + true; 1.25939 + true; 1.25940 + if (!trait.slotId) { 1.25941 + trait.slotId = this.nextSlotId++; 1.25942 + } else { 1.25943 + this.nextSlotId = trait.slotId + 1; 1.25944 + } 1.25945 + true; 1.25946 + this.slots[trait.slotId] = trait; 1.25947 + }; 1.25948 + Bindings.prototype.trace = function (writer) { 1.25949 + writer.enter('Bindings'); 1.25950 + for (var key in this.map) { 1.25951 + var binding = this.map[key]; 1.25952 + writer.writeLn(binding.trait.kindName() + ': ' + key + ' -> ' + binding); 1.25953 + } 1.25954 + writer.leaveAndEnter('Slots'); 1.25955 + writer.writeArray(this.slots); 1.25956 + writer.outdent(); 1.25957 + }; 1.25958 + Bindings.prototype.applyTo = function (domain, object) { 1.25959 + true; 1.25960 + true; 1.25961 + true; 1.25962 + defineNonEnumerableProperty(object, Shumway.AVM2.Runtime.VM_SLOTS, new SlotInfoMap()); 1.25963 + defineNonEnumerableProperty(object, Shumway.AVM2.Runtime.VM_BINDINGS, []); 1.25964 + defineNonEnumerableProperty(object, Shumway.AVM2.Runtime.VM_OPEN_METHODS, createMap()); 1.25965 + defineNonEnumerableProperty(object, 'bindings', this); 1.25966 + defineNonEnumerableProperty(object, 'resolutionMap', []); 1.25967 + traitsWriter && traitsWriter.greenLn('Applying Traits'); 1.25968 + for (var key in this.map) { 1.25969 + var binding = this.map[key]; 1.25970 + var trait = binding.trait; 1.25971 + var qn = Multiname.getQualifiedName(trait.name); 1.25972 + if (trait.isSlot() || trait.isConst() || trait.isClass()) { 1.25973 + var defaultValue = undefined; 1.25974 + if (trait.isSlot() || trait.isConst()) { 1.25975 + if (trait.hasDefaultValue) { 1.25976 + defaultValue = trait.value; 1.25977 + } else if (trait.typeName) { 1.25978 + defaultValue = domain.findClassInfo(trait.typeName).defaultValue; 1.25979 + } 1.25980 + } 1.25981 + if (key !== qn) { 1.25982 + traitsWriter && traitsWriter.yellowLn('Binding Trait: ' + key + ' -> ' + qn); 1.25983 + defineNonEnumerableGetter(object, key, makeForwardingGetter(qn)); 1.25984 + object.asBindings.pushUnique(key); 1.25985 + } else { 1.25986 + traitsWriter && traitsWriter.greenLn('Applying Trait ' + trait.kindName() + ': ' + trait); 1.25987 + defineNonEnumerableProperty(object, qn, defaultValue); 1.25988 + object.asBindings.pushUnique(qn); 1.25989 + var slotInfo = new SlotInfo(qn, trait.isConst(), trait.typeName ? domain.getProperty(trait.typeName, false, false) : null, trait); 1.25990 + object.asSlots.byID[trait.slotId] = slotInfo; 1.25991 + object.asSlots.byQN[qn] = slotInfo; 1.25992 + } 1.25993 + } else if (trait.isMethod() || trait.isGetter() || trait.isSetter()) { 1.25994 + if (trait.isGetter() || trait.isSetter()) { 1.25995 + key = key.substring(Binding.KEY_PREFIX_LENGTH); 1.25996 + } 1.25997 + if (key !== qn) { 1.25998 + traitsWriter && traitsWriter.yellowLn('Binding Trait: ' + key + ' -> ' + qn); 1.25999 + } else { 1.26000 + traitsWriter && traitsWriter.greenLn('Applying Trait ' + trait.kindName() + ': ' + trait); 1.26001 + } 1.26002 + object.asBindings.pushUnique(key); 1.26003 + if (this instanceof ScriptBindings) { 1.26004 + Shumway.AVM2.Runtime.applyNonMemoizedMethodTrait(key, trait, object, binding.scope, binding.natives); 1.26005 + } else { 1.26006 + Shumway.AVM2.Runtime.applyMemoizedMethodTrait(key, trait, object, binding.scope, binding.natives); 1.26007 + } 1.26008 + } 1.26009 + } 1.26010 + }; 1.26011 + return Bindings; 1.26012 + }(); 1.26013 + Runtime.Bindings = Bindings; 1.26014 + var ActivationBindings = function (_super) { 1.26015 + __extends(ActivationBindings, _super); 1.26016 + function ActivationBindings(methodInfo) { 1.26017 + _super.call(this); 1.26018 + true; 1.26019 + this.methodInfo = methodInfo; 1.26020 + var traits = methodInfo.traits; 1.26021 + for (var i = 0; i < traits.length; i++) { 1.26022 + var trait = traits[i]; 1.26023 + true; 1.26024 + var key = Multiname.getQualifiedName(trait.name); 1.26025 + this.map[key] = new Binding(trait); 1.26026 + this.assignNextSlot(trait); 1.26027 + } 1.26028 + } 1.26029 + return ActivationBindings; 1.26030 + }(Bindings); 1.26031 + Runtime.ActivationBindings = ActivationBindings; 1.26032 + var CatchBindings = function (_super) { 1.26033 + __extends(CatchBindings, _super); 1.26034 + function CatchBindings(scope, trait) { 1.26035 + _super.call(this); 1.26036 + var key = Multiname.getQualifiedName(trait.name); 1.26037 + this.map[key] = new Binding(trait); 1.26038 + true; 1.26039 + this.assignNextSlot(trait); 1.26040 + } 1.26041 + return CatchBindings; 1.26042 + }(Bindings); 1.26043 + Runtime.CatchBindings = CatchBindings; 1.26044 + var ScriptBindings = function (_super) { 1.26045 + __extends(ScriptBindings, _super); 1.26046 + function ScriptBindings(scriptInfo, scope) { 1.26047 + _super.call(this); 1.26048 + this.scope = scope; 1.26049 + this.scriptInfo = scriptInfo; 1.26050 + var traits = scriptInfo.traits; 1.26051 + for (var i = 0; i < traits.length; i++) { 1.26052 + var trait = traits[i]; 1.26053 + var name = Multiname.getQualifiedName(trait.name); 1.26054 + var key = Binding.getKey(name, trait); 1.26055 + var binding = this.map[key] = new Binding(trait); 1.26056 + if (trait.isSlot() || trait.isConst() || trait.isClass()) { 1.26057 + this.assignNextSlot(trait); 1.26058 + } 1.26059 + if (trait.isClass()) { 1.26060 + if (trait.metadata && trait.metadata.native) { 1.26061 + trait.classInfo.native = trait.metadata.native; 1.26062 + } 1.26063 + } 1.26064 + if (trait.isMethod() || trait.isGetter() || trait.isSetter()) { 1.26065 + binding.scope = this.scope; 1.26066 + } 1.26067 + } 1.26068 + } 1.26069 + return ScriptBindings; 1.26070 + }(Bindings); 1.26071 + Runtime.ScriptBindings = ScriptBindings; 1.26072 + var ClassBindings = function (_super) { 1.26073 + __extends(ClassBindings, _super); 1.26074 + function ClassBindings(classInfo, scope, natives) { 1.26075 + _super.call(this); 1.26076 + this.scope = scope; 1.26077 + this.natives = natives; 1.26078 + this.classInfo = classInfo; 1.26079 + var traits = classInfo.traits; 1.26080 + for (var i = 0; i < traits.length; i++) { 1.26081 + var trait = traits[i]; 1.26082 + var name = Multiname.getQualifiedName(trait.name); 1.26083 + var key = Binding.getKey(name, trait); 1.26084 + var binding = this.map[key] = new Binding(trait); 1.26085 + if (trait.isSlot() || trait.isConst()) { 1.26086 + this.assignNextSlot(trait); 1.26087 + } 1.26088 + if (trait.isMethod() || trait.isGetter() || trait.isSetter()) { 1.26089 + binding.scope = this.scope; 1.26090 + binding.natives = this.natives; 1.26091 + } 1.26092 + } 1.26093 + } 1.26094 + return ClassBindings; 1.26095 + }(Bindings); 1.26096 + Runtime.ClassBindings = ClassBindings; 1.26097 + var InstanceBindings = function (_super) { 1.26098 + __extends(InstanceBindings, _super); 1.26099 + function InstanceBindings(parent, instanceInfo, scope, natives) { 1.26100 + _super.call(this); 1.26101 + this.scope = scope; 1.26102 + this.natives = natives; 1.26103 + this.parent = parent; 1.26104 + this.instanceInfo = instanceInfo; 1.26105 + this.implementedInterfaces = parent ? cloneObject(parent.implementedInterfaces) : createEmptyObject(); 1.26106 + if (parent) { 1.26107 + this.slots = parent.slots.slice(); 1.26108 + this.nextSlotId = parent.nextSlotId; 1.26109 + } 1.26110 + this.extend(parent); 1.26111 + } 1.26112 + InstanceBindings.prototype.extend = function (parent) { 1.26113 + var ii = this.instanceInfo, ib; 1.26114 + var map = this.map; 1.26115 + var name, key, trait, binding, protectedName, protectedKey; 1.26116 + if (parent) { 1.26117 + for (key in parent.map) { 1.26118 + binding = parent.map[key]; 1.26119 + trait = binding.trait; 1.26120 + map[key] = binding; 1.26121 + if (trait.isProtected()) { 1.26122 + protectedName = Multiname.getQualifiedName(new Multiname([ 1.26123 + ii.protectedNs 1.26124 + ], trait.name.getName())); 1.26125 + protectedKey = Binding.getKey(protectedName, trait); 1.26126 + map[protectedKey] = binding; 1.26127 + } 1.26128 + } 1.26129 + } 1.26130 + function writeOrOverwriteBinding(object, key, binding) { 1.26131 + var trait = binding.trait; 1.26132 + var oldBinding = object[key]; 1.26133 + if (oldBinding) { 1.26134 + var oldTrait = oldBinding.trait; 1.26135 + true; 1.26136 + true; 1.26137 + } else { 1.26138 + true; 1.26139 + } 1.26140 + object[key] = binding; 1.26141 + } 1.26142 + function overwriteProtectedBinding(object, key, binding) { 1.26143 + if (key in object) { 1.26144 + object[key] = binding; 1.26145 + } 1.26146 + } 1.26147 + var traits = ii.traits; 1.26148 + for (var i = 0; i < traits.length; i++) { 1.26149 + trait = traits[i]; 1.26150 + name = Multiname.getQualifiedName(trait.name); 1.26151 + key = Binding.getKey(name, trait); 1.26152 + binding = new Binding(trait); 1.26153 + writeOrOverwriteBinding(map, key, binding); 1.26154 + if (trait.isProtected()) { 1.26155 + ib = this.parent; 1.26156 + while (ib) { 1.26157 + protectedName = Multiname.getQualifiedName(new Multiname([ 1.26158 + ib.instanceInfo.protectedNs 1.26159 + ], trait.name.getName())); 1.26160 + protectedKey = Binding.getKey(protectedName, trait); 1.26161 + overwriteProtectedBinding(map, protectedKey, binding); 1.26162 + ib = ib.parent; 1.26163 + } 1.26164 + } 1.26165 + if (trait.isSlot() || trait.isConst()) { 1.26166 + this.assignNextSlot(trait); 1.26167 + } 1.26168 + if (trait.isMethod() || trait.isGetter() || trait.isSetter()) { 1.26169 + binding.scope = this.scope; 1.26170 + binding.natives = this.natives; 1.26171 + } 1.26172 + } 1.26173 + var domain = ii.abc.applicationDomain; 1.26174 + var interfaces = ii.interfaces; 1.26175 + for (var i = 0; i < interfaces.length; i++) { 1.26176 + var interface = domain.getProperty(interfaces[i], true, true); 1.26177 + true; 1.26178 + copyProperties(this.implementedInterfaces, interface.interfaceBindings.implementedInterfaces); 1.26179 + this.implementedInterfaces[Multiname.getQualifiedName(interface.name)] = interface; 1.26180 + } 1.26181 + for (var interfaceName in this.implementedInterfaces) { 1.26182 + var interface = this.implementedInterfaces[interfaceName]; 1.26183 + ib = interface.interfaceBindings; 1.26184 + for (var interfaceKey in ib.map) { 1.26185 + var interfaceBinding = ib.map[interfaceKey]; 1.26186 + if (ii.isInterface()) { 1.26187 + map[interfaceKey] = interfaceBinding; 1.26188 + } else { 1.26189 + name = Multiname.getPublicQualifiedName(interfaceBinding.trait.name.getName()); 1.26190 + key = Binding.getKey(name, interfaceBinding.trait); 1.26191 + map[interfaceKey] = map[key]; 1.26192 + } 1.26193 + } 1.26194 + } 1.26195 + }; 1.26196 + InstanceBindings.prototype.toString = function () { 1.26197 + return this.instanceInfo.toString(); 1.26198 + }; 1.26199 + return InstanceBindings; 1.26200 + }(Bindings); 1.26201 + Runtime.InstanceBindings = InstanceBindings; 1.26202 + var traitsWriter = null; 1.26203 + }(AVM2.Runtime || (AVM2.Runtime = {}))); 1.26204 + var Runtime = AVM2.Runtime; 1.26205 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.26206 + var AVM2 = Shumway.AVM2; 1.26207 +}(Shumway || (Shumway = {}))); 1.26208 +var Binding = Shumway.AVM2.Runtime.Binding; 1.26209 +var Bindings = Shumway.AVM2.Runtime.Bindings; 1.26210 +var ActivationBindings = Shumway.AVM2.Runtime.ActivationBindings; 1.26211 +var CatchBindings = Shumway.AVM2.Runtime.CatchBindings; 1.26212 +var ScriptBindings = Shumway.AVM2.Runtime.ScriptBindings; 1.26213 +var ClassBindings = Shumway.AVM2.Runtime.ClassBindings; 1.26214 +var InstanceBindings = Shumway.AVM2.Runtime.InstanceBindings; 1.26215 +var Shumway; 1.26216 +(function (Shumway) { 1.26217 + (function (AVM2) { 1.26218 + (function (Runtime) { 1.26219 + var Multiname = Shumway.AVM2.ABC.Multiname; 1.26220 + var Namespace = Shumway.AVM2.ABC.Namespace; 1.26221 + var MethodInfo = Shumway.AVM2.ABC.MethodInfo; 1.26222 + var ClassInfo = Shumway.AVM2.ABC.ClassInfo; 1.26223 + var InstanceInfo = Shumway.AVM2.ABC.InstanceInfo; 1.26224 + var InstanceBindings = Shumway.AVM2.Runtime.InstanceBindings; 1.26225 + var ClassBindings = Shumway.AVM2.Runtime.ClassBindings; 1.26226 + var defineNonEnumerableGetterOrSetter = Shumway.ObjectUtilities.defineNonEnumerableGetterOrSetter; 1.26227 + var defineNonEnumerableProperty = Shumway.ObjectUtilities.defineNonEnumerableProperty; 1.26228 + var defineReadOnlyProperty = Shumway.ObjectUtilities.defineReadOnlyProperty; 1.26229 + var defineNonEnumerableGetter = Shumway.ObjectUtilities.defineNonEnumerableGetter; 1.26230 + var createEmptyObject = Shumway.ObjectUtilities.createEmptyObject; 1.26231 + var toKeyValueArray = Shumway.ObjectUtilities.toKeyValueArray; 1.26232 + var boxValue = Shumway.ObjectUtilities.boxValue; 1.26233 + function makeCacheKey(namespaces, name, flags) { 1.26234 + if (!namespaces) { 1.26235 + return name; 1.26236 + } else if (namespaces.length > 1) { 1.26237 + return namespaces.runtimeId + '$' + name; 1.26238 + } else { 1.26239 + return namespaces[0].qualifiedName + '$' + name; 1.26240 + } 1.26241 + } 1.26242 + var Scope = function () { 1.26243 + function Scope(parent, object, isWith) { 1.26244 + if (typeof isWith === 'undefined') { 1.26245 + isWith = false; 1.26246 + } 1.26247 + this.parent = parent; 1.26248 + this.object = boxValue(object); 1.26249 + true; 1.26250 + this.global = parent ? parent.global : this; 1.26251 + this.isWith = isWith; 1.26252 + this.cache = createEmptyObject(); 1.26253 + } 1.26254 + Scope.prototype.findDepth = function (object) { 1.26255 + var current = this; 1.26256 + var depth = 0; 1.26257 + while (current) { 1.26258 + if (current.object === object) { 1.26259 + return depth; 1.26260 + } 1.26261 + depth++; 1.26262 + current = current.parent; 1.26263 + } 1.26264 + return -1; 1.26265 + }; 1.26266 + Scope.prototype.getScopeObjects = function () { 1.26267 + var objects = []; 1.26268 + var current = this; 1.26269 + while (current) { 1.26270 + objects.unshift(current.object); 1.26271 + current = current.parent; 1.26272 + } 1.26273 + return objects; 1.26274 + }; 1.26275 + Scope.prototype.findScopeProperty = function (namespaces, name, flags, domain, strict, scopeOnly) { 1.26276 + Counter.count('findScopeProperty'); 1.26277 + var object; 1.26278 + var key = makeCacheKey(namespaces, name, flags); 1.26279 + if (!scopeOnly && (object = this.cache[key])) { 1.26280 + return object; 1.26281 + } 1.26282 + if (this.object.asHasProperty(namespaces, name, flags, true)) { 1.26283 + return this.isWith ? this.object : this.cache[key] = this.object; 1.26284 + } 1.26285 + if (this.parent) { 1.26286 + return this.cache[key] = this.parent.findScopeProperty(namespaces, name, flags, domain, strict, scopeOnly); 1.26287 + } 1.26288 + if (scopeOnly) 1.26289 + return null; 1.26290 + if (object = domain.findDomainProperty(new Multiname(namespaces, name, flags), strict, true)) { 1.26291 + return object; 1.26292 + } 1.26293 + if (strict) { 1.26294 + Shumway.Debug.unexpected('Cannot find property ' + name); 1.26295 + } 1.26296 + return this.global.object; 1.26297 + }; 1.26298 + return Scope; 1.26299 + }(); 1.26300 + Runtime.Scope = Scope; 1.26301 + function bindFreeMethodScope(methodInfo, scope) { 1.26302 + var fn = methodInfo.freeMethod; 1.26303 + if (methodInfo.lastBoundMethod && methodInfo.lastBoundMethod.scope === scope) { 1.26304 + return methodInfo.lastBoundMethod.boundMethod; 1.26305 + } 1.26306 + true; 1.26307 + var boundMethod; 1.26308 + var asGlobal = scope.global.object; 1.26309 + if (!methodInfo.hasOptional() && !methodInfo.needsArguments() && !methodInfo.needsRest()) { 1.26310 + switch (methodInfo.parameters.length) { 1.26311 + case 0: 1.26312 + boundMethod = function () { 1.26313 + return fn.call(this === jsGlobal ? asGlobal : this, scope); 1.26314 + }; 1.26315 + break; 1.26316 + case 1: 1.26317 + boundMethod = function (x) { 1.26318 + return fn.call(this === jsGlobal ? asGlobal : this, scope, x); 1.26319 + }; 1.26320 + break; 1.26321 + case 2: 1.26322 + boundMethod = function (x, y) { 1.26323 + return fn.call(this === jsGlobal ? asGlobal : this, scope, x, y); 1.26324 + }; 1.26325 + break; 1.26326 + case 3: 1.26327 + boundMethod = function (x, y, z) { 1.26328 + return fn.call(this === jsGlobal ? asGlobal : this, scope, x, y, z); 1.26329 + }; 1.26330 + break; 1.26331 + default: 1.26332 + break; 1.26333 + } 1.26334 + } 1.26335 + if (!boundMethod) { 1.26336 + Counter.count('Bind Scope - Slow Path'); 1.26337 + boundMethod = function () { 1.26338 + Array.prototype.unshift.call(arguments, scope); 1.26339 + var global = this === jsGlobal ? scope.global.object : this; 1.26340 + return fn.apply(global, arguments); 1.26341 + }; 1.26342 + } 1.26343 + boundMethod.methodInfo = methodInfo; 1.26344 + boundMethod.instanceConstructor = boundMethod; 1.26345 + methodInfo.lastBoundMethod = { 1.26346 + scope: scope, 1.26347 + boundMethod: boundMethod 1.26348 + }; 1.26349 + return boundMethod; 1.26350 + } 1.26351 + Runtime.bindFreeMethodScope = bindFreeMethodScope; 1.26352 + }(AVM2.Runtime || (AVM2.Runtime = {}))); 1.26353 + var Runtime = AVM2.Runtime; 1.26354 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.26355 + var AVM2 = Shumway.AVM2; 1.26356 +}(Shumway || (Shumway = {}))); 1.26357 +var playerglobalLoadedPromise; 1.26358 +var playerglobal; 1.26359 +var Shumway; 1.26360 +(function (Shumway) { 1.26361 + (function (AVM2) { 1.26362 + (function (Runtime) { 1.26363 + var AbcFile = Shumway.AVM2.ABC.AbcFile; 1.26364 + var Multiname = Shumway.AVM2.ABC.Multiname; 1.26365 + var Namespace = Shumway.AVM2.ABC.Namespace; 1.26366 + var MethodInfo = Shumway.AVM2.ABC.MethodInfo; 1.26367 + var ClassInfo = Shumway.AVM2.ABC.ClassInfo; 1.26368 + var InstanceInfo = Shumway.AVM2.ABC.InstanceInfo; 1.26369 + var ScriptInfo = Shumway.AVM2.ABC.ScriptInfo; 1.26370 + var createEmptyObject = Shumway.ObjectUtilities.createEmptyObject; 1.26371 + var IndentingWriter = Shumway.IndentingWriter; 1.26372 + (function (EXECUTION_MODE) { 1.26373 + EXECUTION_MODE[EXECUTION_MODE['INTERPRET'] = 1] = 'INTERPRET'; 1.26374 + EXECUTION_MODE[EXECUTION_MODE['COMPILE'] = 2] = 'COMPILE'; 1.26375 + }(Runtime.EXECUTION_MODE || (Runtime.EXECUTION_MODE = {}))); 1.26376 + var EXECUTION_MODE = Runtime.EXECUTION_MODE; 1.26377 + function createNewCompartment() { 1.26378 + return newGlobal('new-compartment'); 1.26379 + } 1.26380 + function executeScript(script) { 1.26381 + var abc = script.abc; 1.26382 + true; 1.26383 + var global = new Shumway.AVM2.Runtime.Global(script); 1.26384 + if (abc.applicationDomain.allowNatives) { 1.26385 + global[Multiname.getPublicQualifiedName('unsafeJSNative')] = getNative; 1.26386 + } 1.26387 + script.executing = true; 1.26388 + var scope = new Shumway.AVM2.Runtime.Scope(null, script.global); 1.26389 + createFunction(script.init, scope).call(script.global, false); 1.26390 + script.executed = true; 1.26391 + } 1.26392 + Runtime.executeScript = executeScript; 1.26393 + function ensureScriptIsExecuted(script, reason) { 1.26394 + if (typeof reason === 'undefined') { 1.26395 + reason = ''; 1.26396 + } 1.26397 + if (!script.executed && !script.executing) { 1.26398 + if (Shumway.AVM2.Runtime.traceExecution.value >= 2) { 1.26399 + log('Executing Script For: ' + reason); 1.26400 + } 1.26401 + executeScript(script); 1.26402 + } 1.26403 + } 1.26404 + Runtime.ensureScriptIsExecuted = ensureScriptIsExecuted; 1.26405 + (function (Glue) { 1.26406 + Glue[Glue['PUBLIC_PROPERTIES'] = 1] = 'PUBLIC_PROPERTIES'; 1.26407 + Glue[Glue['PUBLIC_METHODS'] = 2] = 'PUBLIC_METHODS'; 1.26408 + Glue[Glue['ALL'] = 1 | 2] = 'ALL'; 1.26409 + }(Runtime.Glue || (Runtime.Glue = {}))); 1.26410 + var Glue = Runtime.Glue; 1.26411 + function grabAbc(abcName) { 1.26412 + var entry = playerglobal.scripts[abcName]; 1.26413 + if (!entry) { 1.26414 + return null; 1.26415 + } 1.26416 + var offset = entry.offset; 1.26417 + var length = entry.length; 1.26418 + return new AbcFile(new Uint8Array(playerglobal.abcs, offset, length), abcName); 1.26419 + } 1.26420 + function findDefiningAbc(mn) { 1.26421 + if (!playerglobal) { 1.26422 + return null; 1.26423 + } 1.26424 + for (var i = 0; i < mn.namespaces.length; i++) { 1.26425 + var name = mn.namespaces[i].uri + ':' + mn.name; 1.26426 + var abcName = playerglobal.map[name]; 1.26427 + if (abcName) { 1.26428 + break; 1.26429 + } 1.26430 + } 1.26431 + if (abcName) { 1.26432 + return grabAbc(abcName); 1.26433 + } 1.26434 + return null; 1.26435 + } 1.26436 + function promiseFile(path, responseType) { 1.26437 + return new Promise(function (resolve, reject) { 1.26438 + var xhr = new XMLHttpRequest(); 1.26439 + xhr.open('GET', path); 1.26440 + xhr.responseType = responseType; 1.26441 + xhr.onload = function () { 1.26442 + if (xhr.response) { 1.26443 + resolve(xhr.response); 1.26444 + } else { 1.26445 + reject('Unable to load ' + path + ': ' + xhr.statusText); 1.26446 + } 1.26447 + }; 1.26448 + xhr.send(); 1.26449 + }); 1.26450 + } 1.26451 + var AVM2 = function () { 1.26452 + function AVM2(sysMode, appMode, loadAVM1) { 1.26453 + this.systemDomain = new ApplicationDomain(this, null, sysMode, true); 1.26454 + this.applicationDomain = new ApplicationDomain(this, this.systemDomain, appMode, false); 1.26455 + this.findDefiningAbc = findDefiningAbc; 1.26456 + this.loadAVM1 = loadAVM1; 1.26457 + this.isAVM1Loaded = false; 1.26458 + this.exception = { 1.26459 + value: undefined 1.26460 + }; 1.26461 + this.exceptions = []; 1.26462 + } 1.26463 + AVM2.initialize = function (sysMode, appMode, loadAVM1) { 1.26464 + AVM2.instance = new AVM2(sysMode, appMode, loadAVM1); 1.26465 + }; 1.26466 + AVM2.currentAbc = function () { 1.26467 + var caller = arguments.callee; 1.26468 + var maxDepth = 20; 1.26469 + var abc = null; 1.26470 + for (var i = 0; i < maxDepth && caller; i++) { 1.26471 + var mi = caller.methodInfo; 1.26472 + if (mi) { 1.26473 + abc = mi.abc; 1.26474 + break; 1.26475 + } 1.26476 + caller = caller.caller; 1.26477 + } 1.26478 + return abc; 1.26479 + }; 1.26480 + AVM2.currentDomain = function () { 1.26481 + var abc = AVM2.currentAbc(); 1.26482 + return abc.applicationDomain; 1.26483 + }; 1.26484 + AVM2.isPlayerglobalLoaded = function () { 1.26485 + return !(!playerglobal); 1.26486 + }; 1.26487 + AVM2.loadPlayerglobal = function (abcsPath, catalogPath) { 1.26488 + if (playerglobalLoadedPromise) { 1.26489 + return Promise.reject('Playerglobal is already loaded'); 1.26490 + } 1.26491 + playerglobalLoadedPromise = Promise.all([ 1.26492 + promiseFile(abcsPath, 'arraybuffer'), 1.26493 + promiseFile(catalogPath, 'json') 1.26494 + ]).then(function (result) { 1.26495 + playerglobal = { 1.26496 + abcs: result[0], 1.26497 + map: Object.create(null), 1.26498 + scripts: Object.create(null) 1.26499 + }; 1.26500 + var catalog = result[1]; 1.26501 + for (var i = 0; i < catalog.length; i++) { 1.26502 + var abc = catalog[i]; 1.26503 + playerglobal.scripts[abc.name] = abc; 1.26504 + if (typeof abc.defs === 'string') { 1.26505 + playerglobal.map[abc.defs] = abc.name; 1.26506 + } else { 1.26507 + for (var j = 0; j < abc.defs.length; j++) { 1.26508 + var def = abc.defs[j]; 1.26509 + playerglobal.map[def] = abc.name; 1.26510 + } 1.26511 + } 1.26512 + } 1.26513 + }, function (e) { 1.26514 + console.error(e); 1.26515 + }); 1.26516 + return playerglobalLoadedPromise; 1.26517 + }; 1.26518 + AVM2.prototype.notifyConstruct = function (instanceConstructor, args) { 1.26519 + }; 1.26520 + AVM2.getStackTrace = function () { 1.26521 + Shumway.Debug.notImplemented('getStackTrace'); 1.26522 + }; 1.26523 + return AVM2; 1.26524 + }(); 1.26525 + Runtime.AVM2 = AVM2; 1.26526 + var ApplicationDomain = function () { 1.26527 + function ApplicationDomain(vm, base, mode, allowNatives) { 1.26528 + true; 1.26529 + true; 1.26530 + this.vm = vm; 1.26531 + this.abcs = []; 1.26532 + this.loadedAbcs = {}; 1.26533 + this.loadedClasses = []; 1.26534 + this.classCache = createEmptyObject(); 1.26535 + this.scriptCache = createEmptyObject(); 1.26536 + this.classInfoCache = createEmptyObject(); 1.26537 + this.base = base; 1.26538 + this.allowNatives = allowNatives; 1.26539 + this.mode = mode; 1.26540 + this.onMessage = new Callback(); 1.26541 + if (base) { 1.26542 + this.system = base.system; 1.26543 + } else { 1.26544 + this.system = this; 1.26545 + } 1.26546 + } 1.26547 + ApplicationDomain.passthroughCallable = function (f) { 1.26548 + return { 1.26549 + call: function ($this) { 1.26550 + Array.prototype.shift.call(arguments); 1.26551 + return f.apply($this, arguments); 1.26552 + }, 1.26553 + apply: function ($this, args) { 1.26554 + return f.apply($this, args); 1.26555 + } 1.26556 + }; 1.26557 + }; 1.26558 + ApplicationDomain.coerceCallable = function (type) { 1.26559 + return { 1.26560 + call: function ($this, value) { 1.26561 + return Shumway.AVM2.Runtime.asCoerce(type, value); 1.26562 + }, 1.26563 + apply: function ($this, args) { 1.26564 + return Shumway.AVM2.Runtime.asCoerce(type, args[0]); 1.26565 + } 1.26566 + }; 1.26567 + }; 1.26568 + ApplicationDomain.constructingCallable = function (instanceConstructor) { 1.26569 + return { 1.26570 + call: function (self) { 1.26571 + return new (Function.bind.apply(instanceConstructor, arguments))(); 1.26572 + }, 1.26573 + apply: function (self, args) { 1.26574 + return new (Function.bind.apply(instanceConstructor, [ 1.26575 + self 1.26576 + ].concat(args)))(); 1.26577 + } 1.26578 + }; 1.26579 + }; 1.26580 + ApplicationDomain.prototype.getType = function (multiname) { 1.26581 + return this.getProperty(multiname, true, true); 1.26582 + }; 1.26583 + ApplicationDomain.prototype.getProperty = function (multiname, strict, execute) { 1.26584 + var resolved = this.findDefiningScript(multiname, execute); 1.26585 + if (resolved) { 1.26586 + if (!resolved.script.executing) { 1.26587 + return undefined; 1.26588 + } 1.26589 + return resolved.script.global[Multiname.getQualifiedName(resolved.trait.name)]; 1.26590 + } 1.26591 + if (strict) { 1.26592 + return Shumway.Debug.unexpected('Cannot find property ' + multiname); 1.26593 + } 1.26594 + return undefined; 1.26595 + }; 1.26596 + ApplicationDomain.prototype.getClass = function (simpleName) { 1.26597 + var cache = this.classCache; 1.26598 + var c = cache[simpleName]; 1.26599 + if (!c) { 1.26600 + c = cache[simpleName] = this.getProperty(Multiname.fromSimpleName(simpleName), true, true); 1.26601 + } 1.26602 + true; 1.26603 + return c; 1.26604 + }; 1.26605 + ApplicationDomain.prototype.findClass = function (simpleName) { 1.26606 + if (simpleName in this.classCache) { 1.26607 + return true; 1.26608 + } 1.26609 + return this.findDomainProperty(Multiname.fromSimpleName(simpleName), false, true); 1.26610 + }; 1.26611 + ApplicationDomain.prototype.findDomainProperty = function (multiname, strict, execute) { 1.26612 + if (Shumway.AVM2.Runtime.traceDomain.value) { 1.26613 + log('ApplicationDomain.findDomainProperty: ' + multiname); 1.26614 + } 1.26615 + var resolved = this.findDefiningScript(multiname, execute); 1.26616 + if (resolved) { 1.26617 + return resolved.script.global; 1.26618 + } 1.26619 + if (strict) { 1.26620 + return Shumway.Debug.unexpected('Cannot find property ' + multiname); 1.26621 + } else { 1.26622 + return undefined; 1.26623 + } 1.26624 + return undefined; 1.26625 + }; 1.26626 + ApplicationDomain.prototype.findClassInfo = function (mn) { 1.26627 + var originalQn; 1.26628 + if (Multiname.isQName(mn)) { 1.26629 + originalQn = Multiname.getQualifiedName(mn); 1.26630 + var ci = this.classInfoCache[originalQn]; 1.26631 + if (ci) { 1.26632 + return ci; 1.26633 + } 1.26634 + } else { 1.26635 + var ci = this.classInfoCache[mn.runtimeId]; 1.26636 + if (ci) { 1.26637 + return ci; 1.26638 + } 1.26639 + } 1.26640 + if (this.base) { 1.26641 + ci = this.base.findClassInfo(mn); 1.26642 + if (ci) { 1.26643 + return ci; 1.26644 + } 1.26645 + } 1.26646 + var abcs = this.abcs; 1.26647 + for (var i = 0; i < abcs.length; i++) { 1.26648 + var abc = abcs[i]; 1.26649 + var scripts = abc.scripts; 1.26650 + for (var j = 0; j < scripts.length; j++) { 1.26651 + var script = scripts[j]; 1.26652 + var traits = script.traits; 1.26653 + for (var k = 0; k < traits.length; k++) { 1.26654 + var trait = traits[k]; 1.26655 + if (trait.isClass()) { 1.26656 + var traitName = Multiname.getQualifiedName(trait.name); 1.26657 + if (originalQn) { 1.26658 + if (traitName === originalQn) { 1.26659 + return this.classInfoCache[originalQn] = trait.classInfo; 1.26660 + } 1.26661 + } else { 1.26662 + for (var m = 0, n = mn.namespaces.length; m < n; m++) { 1.26663 + var qn = mn.getQName(m); 1.26664 + if (traitName === Multiname.getQualifiedName(qn)) { 1.26665 + return this.classInfoCache[qn] = trait.classInfo; 1.26666 + } 1.26667 + } 1.26668 + } 1.26669 + } 1.26670 + } 1.26671 + } 1.26672 + } 1.26673 + if (!this.base && this.vm.findDefiningAbc) { 1.26674 + var abc = this.vm.findDefiningAbc(mn); 1.26675 + if (abc !== null && !this.loadedAbcs[abc.name]) { 1.26676 + this.loadedAbcs[abc.name] = true; 1.26677 + this.loadAbc(abc); 1.26678 + return this.findClassInfo(mn); 1.26679 + } 1.26680 + } 1.26681 + return undefined; 1.26682 + }; 1.26683 + ApplicationDomain.prototype.installNative = function (name, func) { 1.26684 + natives[name] = function () { 1.26685 + return func; 1.26686 + }; 1.26687 + }; 1.26688 + ApplicationDomain.prototype.findDefiningScript = function (mn, execute) { 1.26689 + var resolved = this.scriptCache[mn.runtimeId]; 1.26690 + if (resolved && (resolved.script.executed || !execute)) { 1.26691 + return resolved; 1.26692 + } 1.26693 + if (this.base) { 1.26694 + resolved = this.base.findDefiningScript(mn, execute); 1.26695 + if (resolved) { 1.26696 + return resolved; 1.26697 + } 1.26698 + } 1.26699 + Counter.count('ApplicationDomain: findDefiningScript'); 1.26700 + var abcs = this.abcs; 1.26701 + for (var i = 0; i < abcs.length; i++) { 1.26702 + var abc = abcs[i]; 1.26703 + var scripts = abc.scripts; 1.26704 + for (var j = 0; j < scripts.length; j++) { 1.26705 + var script = scripts[j]; 1.26706 + var traits = script.traits; 1.26707 + if (mn instanceof Multiname) { 1.26708 + for (var k = 0; k < traits.length; k++) { 1.26709 + var trait = traits[k]; 1.26710 + if (mn.hasQName(trait.name)) { 1.26711 + if (execute) { 1.26712 + ensureScriptIsExecuted(script, String(trait.name)); 1.26713 + } 1.26714 + return this.scriptCache[mn.runtimeId] = { 1.26715 + script: script, 1.26716 + trait: trait 1.26717 + }; 1.26718 + } 1.26719 + } 1.26720 + } else { 1.26721 + Shumway.Debug.unexpected(); 1.26722 + } 1.26723 + } 1.26724 + } 1.26725 + if (!this.base && this.vm.findDefiningAbc) { 1.26726 + var abc = this.vm.findDefiningAbc(mn); 1.26727 + if (abc !== null && !this.loadedAbcs[abc.name]) { 1.26728 + this.loadedAbcs[abc.name] = true; 1.26729 + this.loadAbc(abc); 1.26730 + return this.findDefiningScript(mn, execute); 1.26731 + } 1.26732 + } 1.26733 + return undefined; 1.26734 + }; 1.26735 + ApplicationDomain.prototype.compileAbc = function (abc, writer) { 1.26736 + compileAbc(abc, writer); 1.26737 + }; 1.26738 + ApplicationDomain.prototype.executeAbc = function (abc) { 1.26739 + this.loadAbc(abc); 1.26740 + executeScript(abc.lastScript); 1.26741 + }; 1.26742 + ApplicationDomain.prototype.loadAbc = function (abc) { 1.26743 + if (Shumway.AVM2.Runtime.traceExecution.value) { 1.26744 + log('Loading: ' + abc.name); 1.26745 + } 1.26746 + abc.applicationDomain = this; 1.26747 + GlobalMultinameResolver.loadAbc(abc); 1.26748 + this.abcs.push(abc); 1.26749 + if (!this.base) { 1.26750 + Type.initializeTypes(this); 1.26751 + } 1.26752 + }; 1.26753 + ApplicationDomain.prototype.broadcastMessage = function (type, message, origin) { 1.26754 + if (debug) { 1.26755 + Timer.start('broadcast: ' + type); 1.26756 + } 1.26757 + try { 1.26758 + this.onMessage.notify1(type, { 1.26759 + data: message, 1.26760 + origin: origin, 1.26761 + source: this 1.26762 + }); 1.26763 + } catch (e) { 1.26764 + avm2.exceptions.push({ 1.26765 + source: type, 1.26766 + message: e.message, 1.26767 + stack: e.stack 1.26768 + }); 1.26769 + throw e; 1.26770 + } 1.26771 + if (debug) { 1.26772 + Timer.stop(); 1.26773 + } 1.26774 + }; 1.26775 + ApplicationDomain.prototype.traceLoadedClasses = function (lastOnly) { 1.26776 + var writer = new IndentingWriter(); 1.26777 + lastOnly || writer.enter('Loaded Classes And Interfaces'); 1.26778 + var classes = lastOnly ? [ 1.26779 + this.loadedClasses.last() 1.26780 + ] : this.loadedClasses; 1.26781 + classes.forEach(function (cls) { 1.26782 + if (cls !== Shumway.AVM2.Runtime.Class) { 1.26783 + cls.trace(writer); 1.26784 + } 1.26785 + }); 1.26786 + lastOnly || writer.leave(''); 1.26787 + }; 1.26788 + return ApplicationDomain; 1.26789 + }(); 1.26790 + Runtime.ApplicationDomain = ApplicationDomain; 1.26791 + var SecurityDomain = function () { 1.26792 + function SecurityDomain() { 1.26793 + this.compartment = createNewCompartment(); 1.26794 + this.compartment.homePath = homePath; 1.26795 + this.compartment.release = true; 1.26796 + this.compartment.eval(snarf('compartment.js')); 1.26797 + } 1.26798 + SecurityDomain.prototype.initializeShell = function (sysMode, appMode) { 1.26799 + var compartment = this.compartment; 1.26800 + compartment.AVM2.initialize(sysMode, appMode); 1.26801 + compartment.AVM2.instance.systemDomain.executeAbc(compartment.grabAbc(homePath + 'src/avm2/generated/builtin/builtin.abc')); 1.26802 + compartment.AVM2.instance.systemDomain.executeAbc(compartment.grabAbc(homePath + 'src/avm2/generated/shell/shell.abc')); 1.26803 + this.systemDomain = compartment.AVM2.instance.systemDomain; 1.26804 + this.applicationDomain = compartment.AVM2.instance.applicationDomain; 1.26805 + }; 1.26806 + return SecurityDomain; 1.26807 + }(); 1.26808 + Runtime.SecurityDomain = SecurityDomain; 1.26809 + }(AVM2.Runtime || (AVM2.Runtime = {}))); 1.26810 + var Runtime = AVM2.Runtime; 1.26811 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.26812 + var AVM2 = Shumway.AVM2; 1.26813 +}(Shumway || (Shumway = {}))); 1.26814 +var Glue = Shumway.AVM2.Runtime.Glue; 1.26815 +var ApplicationDomain = Shumway.AVM2.Runtime.ApplicationDomain; 1.26816 +var AVM2 = Shumway.AVM2.Runtime.AVM2; 1.26817 +var EXECUTION_MODE = Shumway.AVM2.Runtime.EXECUTION_MODE; 1.26818 +var ApplicationDomain = Shumway.AVM2.Runtime.ApplicationDomain; 1.26819 +var AVM2 = Shumway.AVM2.Runtime.AVM2; 1.26820 +var EXECUTION_MODE = Shumway.AVM2.Runtime.EXECUTION_MODE; 1.26821 +var Shumway; 1.26822 +(function (Shumway) { 1.26823 + (function (AVM2) { 1.26824 + (function (Runtime) { 1.26825 + var Multiname = Shumway.AVM2.ABC.Multiname; 1.26826 + var Namespace = Shumway.AVM2.ABC.Namespace; 1.26827 + var ClassInfo = Shumway.AVM2.ABC.ClassInfo; 1.26828 + var InstanceInfo = Shumway.AVM2.ABC.InstanceInfo; 1.26829 + var InstanceBindings = Shumway.AVM2.Runtime.InstanceBindings; 1.26830 + var ClassBindings = Shumway.AVM2.Runtime.ClassBindings; 1.26831 + var defineNonEnumerableGetterOrSetter = Shumway.ObjectUtilities.defineNonEnumerableGetterOrSetter; 1.26832 + var defineNonEnumerableProperty = Shumway.ObjectUtilities.defineNonEnumerableProperty; 1.26833 + var defineReadOnlyProperty = Shumway.ObjectUtilities.defineReadOnlyProperty; 1.26834 + var defineNonEnumerableGetter = Shumway.ObjectUtilities.defineNonEnumerableGetter; 1.26835 + var createEmptyObject = Shumway.ObjectUtilities.createEmptyObject; 1.26836 + var toKeyValueArray = Shumway.ObjectUtilities.toKeyValueArray; 1.26837 + var Interface = function () { 1.26838 + function Interface(classInfo) { 1.26839 + var ii = classInfo.instanceInfo; 1.26840 + true; 1.26841 + this.name = ii.name; 1.26842 + this.classInfo = classInfo; 1.26843 + } 1.26844 + Interface.createInterface = function (classInfo) { 1.26845 + var ii = classInfo.instanceInfo; 1.26846 + true; 1.26847 + if (Shumway.AVM2.Runtime.traceExecution.value) { 1.26848 + var str = 'Creating Interface ' + ii.name; 1.26849 + if (ii.interfaces.length) { 1.26850 + str += ' implements ' + ii.interfaces.map(function (name) { 1.26851 + return name.getName(); 1.26852 + }).join(', '); 1.26853 + } 1.26854 + log(str); 1.26855 + } 1.26856 + var cls = new Interface(classInfo); 1.26857 + cls.interfaceBindings = new InstanceBindings(null, ii, null, null); 1.26858 + return cls; 1.26859 + }; 1.26860 + Interface.prototype.toString = function () { 1.26861 + return '[interface ' + this.name + ']'; 1.26862 + }; 1.26863 + Interface.prototype.isInstance = function (value) { 1.26864 + if (value === null || typeof value !== 'object') { 1.26865 + return false; 1.26866 + } 1.26867 + true; 1.26868 + var qualifiedName = Multiname.getQualifiedName(this.name); 1.26869 + return value.class.implementedInterfaces[qualifiedName] !== undefined; 1.26870 + }; 1.26871 + Interface.prototype.trace = function (writer) { 1.26872 + writer.enter('interface ' + this.name.getName()); 1.26873 + writer.enter('interfaceBindings: '); 1.26874 + this.interfaceBindings.trace(writer); 1.26875 + writer.outdent(); 1.26876 + writer.outdent(); 1.26877 + writer.leave('}'); 1.26878 + }; 1.26879 + Interface.prototype.call = function (self, x) { 1.26880 + return x; 1.26881 + }; 1.26882 + Interface.prototype.apply = function (self, args) { 1.26883 + return args[0]; 1.26884 + }; 1.26885 + return Interface; 1.26886 + }(); 1.26887 + Runtime.Interface = Interface; 1.26888 + function setDefaultProperties(cls) { 1.26889 + defineNonEnumerableProperty(cls.dynamicPrototype, Multiname.getPublicQualifiedName('constructor'), cls); 1.26890 + defineReadOnlyProperty(cls.traitsPrototype, 'class', cls); 1.26891 + defineReadOnlyProperty(cls.instanceConstructor, 'class', cls); 1.26892 + } 1.26893 + Runtime.setDefaultProperties = setDefaultProperties; 1.26894 + var Class = function () { 1.26895 + function Class(name, instanceConstructor, callable) { 1.26896 + this.debugName = name; 1.26897 + if (instanceConstructor) { 1.26898 + true; 1.26899 + this.instanceConstructor = instanceConstructor; 1.26900 + this.instanceConstructorNoInitialize = instanceConstructor; 1.26901 + this.hasInitialize = 0; 1.26902 + this.instanceConstructor.class = this; 1.26903 + } 1.26904 + if (!callable) { 1.26905 + callable = Shumway.AVM2.Runtime.ApplicationDomain.coerceCallable(this); 1.26906 + } else if (callable === Shumway.AVM2.Runtime.ApplicationDomain.coerceCallable) { 1.26907 + callable = Shumway.AVM2.Runtime.ApplicationDomain.coerceCallable(this); 1.26908 + } 1.26909 + defineNonEnumerableProperty(this, 'call', callable.call); 1.26910 + defineNonEnumerableProperty(this, 'apply', callable.apply); 1.26911 + } 1.26912 + Class.createClass = function (classInfo, baseClass, scope) { 1.26913 + var ci = classInfo; 1.26914 + var ii = ci.instanceInfo; 1.26915 + var domain = ci.abc.applicationDomain; 1.26916 + var className = Multiname.getName(ii.name); 1.26917 + var isNativeClass = ci.native; 1.26918 + if (isNativeClass) { 1.26919 + var buildClass = getNative(ci.native.cls); 1.26920 + if (!buildClass) { 1.26921 + Shumway.Debug.unexpected('No native for ' + ci.native.cls); 1.26922 + } 1.26923 + if (!baseClass) { 1.26924 + scope = new Scope(scope, Class); 1.26925 + } 1.26926 + } 1.26927 + var classScope = new Scope(scope, null); 1.26928 + var instanceConstructor = createFunction(ii.init, classScope, false); 1.26929 + var cls; 1.26930 + if (isNativeClass) { 1.26931 + cls = buildClass(domain, classScope, instanceConstructor, baseClass); 1.26932 + } else { 1.26933 + cls = new Class(className, instanceConstructor); 1.26934 + } 1.26935 + cls.className = className; 1.26936 + cls.classInfo = classInfo; 1.26937 + cls.scope = classScope; 1.26938 + classScope.object = cls; 1.26939 + var classNatives; 1.26940 + var instanceNatives; 1.26941 + if (isNativeClass) { 1.26942 + if (cls.native) { 1.26943 + classNatives = cls.native.static; 1.26944 + instanceNatives = cls.native.instance; 1.26945 + } 1.26946 + } else { 1.26947 + cls.extend(baseClass); 1.26948 + } 1.26949 + cls.classBindings = new ClassBindings(classInfo, classScope, classNatives); 1.26950 + cls.classBindings.applyTo(domain, cls); 1.26951 + defineReadOnlyProperty(cls, Shumway.AVM2.Runtime.VM_IS_CLASS, true); 1.26952 + cls.instanceBindings = new InstanceBindings(baseClass ? baseClass.instanceBindings : null, ii, classScope, instanceNatives); 1.26953 + if (cls.instanceConstructor) { 1.26954 + cls.instanceBindings.applyTo(domain, cls.traitsPrototype); 1.26955 + } 1.26956 + cls.implementedInterfaces = cls.instanceBindings.implementedInterfaces; 1.26957 + return cls; 1.26958 + }; 1.26959 + Class.prototype.setSymbol = function (props) { 1.26960 + this.instanceConstructor.prototype.symbol = props; 1.26961 + }; 1.26962 + Class.prototype.getSymbol = function () { 1.26963 + return this.instanceConstructor.prototype.symbol; 1.26964 + }; 1.26965 + Class.prototype.initializeInstance = function (obj) { 1.26966 + var c = this; 1.26967 + var initializes = []; 1.26968 + while (c) { 1.26969 + if (c.hasInitialize & Class.OWN_INITIALIZE) { 1.26970 + initializes.push(c.instanceConstructor.prototype.initialize); 1.26971 + } 1.26972 + c = c.baseClass; 1.26973 + } 1.26974 + var s; 1.26975 + while (s = initializes.pop()) { 1.26976 + s.call(obj); 1.26977 + } 1.26978 + Counter.count('Initialize Instance ' + obj.class); 1.26979 + }; 1.26980 + Class.prototype.createInstance = function (args) { 1.26981 + var o = Object.create(this.instanceConstructor.prototype); 1.26982 + this.instanceConstructor.apply(o, args); 1.26983 + return o; 1.26984 + }; 1.26985 + Class.prototype.createAsSymbol = function (props) { 1.26986 + var o = Object.create(this.instanceConstructor.prototype); 1.26987 + if (o.symbol) { 1.26988 + var symbol = Object.create(o.symbol); 1.26989 + for (var prop in props) { 1.26990 + symbol[prop] = props[prop]; 1.26991 + } 1.26992 + o.symbol = symbol; 1.26993 + } else { 1.26994 + o.symbol = props; 1.26995 + } 1.26996 + return o; 1.26997 + }; 1.26998 + Class.prototype.extendNative = function (baseClass, native) { 1.26999 + this.baseClass = baseClass; 1.27000 + this.dynamicPrototype = Object.getPrototypeOf(native.prototype); 1.27001 + this.instanceConstructor.prototype = this.traitsPrototype = native.prototype; 1.27002 + setDefaultProperties(this); 1.27003 + }; 1.27004 + Class.prototype.extendWrapper = function (baseClass, wrapper) { 1.27005 + true; 1.27006 + this.baseClass = baseClass; 1.27007 + this.dynamicPrototype = Object.create(baseClass.dynamicPrototype); 1.27008 + var traitsPrototype = Object.create(this.dynamicPrototype, Shumway.ObjectUtilities.getOwnPropertyDescriptors(wrapper.prototype)); 1.27009 + this.instanceConstructor.prototype = this.traitsPrototype = traitsPrototype; 1.27010 + setDefaultProperties(this); 1.27011 + }; 1.27012 + Class.prototype.extendBuiltin = function (baseClass) { 1.27013 + true; 1.27014 + this.baseClass = baseClass; 1.27015 + this.dynamicPrototype = this.traitsPrototype = this.instanceConstructor.prototype; 1.27016 + setDefaultProperties(this); 1.27017 + }; 1.27018 + Class.prototype.extend = function (baseClass) { 1.27019 + true; 1.27020 + this.baseClass = baseClass; 1.27021 + this.dynamicPrototype = Object.create(baseClass.dynamicPrototype); 1.27022 + if (baseClass.hasInitialize) { 1.27023 + var instanceConstructorNoInitialize = this.instanceConstructor; 1.27024 + var self = this; 1.27025 + this.instanceConstructor = function () { 1.27026 + self.initializeInstance(this); 1.27027 + instanceConstructorNoInitialize.apply(this, arguments); 1.27028 + }; 1.27029 + defineReadOnlyProperty(this.instanceConstructor, 'class', instanceConstructorNoInitialize.class); 1.27030 + this.hasInitialize |= Class.SUPER_INITIALIZE; 1.27031 + } 1.27032 + this.instanceConstructor.prototype = this.traitsPrototype = Object.create(this.dynamicPrototype); 1.27033 + setDefaultProperties(this); 1.27034 + }; 1.27035 + Class.prototype.setDefaultProperties = function () { 1.27036 + setDefaultProperties(this); 1.27037 + }; 1.27038 + Class.prototype.link = function (definition) { 1.27039 + true; 1.27040 + true; 1.27041 + if (definition.initialize) { 1.27042 + if (!this.hasInitialize) { 1.27043 + var instanceConstructorNoInitialize = this.instanceConstructor; 1.27044 + var self = this; 1.27045 + this.instanceConstructor = function () { 1.27046 + self.initializeInstance(this); 1.27047 + instanceConstructorNoInitialize.apply(this, arguments); 1.27048 + }; 1.27049 + defineReadOnlyProperty(this.instanceConstructor, 'class', instanceConstructorNoInitialize.class); 1.27050 + this.instanceConstructor.prototype = instanceConstructorNoInitialize.prototype; 1.27051 + } 1.27052 + this.hasInitialize |= Class.OWN_INITIALIZE; 1.27053 + } 1.27054 + var dynamicPrototype = this.dynamicPrototype; 1.27055 + var keys = Object.keys(definition); 1.27056 + for (var i = 0; i < keys.length; i++) { 1.27057 + var propertyName = keys[i]; 1.27058 + Object.defineProperty(dynamicPrototype, propertyName, Object.getOwnPropertyDescriptor(definition, propertyName)); 1.27059 + } 1.27060 + function glueProperties(obj, properties) { 1.27061 + var keys = Object.keys(properties); 1.27062 + for (var i = 0; i < keys.length; i++) { 1.27063 + var propertyName = keys[i]; 1.27064 + var propertyGlue = properties[propertyName]; 1.27065 + var propertySimpleName; 1.27066 + var glueOpenMethod = false; 1.27067 + if (propertyGlue.indexOf('open ') >= 0) { 1.27068 + propertySimpleName = propertyGlue.substring(5); 1.27069 + glueOpenMethod = true; 1.27070 + } else { 1.27071 + propertySimpleName = propertyGlue; 1.27072 + } 1.27073 + true; 1.27074 + var qn = Multiname.getQualifiedName(Multiname.fromSimpleName(propertySimpleName)); 1.27075 + if (glueOpenMethod) { 1.27076 + qn = Shumway.AVM2.Runtime.VM_OPEN_METHOD_PREFIX + qn; 1.27077 + } 1.27078 + true; 1.27079 + var descriptor = Object.getOwnPropertyDescriptor(obj, qn); 1.27080 + if (descriptor && descriptor.get) { 1.27081 + Object.defineProperty(obj, propertyName, descriptor); 1.27082 + } else { 1.27083 + Object.defineProperty(obj, propertyName, { 1.27084 + get: new Function('', 'return this.' + qn), 1.27085 + set: new Function('v', 'this.' + qn + ' = v') 1.27086 + }); 1.27087 + } 1.27088 + } 1.27089 + } 1.27090 + function generatePropertiesFromTraits(traits) { 1.27091 + var properties = createEmptyObject(); 1.27092 + traits.forEach(function (trait) { 1.27093 + var ns = trait.name.getNamespace(); 1.27094 + if (!ns.isPublic()) { 1.27095 + return; 1.27096 + } 1.27097 + properties[trait.name.getName()] = (trait.isMethod() ? 'open ' : '') + 'public ' + trait.name.getName(); 1.27098 + }); 1.27099 + return properties; 1.27100 + } 1.27101 + var glue = definition.__glue__; 1.27102 + if (!glue) { 1.27103 + return; 1.27104 + } 1.27105 + if (glue.script) { 1.27106 + if (glue.script.instance) { 1.27107 + if (Shumway.isNumber(glue.script.instance)) { 1.27108 + true; 1.27109 + glueProperties(dynamicPrototype, generatePropertiesFromTraits(this.classInfo.instanceInfo.traits)); 1.27110 + } else { 1.27111 + glueProperties(dynamicPrototype, glue.script.instance); 1.27112 + } 1.27113 + } 1.27114 + if (glue.script.static) { 1.27115 + if (Shumway.isNumber(glue.script.static)) { 1.27116 + true; 1.27117 + glueProperties(this, generatePropertiesFromTraits(this.classInfo.traits)); 1.27118 + } else { 1.27119 + glueProperties(this, glue.script.static); 1.27120 + } 1.27121 + } 1.27122 + } 1.27123 + }; 1.27124 + Class.prototype.linkNatives = function (definition) { 1.27125 + var glue = definition.__glue__; 1.27126 + this.native = glue.native; 1.27127 + }; 1.27128 + Class.prototype.verify = function () { 1.27129 + var instanceConstructor = this.instanceConstructor; 1.27130 + var tP = this.traitsPrototype; 1.27131 + var dP = this.dynamicPrototype; 1.27132 + true; 1.27133 + true; 1.27134 + true; 1.27135 + true; 1.27136 + if (tP !== Object.prototype) { 1.27137 + } 1.27138 + true; 1.27139 + }; 1.27140 + Class.prototype.coerce = function (value) { 1.27141 + return value; 1.27142 + }; 1.27143 + Class.prototype.isInstanceOf = function (value) { 1.27144 + return this.isInstance(value); 1.27145 + }; 1.27146 + Class.prototype.isInstance = function (value) { 1.27147 + if (value === null || typeof value !== 'object') { 1.27148 + return false; 1.27149 + } 1.27150 + return this.dynamicPrototype.isPrototypeOf(value); 1.27151 + }; 1.27152 + Class.prototype.trace = function (writer) { 1.27153 + var description = this.debugName + (this.baseClass ? ' extends ' + this.baseClass.debugName : ''); 1.27154 + writer.enter('class ' + description + ' {'); 1.27155 + writer.writeLn('scope: ' + this.scope); 1.27156 + writer.writeLn('baseClass: ' + this.baseClass); 1.27157 + writer.writeLn('classInfo: ' + this.classInfo); 1.27158 + writer.writeLn('dynamicPrototype: ' + this.dynamicPrototype); 1.27159 + writer.writeLn('traitsPrototype: ' + this.traitsPrototype); 1.27160 + writer.writeLn('dynamicPrototype === traitsPrototype: ' + (this.dynamicPrototype === this.traitsPrototype)); 1.27161 + writer.writeLn('instanceConstructor: ' + this.instanceConstructor); 1.27162 + writer.writeLn('instanceConstructorNoInitialize: ' + this.instanceConstructorNoInitialize); 1.27163 + writer.writeLn('instanceConstructor === instanceConstructorNoInitialize: ' + (this.instanceConstructor === this.instanceConstructorNoInitialize)); 1.27164 + var traitsPrototype = this.traitsPrototype; 1.27165 + writer.enter('traitsPrototype: '); 1.27166 + if (traitsPrototype) { 1.27167 + writer.enter('VM_SLOTS: '); 1.27168 + writer.writeArray(traitsPrototype.asSlots.byID.map(function (slot) { 1.27169 + return slot.trait; 1.27170 + })); 1.27171 + writer.outdent(); 1.27172 + writer.enter('VM_BINDINGS: '); 1.27173 + writer.writeArray(traitsPrototype.asBindings.map(function (binding) { 1.27174 + var pd = Object.getOwnPropertyDescriptor(traitsPrototype, binding); 1.27175 + var str = binding; 1.27176 + if (pd.get || pd.set) { 1.27177 + if (pd.get) { 1.27178 + str += ' getter: ' + debugName(pd.get); 1.27179 + } 1.27180 + if (pd.set) { 1.27181 + str += ' setter: ' + debugName(pd.set); 1.27182 + } 1.27183 + } else { 1.27184 + str += ' value: ' + debugName(pd.value); 1.27185 + } 1.27186 + return str; 1.27187 + })); 1.27188 + writer.outdent(); 1.27189 + writer.enter('VM_OPEN_METHODS: '); 1.27190 + writer.writeArray(toKeyValueArray(traitsPrototype.asOpenMethods).map(function (pair) { 1.27191 + return pair[0] + ': ' + debugName(pair[1]); 1.27192 + })); 1.27193 + writer.outdent(); 1.27194 + } 1.27195 + writer.enter('classBindings: '); 1.27196 + this.classBindings.trace(writer); 1.27197 + writer.outdent(); 1.27198 + writer.enter('instanceBindings: '); 1.27199 + this.instanceBindings.trace(writer); 1.27200 + writer.outdent(); 1.27201 + writer.outdent(); 1.27202 + writer.writeLn('call: ' + this.call); 1.27203 + writer.writeLn('apply: ' + this.apply); 1.27204 + writer.leave('}'); 1.27205 + }; 1.27206 + Class.prototype.toString = function () { 1.27207 + return '[class ' + this.classInfo.instanceInfo.name.name + ']'; 1.27208 + }; 1.27209 + Class.OWN_INITIALIZE = 1; 1.27210 + Class.SUPER_INITIALIZE = 2; 1.27211 + return Class; 1.27212 + }(); 1.27213 + Runtime.Class = Class; 1.27214 + var callable = Shumway.AVM2.Runtime.ApplicationDomain.coerceCallable(Class); 1.27215 + defineNonEnumerableProperty(Class, 'call', callable.call); 1.27216 + defineNonEnumerableProperty(Class, 'apply', callable.apply); 1.27217 + Class.instanceConstructor = Class; 1.27218 + Class.toString = Class.prototype.toString; 1.27219 + Class.native = { 1.27220 + instance: { 1.27221 + prototype: { 1.27222 + get: function () { 1.27223 + return this.dynamicPrototype; 1.27224 + } 1.27225 + } 1.27226 + } 1.27227 + }; 1.27228 + }(AVM2.Runtime || (AVM2.Runtime = {}))); 1.27229 + var Runtime = AVM2.Runtime; 1.27230 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.27231 + var AVM2 = Shumway.AVM2; 1.27232 +}(Shumway || (Shumway = {}))); 1.27233 +var Interface = Shumway.AVM2.Runtime.Interface; 1.27234 +var Class = Shumway.AVM2.Runtime.Class; 1.27235 +var Binding = Shumway.AVM2.Runtime.Binding; 1.27236 +var Bindings = Shumway.AVM2.Runtime.Bindings; 1.27237 +var ActivationBindings = Shumway.AVM2.Runtime.ActivationBindings; 1.27238 +var CatchBindings = Shumway.AVM2.Runtime.CatchBindings; 1.27239 +var ScriptBindings = Shumway.AVM2.Runtime.ScriptBindings; 1.27240 +var ClassBindings = Shumway.AVM2.Runtime.ClassBindings; 1.27241 +var InstanceBindings = Shumway.AVM2.Runtime.InstanceBindings; 1.27242 +var Interface = Shumway.AVM2.Runtime.Interface; 1.27243 +var Class = Shumway.AVM2.Runtime.Class; 1.27244 +var XRegExp = function (undefined) { 1.27245 + var REGEX_DATA = 'xregexp', self, features = { 1.27246 + astral: false, 1.27247 + natives: false 1.27248 + }, nativ = { 1.27249 + exec: RegExp.prototype.exec, 1.27250 + test: RegExp.prototype.test, 1.27251 + match: String.prototype.match, 1.27252 + replace: String.prototype.replace, 1.27253 + split: String.prototype.split 1.27254 + }, fixed = {}, cache = {}, patternCache = {}, tokens = [], defaultScope = 'default', classScope = 'class', nativeTokens = { 1.27255 + 'default': /\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??|[\s\S]/, 1.27256 + 'class': /\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|[\s\S]/ 1.27257 + }, replacementToken = /\$(?:{([\w$]+)}|([\d$&`']))/g, correctExecNpcg = nativ.exec.call(/()??/, '')[1] === undefined, hasNativeY = RegExp.prototype.sticky !== undefined, registeredFlags = { 1.27258 + g: true, 1.27259 + i: true, 1.27260 + m: true, 1.27261 + y: hasNativeY 1.27262 + }, toString = {}.toString, add; 1.27263 + function augment(regex, captureNames, addProto) { 1.27264 + var p; 1.27265 + if (addProto) { 1.27266 + if (regex.__proto__) { 1.27267 + regex.__proto__ = self.prototype; 1.27268 + } else { 1.27269 + for (p in self.prototype) { 1.27270 + regex[p] = self.prototype[p]; 1.27271 + } 1.27272 + } 1.27273 + } 1.27274 + regex[REGEX_DATA] = { 1.27275 + captureNames: captureNames 1.27276 + }; 1.27277 + return regex; 1.27278 + } 1.27279 + function clipDuplicates(str) { 1.27280 + return nativ.replace.call(str, /([\s\S])(?=[\s\S]*\1)/g, ''); 1.27281 + } 1.27282 + function copy(regex, options) { 1.27283 + if (!self.isRegExp(regex)) { 1.27284 + throw new TypeError('Type RegExp expected'); 1.27285 + } 1.27286 + var flags = nativ.exec.call(/\/([a-z]*)$/i, String(regex))[1]; 1.27287 + options = options || {}; 1.27288 + if (options.add) { 1.27289 + flags = clipDuplicates(flags + options.add); 1.27290 + } 1.27291 + if (options.remove) { 1.27292 + flags = nativ.replace.call(flags, new RegExp('[' + options.remove + ']+', 'g'), ''); 1.27293 + } 1.27294 + regex = augment(new RegExp(regex.source, flags), hasNamedCapture(regex) ? regex[REGEX_DATA].captureNames.slice(0) : null, options.addProto); 1.27295 + return regex; 1.27296 + } 1.27297 + function getBaseProps() { 1.27298 + return { 1.27299 + captureNames: null 1.27300 + }; 1.27301 + } 1.27302 + function hasNamedCapture(regex) { 1.27303 + return !(!(regex[REGEX_DATA] && regex[REGEX_DATA].captureNames)); 1.27304 + } 1.27305 + function indexOf(array, value) { 1.27306 + if (Array.prototype.indexOf) { 1.27307 + return array.indexOf(value); 1.27308 + } 1.27309 + var len = array.length, i; 1.27310 + for (i = 0; i < len; ++i) { 1.27311 + if (array[i] === value) { 1.27312 + return i; 1.27313 + } 1.27314 + } 1.27315 + return -1; 1.27316 + } 1.27317 + function isType(value, type) { 1.27318 + return toString.call(value) === '[object ' + type + ']'; 1.27319 + } 1.27320 + function isQuantifierNext(pattern, pos, flags) { 1.27321 + return nativ.test.call(flags.indexOf('x') > -1 ? /^(?:\s+|#.*|\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/ : /^(?:\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/, pattern.slice(pos)); 1.27322 + } 1.27323 + function prepareFlags(pattern, flags) { 1.27324 + var i; 1.27325 + if (clipDuplicates(flags) !== flags) { 1.27326 + throw new SyntaxError('Invalid duplicate regex flag ' + flags); 1.27327 + } 1.27328 + pattern = nativ.replace.call(pattern, /^\(\?([\w$]+)\)/, function ($0, $1) { 1.27329 + if (nativ.test.call(/[gy]/, $1)) { 1.27330 + throw new SyntaxError('Cannot use flag g or y in mode modifier ' + $0); 1.27331 + } 1.27332 + flags = clipDuplicates(flags + $1); 1.27333 + return ''; 1.27334 + }); 1.27335 + for (i = 0; i < flags.length; ++i) { 1.27336 + if (!registeredFlags[flags.charAt(i)]) { 1.27337 + throw new SyntaxError('Unknown regex flag ' + flags.charAt(i)); 1.27338 + } 1.27339 + } 1.27340 + return { 1.27341 + pattern: pattern, 1.27342 + flags: flags 1.27343 + }; 1.27344 + } 1.27345 + function prepareOptions(value) { 1.27346 + value = value || {}; 1.27347 + if (isType(value, 'String')) { 1.27348 + value = self.forEach(value, /[^\s,]+/, function (match) { 1.27349 + this[match] = true; 1.27350 + }, {}); 1.27351 + } 1.27352 + return value; 1.27353 + } 1.27354 + function registerFlag(flag) { 1.27355 + if (!/^[\w$]$/.test(flag)) { 1.27356 + throw new Error('Flag must be a single character A-Za-z0-9_$'); 1.27357 + } 1.27358 + registeredFlags[flag] = true; 1.27359 + } 1.27360 + function runTokens(pattern, flags, pos, scope, context) { 1.27361 + var i = tokens.length, result = null, match, t; 1.27362 + while (i--) { 1.27363 + t = tokens[i]; 1.27364 + if ((t.scope === scope || t.scope === 'all') && (!t.flag || flags.indexOf(t.flag) > -1)) { 1.27365 + match = self.exec(pattern, t.regex, pos, 'sticky'); 1.27366 + if (match) { 1.27367 + result = { 1.27368 + matchLength: match[0].length, 1.27369 + output: t.handler.call(context, match, scope, flags), 1.27370 + reparse: t.reparse 1.27371 + }; 1.27372 + break; 1.27373 + } 1.27374 + } 1.27375 + } 1.27376 + return result; 1.27377 + } 1.27378 + function setAstral(on) { 1.27379 + self.cache.flush('patterns'); 1.27380 + features.astral = on; 1.27381 + } 1.27382 + function setNatives(on) { 1.27383 + RegExp.prototype.exec = (on ? fixed : nativ).exec; 1.27384 + RegExp.prototype.test = (on ? fixed : nativ).test; 1.27385 + String.prototype.match = (on ? fixed : nativ).match; 1.27386 + String.prototype.replace = (on ? fixed : nativ).replace; 1.27387 + String.prototype.split = (on ? fixed : nativ).split; 1.27388 + features.natives = on; 1.27389 + } 1.27390 + function toObject(value) { 1.27391 + if (value == null) { 1.27392 + throw new TypeError('Cannot convert null or undefined to object'); 1.27393 + } 1.27394 + return value; 1.27395 + } 1.27396 + self = function (pattern, flags) { 1.27397 + var context = { 1.27398 + hasNamedCapture: false, 1.27399 + captureNames: [] 1.27400 + }, scope = defaultScope, output = '', pos = 0, result, token, key; 1.27401 + if (self.isRegExp(pattern)) { 1.27402 + if (flags !== undefined) { 1.27403 + throw new TypeError('Cannot supply flags when copying a RegExp'); 1.27404 + } 1.27405 + return copy(pattern, { 1.27406 + addProto: true 1.27407 + }); 1.27408 + } 1.27409 + pattern = pattern === undefined ? '' : String(pattern); 1.27410 + flags = flags === undefined ? '' : String(flags); 1.27411 + key = pattern + '***' + flags; 1.27412 + if (!patternCache[key]) { 1.27413 + result = prepareFlags(pattern, flags); 1.27414 + pattern = result.pattern; 1.27415 + flags = result.flags; 1.27416 + while (pos < pattern.length) { 1.27417 + do { 1.27418 + result = runTokens(pattern, flags, pos, scope, context); 1.27419 + if (result && result.reparse) { 1.27420 + pattern = pattern.slice(0, pos) + result.output + pattern.slice(pos + result.matchLength); 1.27421 + } 1.27422 + } while (result && result.reparse); 1.27423 + if (result) { 1.27424 + output += result.output; 1.27425 + pos += result.matchLength || 1; 1.27426 + } else { 1.27427 + token = self.exec(pattern, nativeTokens[scope], pos, 'sticky')[0]; 1.27428 + output += token; 1.27429 + pos += token.length; 1.27430 + if (token === '[' && scope === defaultScope) { 1.27431 + scope = classScope; 1.27432 + } else if (token === ']' && scope === classScope) { 1.27433 + scope = defaultScope; 1.27434 + } 1.27435 + } 1.27436 + } 1.27437 + patternCache[key] = { 1.27438 + pattern: nativ.replace.call(output, /\(\?:\)(?=\(\?:\))|^\(\?:\)|\(\?:\)$/g, ''), 1.27439 + flags: nativ.replace.call(flags, /[^gimy]+/g, ''), 1.27440 + captures: context.hasNamedCapture ? context.captureNames : null 1.27441 + }; 1.27442 + } 1.27443 + key = patternCache[key]; 1.27444 + return augment(new RegExp(key.pattern, key.flags), key.captures, true); 1.27445 + }; 1.27446 + self.prototype = new RegExp(); 1.27447 + self.version = '3.0.0-pre'; 1.27448 + self.addToken = function (regex, handler, options) { 1.27449 + options = options || {}; 1.27450 + var optionalFlags = options.optionalFlags, i; 1.27451 + if (options.flag) { 1.27452 + registerFlag(options.flag); 1.27453 + } 1.27454 + if (optionalFlags) { 1.27455 + optionalFlags = nativ.split.call(optionalFlags, ''); 1.27456 + for (i = 0; i < optionalFlags.length; ++i) { 1.27457 + registerFlag(optionalFlags[i]); 1.27458 + } 1.27459 + } 1.27460 + tokens.push({ 1.27461 + regex: copy(regex, { 1.27462 + add: 'g' + (hasNativeY ? 'y' : '') 1.27463 + }), 1.27464 + handler: handler, 1.27465 + scope: options.scope || defaultScope, 1.27466 + flag: options.flag, 1.27467 + reparse: options.reparse 1.27468 + }); 1.27469 + self.cache.flush('patterns'); 1.27470 + }; 1.27471 + self.cache = function (pattern, flags) { 1.27472 + var key = pattern + '***' + (flags || ''); 1.27473 + return cache[key] || (cache[key] = self(pattern, flags)); 1.27474 + }; 1.27475 + self.cache.flush = function (cacheName) { 1.27476 + if (cacheName === 'patterns') { 1.27477 + patternCache = {}; 1.27478 + } else { 1.27479 + cache = {}; 1.27480 + } 1.27481 + }; 1.27482 + self.escape = function (str) { 1.27483 + return nativ.replace.call(toObject(str), /[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); 1.27484 + }; 1.27485 + self.exec = function (str, regex, pos, sticky) { 1.27486 + var cacheFlags = 'g', match, r2; 1.27487 + if (hasNativeY && (sticky || regex.sticky && sticky !== false)) { 1.27488 + cacheFlags += 'y'; 1.27489 + } 1.27490 + regex[REGEX_DATA] = regex[REGEX_DATA] || getBaseProps(); 1.27491 + r2 = regex[REGEX_DATA][cacheFlags] || (regex[REGEX_DATA][cacheFlags] = copy(regex, { 1.27492 + add: cacheFlags, 1.27493 + remove: sticky === false ? 'y' : '' 1.27494 + })); 1.27495 + r2.lastIndex = pos = pos || 0; 1.27496 + match = fixed.exec.call(r2, str); 1.27497 + if (sticky && match && match.index !== pos) { 1.27498 + match = null; 1.27499 + } 1.27500 + if (regex.global) { 1.27501 + regex.lastIndex = match ? r2.lastIndex : 0; 1.27502 + } 1.27503 + return match; 1.27504 + }; 1.27505 + self.forEach = function (str, regex, callback, context) { 1.27506 + var pos = 0, i = -1, match; 1.27507 + while (match = self.exec(str, regex, pos)) { 1.27508 + callback.call(context, match, ++i, str, regex); 1.27509 + pos = match.index + (match[0].length || 1); 1.27510 + } 1.27511 + return context; 1.27512 + }; 1.27513 + self.globalize = function (regex) { 1.27514 + return copy(regex, { 1.27515 + add: 'g', 1.27516 + addProto: true 1.27517 + }); 1.27518 + }; 1.27519 + self.install = function (options) { 1.27520 + options = prepareOptions(options); 1.27521 + if (!features.astral && options.astral) { 1.27522 + setAstral(true); 1.27523 + } 1.27524 + if (!features.natives && options.natives) { 1.27525 + setNatives(true); 1.27526 + } 1.27527 + }; 1.27528 + self.isInstalled = function (feature) { 1.27529 + return !(!features[feature]); 1.27530 + }; 1.27531 + self.isRegExp = function (value) { 1.27532 + return toString.call(value) === '[object RegExp]'; 1.27533 + }; 1.27534 + self.match = function (str, regex, scope) { 1.27535 + var global = regex.global && scope !== 'one' || scope === 'all', cacheFlags = (global ? 'g' : '') + (regex.sticky ? 'y' : ''), result, r2; 1.27536 + regex[REGEX_DATA] = regex[REGEX_DATA] || getBaseProps(); 1.27537 + r2 = regex[REGEX_DATA][cacheFlags || 'noGY'] || (regex[REGEX_DATA][cacheFlags || 'noGY'] = copy(regex, { 1.27538 + add: cacheFlags, 1.27539 + remove: scope === 'one' ? 'g' : '' 1.27540 + })); 1.27541 + result = nativ.match.call(toObject(str), r2); 1.27542 + if (regex.global) { 1.27543 + regex.lastIndex = scope === 'one' && result ? result.index + result[0].length : 0; 1.27544 + } 1.27545 + return global ? result || [] : result && result[0]; 1.27546 + }; 1.27547 + self.matchChain = function (str, chain) { 1.27548 + return function recurseChain(values, level) { 1.27549 + var item = chain[level].regex ? chain[level] : { 1.27550 + regex: chain[level] 1.27551 + }, matches = [], addMatch = function (match) { 1.27552 + if (item.backref) { 1.27553 + if (!(match.hasOwnProperty(item.backref) || +item.backref < match.length)) { 1.27554 + throw new ReferenceError('Backreference to undefined group: ' + item.backref); 1.27555 + } 1.27556 + matches.push(match[item.backref] || ''); 1.27557 + } else { 1.27558 + matches.push(match[0]); 1.27559 + } 1.27560 + }, i; 1.27561 + for (i = 0; i < values.length; ++i) { 1.27562 + self.forEach(values[i], item.regex, addMatch); 1.27563 + } 1.27564 + return level === chain.length - 1 || !matches.length ? matches : recurseChain(matches, level + 1); 1.27565 + }([ 1.27566 + str 1.27567 + ], 0); 1.27568 + }; 1.27569 + self.replace = function (str, search, replacement, scope) { 1.27570 + var isRegex = self.isRegExp(search), global = search.global && scope !== 'one' || scope === 'all', cacheFlags = (global ? 'g' : '') + (search.sticky ? 'y' : ''), s2 = search, result; 1.27571 + if (isRegex) { 1.27572 + search[REGEX_DATA] = search[REGEX_DATA] || getBaseProps(); 1.27573 + s2 = search[REGEX_DATA][cacheFlags || 'noGY'] || (search[REGEX_DATA][cacheFlags || 'noGY'] = copy(search, { 1.27574 + add: cacheFlags, 1.27575 + remove: scope === 'one' ? 'g' : '' 1.27576 + })); 1.27577 + } else if (global) { 1.27578 + s2 = new RegExp(self.escape(String(search)), 'g'); 1.27579 + } 1.27580 + result = fixed.replace.call(toObject(str), s2, replacement); 1.27581 + if (isRegex && search.global) { 1.27582 + search.lastIndex = 0; 1.27583 + } 1.27584 + return result; 1.27585 + }; 1.27586 + self.replaceEach = function (str, replacements) { 1.27587 + var i, r; 1.27588 + for (i = 0; i < replacements.length; ++i) { 1.27589 + r = replacements[i]; 1.27590 + str = self.replace(str, r[0], r[1], r[2]); 1.27591 + } 1.27592 + return str; 1.27593 + }; 1.27594 + self.split = function (str, separator, limit) { 1.27595 + return fixed.split.call(toObject(str), separator, limit); 1.27596 + }; 1.27597 + self.test = function (str, regex, pos, sticky) { 1.27598 + return !(!self.exec(str, regex, pos, sticky)); 1.27599 + }; 1.27600 + self.uninstall = function (options) { 1.27601 + options = prepareOptions(options); 1.27602 + if (features.astral && options.astral) { 1.27603 + setAstral(false); 1.27604 + } 1.27605 + if (features.natives && options.natives) { 1.27606 + setNatives(false); 1.27607 + } 1.27608 + }; 1.27609 + self.union = function (patterns, flags) { 1.27610 + var parts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*]/g, output = [], numCaptures = 0, numPriorCaptures, captureNames, pattern, rewrite = function (match, paren, backref) { 1.27611 + var name = captureNames[numCaptures - numPriorCaptures]; 1.27612 + if (paren) { 1.27613 + ++numCaptures; 1.27614 + if (name) { 1.27615 + return '(?<' + name + '>'; 1.27616 + } 1.27617 + } else if (backref) { 1.27618 + return '\\' + (+backref + numPriorCaptures); 1.27619 + } 1.27620 + return match; 1.27621 + }, i; 1.27622 + if (!(isType(patterns, 'Array') && patterns.length)) { 1.27623 + throw new TypeError('Must provide a nonempty array of patterns to merge'); 1.27624 + } 1.27625 + for (i = 0; i < patterns.length; ++i) { 1.27626 + pattern = patterns[i]; 1.27627 + if (self.isRegExp(pattern)) { 1.27628 + numPriorCaptures = numCaptures; 1.27629 + captureNames = pattern[REGEX_DATA] && pattern[REGEX_DATA].captureNames || []; 1.27630 + output.push(nativ.replace.call(self(pattern.source).source, parts, rewrite)); 1.27631 + } else { 1.27632 + output.push(self.escape(pattern)); 1.27633 + } 1.27634 + } 1.27635 + return self(output.join('|'), flags); 1.27636 + }; 1.27637 + fixed.exec = function (str) { 1.27638 + var origLastIndex = this.lastIndex, match = nativ.exec.apply(this, arguments), name, r2, i; 1.27639 + if (match) { 1.27640 + if (!correctExecNpcg && match.length > 1 && indexOf(match, '') > -1) { 1.27641 + r2 = copy(this, { 1.27642 + remove: 'g' 1.27643 + }); 1.27644 + nativ.replace.call(String(str).slice(match.index), r2, function () { 1.27645 + var len = arguments.length, i; 1.27646 + for (i = 1; i < len - 2; ++i) { 1.27647 + if (arguments[i] === undefined) { 1.27648 + match[i] = undefined; 1.27649 + } 1.27650 + } 1.27651 + }); 1.27652 + } 1.27653 + if (this[REGEX_DATA] && this[REGEX_DATA].captureNames) { 1.27654 + for (i = 1; i < match.length; ++i) { 1.27655 + name = this[REGEX_DATA].captureNames[i - 1]; 1.27656 + if (name) { 1.27657 + match[name] = match[i]; 1.27658 + } 1.27659 + } 1.27660 + } 1.27661 + if (this.global && !match[0].length && this.lastIndex > match.index) { 1.27662 + this.lastIndex = match.index; 1.27663 + } 1.27664 + } 1.27665 + if (!this.global) { 1.27666 + this.lastIndex = origLastIndex; 1.27667 + } 1.27668 + return match; 1.27669 + }; 1.27670 + fixed.test = function (str) { 1.27671 + return !(!fixed.exec.call(this, str)); 1.27672 + }; 1.27673 + fixed.match = function (regex) { 1.27674 + var result; 1.27675 + if (!self.isRegExp(regex)) { 1.27676 + regex = new RegExp(regex); 1.27677 + } else if (regex.global) { 1.27678 + result = nativ.match.apply(this, arguments); 1.27679 + regex.lastIndex = 0; 1.27680 + return result; 1.27681 + } 1.27682 + return fixed.exec.call(regex, toObject(this)); 1.27683 + }; 1.27684 + fixed.replace = function (search, replacement) { 1.27685 + var isRegex = self.isRegExp(search), origLastIndex, captureNames, result; 1.27686 + if (isRegex) { 1.27687 + if (search[REGEX_DATA]) { 1.27688 + captureNames = search[REGEX_DATA].captureNames; 1.27689 + } 1.27690 + origLastIndex = search.lastIndex; 1.27691 + } else { 1.27692 + search += ''; 1.27693 + } 1.27694 + if (isType(replacement, 'Function')) { 1.27695 + result = nativ.replace.call(String(this), search, function () { 1.27696 + var args = arguments, i; 1.27697 + if (captureNames) { 1.27698 + args[0] = new String(args[0]); 1.27699 + for (i = 0; i < captureNames.length; ++i) { 1.27700 + if (captureNames[i]) { 1.27701 + args[0][captureNames[i]] = args[i + 1]; 1.27702 + } 1.27703 + } 1.27704 + } 1.27705 + if (isRegex && search.global) { 1.27706 + search.lastIndex = args[args.length - 2] + args[0].length; 1.27707 + } 1.27708 + return replacement.apply(undefined, args); 1.27709 + }); 1.27710 + } else { 1.27711 + result = nativ.replace.call(this == null ? this : String(this), search, function () { 1.27712 + var args = arguments; 1.27713 + return nativ.replace.call(String(replacement), replacementToken, function ($0, $1, $2) { 1.27714 + var n; 1.27715 + if ($1) { 1.27716 + n = +$1; 1.27717 + if (n <= args.length - 3) { 1.27718 + return args[n] || ''; 1.27719 + } 1.27720 + n = captureNames ? indexOf(captureNames, $1) : -1; 1.27721 + if (n < 0) { 1.27722 + throw new SyntaxError('Backreference to undefined group ' + $0); 1.27723 + } 1.27724 + return args[n + 1] || ''; 1.27725 + } 1.27726 + if ($2 === '$') { 1.27727 + return '$'; 1.27728 + } 1.27729 + if ($2 === '&' || +$2 === 0) { 1.27730 + return args[0]; 1.27731 + } 1.27732 + if ($2 === '`') { 1.27733 + return args[args.length - 1].slice(0, args[args.length - 2]); 1.27734 + } 1.27735 + if ($2 === '\'') { 1.27736 + return args[args.length - 1].slice(args[args.length - 2] + args[0].length); 1.27737 + } 1.27738 + $2 = +$2; 1.27739 + if (!isNaN($2)) { 1.27740 + if ($2 > args.length - 3) { 1.27741 + throw new SyntaxError('Backreference to undefined group ' + $0); 1.27742 + } 1.27743 + return args[$2] || ''; 1.27744 + } 1.27745 + throw new SyntaxError('Invalid token ' + $0); 1.27746 + }); 1.27747 + }); 1.27748 + } 1.27749 + if (isRegex) { 1.27750 + if (search.global) { 1.27751 + search.lastIndex = 0; 1.27752 + } else { 1.27753 + search.lastIndex = origLastIndex; 1.27754 + } 1.27755 + } 1.27756 + return result; 1.27757 + }; 1.27758 + fixed.split = function (separator, limit) { 1.27759 + if (!self.isRegExp(separator)) { 1.27760 + return nativ.split.apply(this, arguments); 1.27761 + } 1.27762 + var str = String(this), output = [], origLastIndex = separator.lastIndex, lastLastIndex = 0, lastLength; 1.27763 + limit = (limit === undefined ? -1 : limit) >>> 0; 1.27764 + self.forEach(str, separator, function (match) { 1.27765 + if (match.index + match[0].length > lastLastIndex) { 1.27766 + output.push(str.slice(lastLastIndex, match.index)); 1.27767 + if (match.length > 1 && match.index < str.length) { 1.27768 + Array.prototype.push.apply(output, match.slice(1)); 1.27769 + } 1.27770 + lastLength = match[0].length; 1.27771 + lastLastIndex = match.index + lastLength; 1.27772 + } 1.27773 + }); 1.27774 + if (lastLastIndex === str.length) { 1.27775 + if (!nativ.test.call(separator, '') || lastLength) { 1.27776 + output.push(''); 1.27777 + } 1.27778 + } else { 1.27779 + output.push(str.slice(lastLastIndex)); 1.27780 + } 1.27781 + separator.lastIndex = origLastIndex; 1.27782 + return output.length > limit ? output.slice(0, limit) : output; 1.27783 + }; 1.27784 + add = self.addToken; 1.27785 + add(/\\([ABCE-RTUVXYZaeg-mopqyz]|c(?![A-Za-z])|u(?![\dA-Fa-f]{4})|x(?![\dA-Fa-f]{2}))/, function (match, scope) { 1.27786 + if (match[1] === 'B' && scope === defaultScope) { 1.27787 + return match[0]; 1.27788 + } 1.27789 + throw new SyntaxError('Invalid escape ' + match[0]); 1.27790 + }, { 1.27791 + scope: 'all' 1.27792 + }); 1.27793 + add(/\[(\^?)]/, function (match) { 1.27794 + return match[1] ? '[\\s\\S]' : '\\b\\B'; 1.27795 + }); 1.27796 + add(/\(\?#[^)]*\)/, function (match, scope, flags) { 1.27797 + return isQuantifierNext(match.input, match.index + match[0].length, flags) ? '' : '(?:)'; 1.27798 + }); 1.27799 + add(/\s+|#.*/, function (match, scope, flags) { 1.27800 + return isQuantifierNext(match.input, match.index + match[0].length, flags) ? '' : '(?:)'; 1.27801 + }, { 1.27802 + flag: 'x' 1.27803 + }); 1.27804 + add(/\./, function () { 1.27805 + return '[\\s\\S]'; 1.27806 + }, { 1.27807 + flag: 's' 1.27808 + }); 1.27809 + add(/\\k<([\w$]+)>/, function (match) { 1.27810 + var index = isNaN(match[1]) ? indexOf(this.captureNames, match[1]) + 1 : +match[1], endIndex = match.index + match[0].length; 1.27811 + if (!index || index > this.captureNames.length) { 1.27812 + throw new SyntaxError('Backreference to undefined group ' + match[0]); 1.27813 + } 1.27814 + return '\\' + index + (endIndex === match.input.length || isNaN(match.input.charAt(endIndex)) ? '' : '(?:)'); 1.27815 + }); 1.27816 + add(/\\(\d+)/, function (match, scope) { 1.27817 + if (!(scope === defaultScope && /^[1-9]/.test(match[1]) && +match[1] <= this.captureNames.length) && match[1] !== '0') { 1.27818 + throw new SyntaxError('Cannot use octal escape or backreference to undefined group ' + match[0]); 1.27819 + } 1.27820 + return match[0]; 1.27821 + }, { 1.27822 + scope: 'all' 1.27823 + }); 1.27824 + add(/\(\?P?<([\w$]+)>/, function (match) { 1.27825 + if (!isNaN(match[1])) { 1.27826 + throw new SyntaxError('Cannot use integer as capture name ' + match[0]); 1.27827 + } 1.27828 + if (match[1] === 'length' || match[1] === '__proto__') { 1.27829 + throw new SyntaxError('Cannot use reserved word as capture name ' + match[0]); 1.27830 + } 1.27831 + if (indexOf(this.captureNames, match[1]) > -1) { 1.27832 + throw new SyntaxError('Cannot use same name for multiple groups ' + match[0]); 1.27833 + } 1.27834 + this.captureNames.push(match[1]); 1.27835 + this.hasNamedCapture = true; 1.27836 + return '('; 1.27837 + }); 1.27838 + add(/\((?!\?)/, function (match, scope, flags) { 1.27839 + if (flags.indexOf('n') > -1) { 1.27840 + return '(?:'; 1.27841 + } 1.27842 + this.captureNames.push(null); 1.27843 + return '('; 1.27844 + }, { 1.27845 + optionalFlags: 'n' 1.27846 + }); 1.27847 + return self; 1.27848 + }(); 1.27849 +var Namespace = Shumway.AVM2.ABC.Namespace; 1.27850 +var Shumway; 1.27851 +(function (Shumway) { 1.27852 + (function (AVM2) { 1.27853 + (function (Runtime) { 1.27854 + var Option = Shumway.Options.Option; 1.27855 + var OptionSet = Shumway.Options.OptionSet; 1.27856 + var runtimeOptions = systemOptions.register(new OptionSet('Runtime Options')); 1.27857 + var traceScope = runtimeOptions.register(new Option('ts', 'traceScope', 'boolean', false, 'trace scope execution')); 1.27858 + Runtime.traceExecution = runtimeOptions.register(new Option('tx', 'traceExecution', 'number', 0, 'trace script execution')); 1.27859 + Runtime.traceCallExecution = runtimeOptions.register(new Option('txc', 'traceCallExecution', 'number', 0, 'trace call execution')); 1.27860 + var functionBreak = runtimeOptions.register(new Option('fb', 'functionBreak', 'number', -1, 'Inserts a debugBreak at function index #.')); 1.27861 + var compileOnly = runtimeOptions.register(new Option('co', 'compileOnly', 'number', -1, 'Compiles only function number.')); 1.27862 + var compileUntil = runtimeOptions.register(new Option('cu', 'compileUntil', 'number', -1, 'Compiles only until a function number.')); 1.27863 + Runtime.debuggerMode = runtimeOptions.register(new Option('dm', 'debuggerMode', 'boolean', false, 'matches avm2 debugger build semantics')); 1.27864 + Runtime.enableVerifier = runtimeOptions.register(new Option('verify', 'verify', 'boolean', false, 'Enable verifier.')); 1.27865 + Runtime.globalMultinameAnalysis = runtimeOptions.register(new Option('ga', 'globalMultinameAnalysis', 'boolean', false, 'Global multiname analysis.')); 1.27866 + var traceInlineCaching = runtimeOptions.register(new Option('tic', 'traceInlineCaching', 'boolean', false, 'Trace inline caching execution.')); 1.27867 + Runtime.codeCaching = runtimeOptions.register(new Option('cc', 'codeCaching', 'boolean', false, 'Enable code caching.')); 1.27868 + var compilerEnableExceptions = runtimeOptions.register(new Option('cex', 'exceptions', 'boolean', false, 'Compile functions with catch blocks.')); 1.27869 + var compilerMaximumMethodSize = runtimeOptions.register(new Option('cmms', 'maximumMethodSize', 'number', 4 * 1024, 'Compiler maximum method size.')); 1.27870 + Runtime.traceClasses = runtimeOptions.register(new Option('tc', 'traceClasses', 'boolean', false, 'trace class creation')); 1.27871 + Runtime.traceDomain = runtimeOptions.register(new Option('td', 'traceDomain', 'boolean', false, 'trace domain property access')); 1.27872 + Runtime.sealConstTraits = false; 1.27873 + Runtime.useAsAdd = true; 1.27874 + var useSurrogates = true; 1.27875 + var callCounter = new Shumway.Metrics.Counter(true); 1.27876 + var Multiname = Shumway.AVM2.ABC.Multiname; 1.27877 + var Namespace = Shumway.AVM2.ABC.Namespace; 1.27878 + var MethodInfo = Shumway.AVM2.ABC.MethodInfo; 1.27879 + var ClassInfo = Shumway.AVM2.ABC.ClassInfo; 1.27880 + var InstanceInfo = Shumway.AVM2.ABC.InstanceInfo; 1.27881 + var ScriptInfo = Shumway.AVM2.ABC.ScriptInfo; 1.27882 + var SORT = Shumway.AVM2.ABC.SORT; 1.27883 + var Trait = Shumway.AVM2.ABC.Trait; 1.27884 + var IndentingWriter = Shumway.IndentingWriter; 1.27885 + var hasOwnProperty = Shumway.ObjectUtilities.hasOwnProperty; 1.27886 + var createMap = Shumway.ObjectUtilities.createMap; 1.27887 + var cloneObject = Shumway.ObjectUtilities.cloneObject; 1.27888 + var copyProperties = Shumway.ObjectUtilities.copyProperties; 1.27889 + var createEmptyObject = Shumway.ObjectUtilities.createEmptyObject; 1.27890 + var boxValue = Shumway.ObjectUtilities.boxValue; 1.27891 + var bindSafely = Shumway.FunctionUtilities.bindSafely; 1.27892 + var defineNonEnumerableGetterOrSetter = Shumway.ObjectUtilities.defineNonEnumerableGetterOrSetter; 1.27893 + var defineNonEnumerableProperty = Shumway.ObjectUtilities.defineNonEnumerableProperty; 1.27894 + var defineReadOnlyProperty = Shumway.ObjectUtilities.defineReadOnlyProperty; 1.27895 + var defineNonEnumerableGetter = Shumway.ObjectUtilities.defineNonEnumerableGetter; 1.27896 + var makeForwardingGetter = Shumway.FunctionUtilities.makeForwardingGetter; 1.27897 + var makeForwardingSetter = Shumway.FunctionUtilities.makeForwardingSetter; 1.27898 + var toSafeString = Shumway.StringUtilities.toSafeString; 1.27899 + var toSafeArrayString = Shumway.StringUtilities.toSafeArrayString; 1.27900 + var TRAIT = Shumway.AVM2.ABC.TRAIT; 1.27901 + Runtime.VM_SLOTS = 'asSlots'; 1.27902 + Runtime.VM_LENGTH = 'asLength'; 1.27903 + Runtime.VM_BINDINGS = 'asBindings'; 1.27904 + Runtime.VM_NATIVE_PROTOTYPE_FLAG = 'asIsNative'; 1.27905 + Runtime.VM_OPEN_METHODS = 'asOpenMethods'; 1.27906 + Runtime.VM_IS_CLASS = 'asIsClass'; 1.27907 + Runtime.VM_IS_PROXY = 'asIsProxy'; 1.27908 + Runtime.VM_CALL_PROXY = 'asCallProxy'; 1.27909 + Runtime.VM_OPEN_METHOD_PREFIX = 'm'; 1.27910 + Runtime.VM_MEMOIZER_PREFIX = 'z'; 1.27911 + Runtime.VM_OPEN_SET_METHOD_PREFIX = 's'; 1.27912 + Runtime.VM_OPEN_GET_METHOD_PREFIX = 'g'; 1.27913 + Runtime.VM_NATIVE_BUILTIN_ORIGINALS = 'asOriginals'; 1.27914 + Runtime.VM_METHOD_OVERRIDES = createEmptyObject(); 1.27915 + var vmNextInterpreterFunctionId = 1; 1.27916 + var vmNextCompiledFunctionId = 1; 1.27917 + var totalFunctionCount = 0; 1.27918 + var compiledFunctionCount = 0; 1.27919 + var compilationCount = 0; 1.27920 + function isClass(object) { 1.27921 + true; 1.27922 + return Object.hasOwnProperty.call(object, Runtime.VM_IS_CLASS); 1.27923 + } 1.27924 + Runtime.isClass = isClass; 1.27925 + function isNativePrototype(object) { 1.27926 + return Object.prototype.hasOwnProperty.call(object, Runtime.VM_NATIVE_PROTOTYPE_FLAG); 1.27927 + } 1.27928 + Runtime.isNativePrototype = isNativePrototype; 1.27929 + var traitsWriter = null; 1.27930 + var callWriter = null; 1.27931 + function patch(patchTargets, value) { 1.27932 + true; 1.27933 + for (var i = 0; i < patchTargets.length; i++) { 1.27934 + var patchTarget = patchTargets[i]; 1.27935 + if (Runtime.traceExecution.value >= 3) { 1.27936 + var str = 'Patching: '; 1.27937 + if (patchTarget.name) { 1.27938 + str += patchTarget.name; 1.27939 + } else if (patchTarget.get) { 1.27940 + str += 'get ' + patchTarget.get; 1.27941 + } else if (patchTarget.set) { 1.27942 + str += 'set ' + patchTarget.set; 1.27943 + } 1.27944 + traitsWriter && traitsWriter.redLn(str); 1.27945 + } 1.27946 + if (patchTarget.get) { 1.27947 + defineNonEnumerableGetterOrSetter(patchTarget.object, patchTarget.get, value, true); 1.27948 + } else if (patchTarget.set) { 1.27949 + defineNonEnumerableGetterOrSetter(patchTarget.object, patchTarget.set, value, false); 1.27950 + } else { 1.27951 + defineNonEnumerableProperty(patchTarget.object, patchTarget.name, value); 1.27952 + } 1.27953 + } 1.27954 + } 1.27955 + Runtime.patch = patch; 1.27956 + function applyNonMemoizedMethodTrait(qn, trait, object, scope, natives) { 1.27957 + true; 1.27958 + if (trait.isMethod()) { 1.27959 + var trampoline = Shumway.AVM2.Runtime.makeTrampoline(function (self) { 1.27960 + var fn = getTraitFunction(trait, scope, natives); 1.27961 + patch(self.patchTargets, fn); 1.27962 + return fn; 1.27963 + }, trait.methodInfo.parameters.length); 1.27964 + trampoline.patchTargets = [ 1.27965 + { 1.27966 + object: object, 1.27967 + name: qn 1.27968 + }, 1.27969 + { 1.27970 + object: object, 1.27971 + name: Runtime.VM_OPEN_METHOD_PREFIX + qn 1.27972 + } 1.27973 + ]; 1.27974 + var closure = bindSafely(trampoline, object); 1.27975 + defineReadOnlyProperty(closure, Runtime.VM_LENGTH, trampoline.asLength); 1.27976 + defineReadOnlyProperty(closure, Multiname.getPublicQualifiedName('prototype'), null); 1.27977 + defineNonEnumerableProperty(object, qn, closure); 1.27978 + defineNonEnumerableProperty(object, Runtime.VM_OPEN_METHOD_PREFIX + qn, closure); 1.27979 + } else if (trait.isGetter() || trait.isSetter()) { 1.27980 + var trampoline = Shumway.AVM2.Runtime.makeTrampoline(function (self) { 1.27981 + var fn = getTraitFunction(trait, scope, natives); 1.27982 + patch(self.patchTargets, fn); 1.27983 + return fn; 1.27984 + }, trait.isSetter() ? 1 : 0); 1.27985 + if (trait.isGetter()) { 1.27986 + trampoline.patchTargets = [ 1.27987 + { 1.27988 + object: object, 1.27989 + get: qn 1.27990 + } 1.27991 + ]; 1.27992 + } else { 1.27993 + trampoline.patchTargets = [ 1.27994 + { 1.27995 + object: object, 1.27996 + set: qn 1.27997 + } 1.27998 + ]; 1.27999 + } 1.28000 + defineNonEnumerableGetterOrSetter(object, qn, trampoline, trait.isGetter()); 1.28001 + } else { 1.28002 + Shumway.Debug.unexpected(trait); 1.28003 + } 1.28004 + } 1.28005 + Runtime.applyNonMemoizedMethodTrait = applyNonMemoizedMethodTrait; 1.28006 + function applyMemoizedMethodTrait(qn, trait, object, scope, natives) { 1.28007 + true; 1.28008 + if (trait.isMethod()) { 1.28009 + var memoizerTarget = { 1.28010 + value: null 1.28011 + }; 1.28012 + var trampoline = Shumway.AVM2.Runtime.makeTrampoline(function (self) { 1.28013 + var fn = getTraitFunction(trait, scope, natives); 1.28014 + patch(self.patchTargets, fn); 1.28015 + return fn; 1.28016 + }, trait.methodInfo.parameters.length, String(trait.name)); 1.28017 + memoizerTarget.value = trampoline; 1.28018 + var openMethods = object.asOpenMethods; 1.28019 + openMethods[qn] = trampoline; 1.28020 + defineNonEnumerableProperty(object, Runtime.VM_OPEN_METHOD_PREFIX + qn, trampoline); 1.28021 + defineNonEnumerableGetter(object, qn, Shumway.AVM2.Runtime.makeMemoizer(qn, memoizerTarget)); 1.28022 + trampoline.patchTargets = [ 1.28023 + { 1.28024 + object: memoizerTarget, 1.28025 + name: 'value' 1.28026 + }, 1.28027 + { 1.28028 + object: openMethods, 1.28029 + name: qn 1.28030 + }, 1.28031 + { 1.28032 + object: object, 1.28033 + name: Runtime.VM_OPEN_METHOD_PREFIX + qn 1.28034 + } 1.28035 + ]; 1.28036 + } else if (trait.isGetter() || trait.isSetter()) { 1.28037 + var trampoline = Shumway.AVM2.Runtime.makeTrampoline(function (self) { 1.28038 + var fn = getTraitFunction(trait, scope, natives); 1.28039 + patch(self.patchTargets, fn); 1.28040 + return fn; 1.28041 + }, 0, String(trait.name)); 1.28042 + if (trait.isGetter()) { 1.28043 + defineNonEnumerableProperty(object, Runtime.VM_OPEN_GET_METHOD_PREFIX + qn, trampoline); 1.28044 + trampoline.patchTargets = [ 1.28045 + { 1.28046 + object: object, 1.28047 + get: qn 1.28048 + }, 1.28049 + { 1.28050 + object: object, 1.28051 + name: Runtime.VM_OPEN_GET_METHOD_PREFIX + qn 1.28052 + } 1.28053 + ]; 1.28054 + } else { 1.28055 + defineNonEnumerableProperty(object, Runtime.VM_OPEN_SET_METHOD_PREFIX + qn, trampoline); 1.28056 + trampoline.patchTargets = [ 1.28057 + { 1.28058 + object: object, 1.28059 + set: qn 1.28060 + }, 1.28061 + { 1.28062 + object: object, 1.28063 + name: Runtime.VM_OPEN_SET_METHOD_PREFIX + qn 1.28064 + } 1.28065 + ]; 1.28066 + } 1.28067 + defineNonEnumerableGetterOrSetter(object, qn, trampoline, trait.isGetter()); 1.28068 + } 1.28069 + } 1.28070 + Runtime.applyMemoizedMethodTrait = applyMemoizedMethodTrait; 1.28071 + function getNamespaceResolutionMap(namespaces) { 1.28072 + var self = this; 1.28073 + var map = self.resolutionMap[namespaces.runtimeId]; 1.28074 + if (map) 1.28075 + return map; 1.28076 + map = self.resolutionMap[namespaces.runtimeId] = Shumway.ObjectUtilities.createMap(); 1.28077 + var bindings = self.bindings; 1.28078 + for (var key in bindings.map) { 1.28079 + var multiname = key; 1.28080 + var trait = bindings.map[key].trait; 1.28081 + if (trait.isGetter() || trait.isSetter()) { 1.28082 + multiname = multiname.substring(Shumway.AVM2.Runtime.Binding.KEY_PREFIX_LENGTH); 1.28083 + } 1.28084 + multiname = Multiname.fromQualifiedName(multiname); 1.28085 + if (multiname.getNamespace().inNamespaceSet(namespaces)) { 1.28086 + map[multiname.getName()] = Multiname.getQualifiedName(trait.name); 1.28087 + } 1.28088 + } 1.28089 + return map; 1.28090 + } 1.28091 + Runtime.getNamespaceResolutionMap = getNamespaceResolutionMap; 1.28092 + function resolveMultinameProperty(namespaces, name, flags) { 1.28093 + var self = this; 1.28094 + if (typeof name === 'object') { 1.28095 + name = String(name); 1.28096 + } 1.28097 + if (Shumway.isNumeric(name)) { 1.28098 + return Shumway.toNumber(name); 1.28099 + } 1.28100 + if (!namespaces) { 1.28101 + return Multiname.getPublicQualifiedName(name); 1.28102 + } 1.28103 + if (namespaces.length > 1) { 1.28104 + var resolved = self.getNamespaceResolutionMap(namespaces)[name]; 1.28105 + if (resolved) 1.28106 + return resolved; 1.28107 + return Multiname.getPublicQualifiedName(name); 1.28108 + } else { 1.28109 + return Multiname.qualifyName(namespaces[0], name); 1.28110 + } 1.28111 + } 1.28112 + Runtime.resolveMultinameProperty = resolveMultinameProperty; 1.28113 + function asGetPublicProperty(name) { 1.28114 + var self = this; 1.28115 + return self.asGetProperty(undefined, name, 0); 1.28116 + } 1.28117 + Runtime.asGetPublicProperty = asGetPublicProperty; 1.28118 + function asGetProperty(namespaces, name, flags) { 1.28119 + var self = this; 1.28120 + var resolved = self.resolveMultinameProperty(namespaces, name, flags); 1.28121 + if (self.asGetNumericProperty && Multiname.isNumeric(resolved)) { 1.28122 + return self.asGetNumericProperty(resolved); 1.28123 + } 1.28124 + return self[resolved]; 1.28125 + } 1.28126 + Runtime.asGetProperty = asGetProperty; 1.28127 + function asGetPropertyLikelyNumeric(namespaces, name, flags) { 1.28128 + var self = this; 1.28129 + if (typeof name === 'number') { 1.28130 + return self.asGetNumericProperty(name); 1.28131 + } 1.28132 + return asGetProperty.call(self, namespaces, name, flags); 1.28133 + } 1.28134 + Runtime.asGetPropertyLikelyNumeric = asGetPropertyLikelyNumeric; 1.28135 + function asGetResolvedStringProperty(resolved) { 1.28136 + true; 1.28137 + return this[resolved]; 1.28138 + } 1.28139 + Runtime.asGetResolvedStringProperty = asGetResolvedStringProperty; 1.28140 + function asCallResolvedStringProperty(resolved, isLex, args) { 1.28141 + var self = this; 1.28142 + var receiver = isLex ? null : this; 1.28143 + var openMethods = self.asOpenMethods; 1.28144 + var method; 1.28145 + if (receiver && openMethods && openMethods[resolved]) { 1.28146 + method = openMethods[resolved]; 1.28147 + } else { 1.28148 + method = self[resolved]; 1.28149 + } 1.28150 + return method.apply(receiver, args); 1.28151 + } 1.28152 + Runtime.asCallResolvedStringProperty = asCallResolvedStringProperty; 1.28153 + function asGetResolvedStringPropertyFallback(resolved) { 1.28154 + var self = this; 1.28155 + var name = Multiname.getNameFromPublicQualifiedName(resolved); 1.28156 + return self.asGetProperty([ 1.28157 + Namespace.PUBLIC 1.28158 + ], name, 0); 1.28159 + } 1.28160 + Runtime.asGetResolvedStringPropertyFallback = asGetResolvedStringPropertyFallback; 1.28161 + function asSetPublicProperty(name, value) { 1.28162 + var self = this; 1.28163 + return self.asSetProperty(undefined, name, 0, value); 1.28164 + } 1.28165 + Runtime.asSetPublicProperty = asSetPublicProperty; 1.28166 + function asSetProperty(namespaces, name, flags, value) { 1.28167 + var self = this; 1.28168 + if (typeof name === 'object') { 1.28169 + name = String(name); 1.28170 + } 1.28171 + var resolved = self.resolveMultinameProperty(namespaces, name, flags); 1.28172 + if (self.asSetNumericProperty && Multiname.isNumeric(resolved)) { 1.28173 + return self.asSetNumericProperty(resolved, value); 1.28174 + } 1.28175 + var slotInfo = self.asSlots.byQN[resolved]; 1.28176 + if (slotInfo) { 1.28177 + if (slotInfo.isConst) { 1.28178 + } 1.28179 + var type = slotInfo.type; 1.28180 + if (type && type.coerce) { 1.28181 + value = type.coerce(value); 1.28182 + } 1.28183 + } 1.28184 + self[resolved] = value; 1.28185 + } 1.28186 + Runtime.asSetProperty = asSetProperty; 1.28187 + function asSetPropertyLikelyNumeric(namespaces, name, flags, value) { 1.28188 + var self = this; 1.28189 + if (typeof name === 'number') { 1.28190 + self.asSetNumericProperty(name, value); 1.28191 + return; 1.28192 + } 1.28193 + return asSetProperty.call(self, namespaces, name, flags, value); 1.28194 + } 1.28195 + Runtime.asSetPropertyLikelyNumeric = asSetPropertyLikelyNumeric; 1.28196 + function asDefinePublicProperty(name, descriptor) { 1.28197 + var self = this; 1.28198 + return self.asDefineProperty(undefined, name, 0, descriptor); 1.28199 + } 1.28200 + Runtime.asDefinePublicProperty = asDefinePublicProperty; 1.28201 + function asDefineProperty(namespaces, name, flags, descriptor) { 1.28202 + var self = this; 1.28203 + if (typeof name === 'object') { 1.28204 + name = String(name); 1.28205 + } 1.28206 + var resolved = self.resolveMultinameProperty(namespaces, name, flags); 1.28207 + Object.defineProperty(self, resolved, descriptor); 1.28208 + } 1.28209 + Runtime.asDefineProperty = asDefineProperty; 1.28210 + function asCallPublicProperty(name, args) { 1.28211 + var self = this; 1.28212 + return self.asCallProperty(undefined, name, 0, false, args); 1.28213 + } 1.28214 + Runtime.asCallPublicProperty = asCallPublicProperty; 1.28215 + function asCallProperty(namespaces, name, flags, isLex, args) { 1.28216 + var self = this; 1.28217 + if (Runtime.traceCallExecution.value) { 1.28218 + var receiverClassName = self.class ? self.class.className + ' ' : ''; 1.28219 + callWriter.enter('call ' + receiverClassName + name + '(' + toSafeArrayString(args) + ') #' + callCounter.count(name)); 1.28220 + } 1.28221 + var receiver = isLex ? null : self; 1.28222 + var result; 1.28223 + if (isProxyObject(self)) { 1.28224 + result = self[Runtime.VM_CALL_PROXY](new Multiname(namespaces, name, flags), receiver, args); 1.28225 + } else { 1.28226 + var method; 1.28227 + var resolved = self.resolveMultinameProperty(namespaces, name, flags); 1.28228 + if (self.asGetNumericProperty && Multiname.isNumeric(resolved)) { 1.28229 + method = self.asGetNumericProperty(resolved); 1.28230 + } else { 1.28231 + var openMethods = self.asOpenMethods; 1.28232 + if (receiver && openMethods && openMethods[resolved]) { 1.28233 + method = openMethods[resolved]; 1.28234 + } else { 1.28235 + method = self[resolved]; 1.28236 + } 1.28237 + } 1.28238 + result = method.apply(receiver, args); 1.28239 + } 1.28240 + Runtime.traceCallExecution.value > 0 && callWriter.leave('return ' + toSafeString(result)); 1.28241 + return result; 1.28242 + } 1.28243 + Runtime.asCallProperty = asCallProperty; 1.28244 + function asCallSuper(scope, namespaces, name, flags, args) { 1.28245 + var self = this; 1.28246 + if (Runtime.traceCallExecution.value) { 1.28247 + var receiverClassName = self.class ? self.class.className + ' ' : ''; 1.28248 + callWriter.enter('call super ' + receiverClassName + name + '(' + toSafeArrayString(args) + ') #' + callCounter.count(name)); 1.28249 + } 1.28250 + var baseClass = scope.object.baseClass; 1.28251 + var resolved = baseClass.traitsPrototype.resolveMultinameProperty(namespaces, name, flags); 1.28252 + var openMethods = baseClass.traitsPrototype.asOpenMethods; 1.28253 + var method = openMethods[resolved]; 1.28254 + var result = method.apply(this, args); 1.28255 + Runtime.traceCallExecution.value > 0 && callWriter.leave('return ' + toSafeString(result)); 1.28256 + return result; 1.28257 + } 1.28258 + Runtime.asCallSuper = asCallSuper; 1.28259 + function asSetSuper(scope, namespaces, name, flags, value) { 1.28260 + var self = this; 1.28261 + if (Runtime.traceCallExecution.value) { 1.28262 + var receiverClassName = self.class ? self.class.className + ' ' : ''; 1.28263 + callWriter.enter('set super ' + receiverClassName + name + '(' + toSafeString(value) + ') #' + callCounter.count(name)); 1.28264 + } 1.28265 + var baseClass = scope.object.baseClass; 1.28266 + var resolved = baseClass.traitsPrototype.resolveMultinameProperty(namespaces, name, flags); 1.28267 + if (self.asSlots.byQN[resolved]) { 1.28268 + this.asSetProperty(namespaces, name, flags, value); 1.28269 + } else { 1.28270 + baseClass.traitsPrototype[Runtime.VM_OPEN_SET_METHOD_PREFIX + resolved].call(this, value); 1.28271 + } 1.28272 + Runtime.traceCallExecution.value > 0 && callWriter.leave(''); 1.28273 + } 1.28274 + Runtime.asSetSuper = asSetSuper; 1.28275 + function asGetSuper(scope, namespaces, name, flags) { 1.28276 + var self = this; 1.28277 + if (Runtime.traceCallExecution.value) { 1.28278 + var receiver = self.class ? self.class.className + ' ' : ''; 1.28279 + callWriter.enter('get super ' + receiver + name + ' #' + callCounter.count(name)); 1.28280 + } 1.28281 + var baseClass = scope.object.baseClass; 1.28282 + var resolved = baseClass.traitsPrototype.resolveMultinameProperty(namespaces, name, flags); 1.28283 + var result; 1.28284 + if (self.asSlots.byQN[resolved]) { 1.28285 + result = this.asGetProperty(namespaces, name, flags); 1.28286 + } else { 1.28287 + result = baseClass.traitsPrototype[Runtime.VM_OPEN_GET_METHOD_PREFIX + resolved].call(this); 1.28288 + } 1.28289 + Runtime.traceCallExecution.value > 0 && callWriter.leave('return ' + toSafeString(result)); 1.28290 + return result; 1.28291 + } 1.28292 + Runtime.asGetSuper = asGetSuper; 1.28293 + function construct(cls, args) { 1.28294 + if (cls.classInfo) { 1.28295 + var qn = Multiname.getQualifiedName(cls.classInfo.instanceInfo.name); 1.28296 + if (qn === Multiname.String) { 1.28297 + return String.apply(null, args); 1.28298 + } 1.28299 + if (qn === Multiname.Boolean) { 1.28300 + return Boolean.apply(null, args); 1.28301 + } 1.28302 + if (qn === Multiname.Number) { 1.28303 + return Number.apply(null, args); 1.28304 + } 1.28305 + } 1.28306 + var c = cls.instanceConstructor; 1.28307 + var a = args; 1.28308 + switch (args.length) { 1.28309 + case 0: 1.28310 + return new c(); 1.28311 + case 1: 1.28312 + return new c(a[0]); 1.28313 + case 2: 1.28314 + return new c(a[0], a[1]); 1.28315 + case 3: 1.28316 + return new c(a[0], a[1], a[2]); 1.28317 + case 4: 1.28318 + return new c(a[0], a[1], a[2], a[3]); 1.28319 + case 5: 1.28320 + return new c(a[0], a[1], a[2], a[3], a[4]); 1.28321 + case 6: 1.28322 + return new c(a[0], a[1], a[2], a[3], a[4], a[5]); 1.28323 + case 7: 1.28324 + return new c(a[0], a[1], a[2], a[3], a[4], a[5], a[6]); 1.28325 + case 8: 1.28326 + return new c(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]); 1.28327 + case 9: 1.28328 + return new c(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]); 1.28329 + case 10: 1.28330 + return new c(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]); 1.28331 + } 1.28332 + var applyArguments = []; 1.28333 + for (var i = 0; i < args.length; i++) { 1.28334 + applyArguments[i + 1] = args[i]; 1.28335 + } 1.28336 + return new (Function.bind.apply(c, applyArguments))(); 1.28337 + } 1.28338 + Runtime.construct = construct; 1.28339 + function asConstructProperty(namespaces, name, flags, args) { 1.28340 + var self = this; 1.28341 + var constructor = self.asGetProperty(namespaces, name, flags); 1.28342 + if (Runtime.traceCallExecution.value) { 1.28343 + callWriter.enter('construct ' + name + '(' + toSafeArrayString(args) + ') #' + callCounter.count(name)); 1.28344 + } 1.28345 + var result = construct(constructor, args); 1.28346 + Runtime.traceCallExecution.value > 0 && callWriter.leave('return ' + toSafeString(result)); 1.28347 + return result; 1.28348 + } 1.28349 + Runtime.asConstructProperty = asConstructProperty; 1.28350 + function nonProxyingHasProperty(object, name) { 1.28351 + return name in object; 1.28352 + } 1.28353 + Runtime.nonProxyingHasProperty = nonProxyingHasProperty; 1.28354 + function asHasProperty(namespaces, name, flags, nonProxy) { 1.28355 + var self = this; 1.28356 + if (self.hasProperty) { 1.28357 + return self.hasProperty(namespaces, name, flags); 1.28358 + } 1.28359 + if (nonProxy) { 1.28360 + return nonProxyingHasProperty(self, self.resolveMultinameProperty(namespaces, name, flags)); 1.28361 + } else { 1.28362 + return self.resolveMultinameProperty(namespaces, name, flags) in this; 1.28363 + } 1.28364 + } 1.28365 + Runtime.asHasProperty = asHasProperty; 1.28366 + function asDeleteProperty(namespaces, name, flags) { 1.28367 + var self = this; 1.28368 + if (self.asHasTraitProperty(namespaces, name, flags)) { 1.28369 + return false; 1.28370 + } 1.28371 + var resolved = self.resolveMultinameProperty(namespaces, name, flags); 1.28372 + return delete self[resolved]; 1.28373 + } 1.28374 + Runtime.asDeleteProperty = asDeleteProperty; 1.28375 + function asHasTraitProperty(namespaces, name, flags) { 1.28376 + var self = this; 1.28377 + var resolved = self.resolveMultinameProperty(namespaces, name, flags); 1.28378 + return self.asBindings.indexOf(resolved) >= 0; 1.28379 + } 1.28380 + Runtime.asHasTraitProperty = asHasTraitProperty; 1.28381 + function asGetNumericProperty(i) { 1.28382 + return this[i]; 1.28383 + } 1.28384 + Runtime.asGetNumericProperty = asGetNumericProperty; 1.28385 + function asSetNumericProperty(i, v) { 1.28386 + this[i] = v; 1.28387 + } 1.28388 + Runtime.asSetNumericProperty = asSetNumericProperty; 1.28389 + function asGetDescendants(namespaces, name, flags) { 1.28390 + Shumway.Debug.notImplemented('asGetDescendants'); 1.28391 + } 1.28392 + Runtime.asGetDescendants = asGetDescendants; 1.28393 + function asNextNameIndex(index) { 1.28394 + var self = this; 1.28395 + if (index === 0) { 1.28396 + defineNonEnumerableProperty(self, 'asEnumerableKeys', self.asGetEnumerableKeys()); 1.28397 + } 1.28398 + var asEnumerableKeys = self.asEnumerableKeys; 1.28399 + while (index < asEnumerableKeys.length) { 1.28400 + if (self.asHasProperty(undefined, asEnumerableKeys[index], 0)) { 1.28401 + return index + 1; 1.28402 + } 1.28403 + index++; 1.28404 + } 1.28405 + return 0; 1.28406 + } 1.28407 + Runtime.asNextNameIndex = asNextNameIndex; 1.28408 + function asNextName(index) { 1.28409 + var self = this; 1.28410 + var asEnumerableKeys = self.asEnumerableKeys; 1.28411 + true; 1.28412 + return asEnumerableKeys[index - 1]; 1.28413 + } 1.28414 + Runtime.asNextName = asNextName; 1.28415 + function asNextValue(index) { 1.28416 + return this.asGetPublicProperty(this.asNextName(index)); 1.28417 + } 1.28418 + Runtime.asNextValue = asNextValue; 1.28419 + function asGetEnumerableKeys() { 1.28420 + var self = this; 1.28421 + var boxedValue = self.valueOf(); 1.28422 + if (typeof boxedValue === 'string' || typeof boxedValue === 'number') { 1.28423 + return []; 1.28424 + } 1.28425 + var keys = Object.keys(this); 1.28426 + var result = []; 1.28427 + for (var i = 0; i < keys.length; i++) { 1.28428 + var key = keys[i]; 1.28429 + if (Shumway.isNumeric(key)) { 1.28430 + result.push(key); 1.28431 + } else { 1.28432 + var name = Multiname.stripPublicQualifier(key); 1.28433 + if (name !== undefined) { 1.28434 + result.push(name); 1.28435 + } 1.28436 + } 1.28437 + } 1.28438 + return result; 1.28439 + } 1.28440 + Runtime.asGetEnumerableKeys = asGetEnumerableKeys; 1.28441 + function asTypeOf(x) { 1.28442 + if (x) { 1.28443 + if (x.constructor === String) { 1.28444 + return 'string'; 1.28445 + } else if (x.constructor === Number) { 1.28446 + return 'number'; 1.28447 + } else if (x.constructor === Boolean) { 1.28448 + return 'boolean'; 1.28449 + } else if (x instanceof XML || x instanceof XMLList) { 1.28450 + return 'xml'; 1.28451 + } 1.28452 + } 1.28453 + return typeof x; 1.28454 + } 1.28455 + Runtime.asTypeOf = asTypeOf; 1.28456 + function publicizeProperties(object) { 1.28457 + var keys = Object.keys(object); 1.28458 + for (var i = 0; i < keys.length; i++) { 1.28459 + var k = keys[i]; 1.28460 + if (!Multiname.isPublicQualifiedName(k)) { 1.28461 + var v = object[k]; 1.28462 + object[Multiname.getPublicQualifiedName(k)] = v; 1.28463 + delete object[k]; 1.28464 + } 1.28465 + } 1.28466 + } 1.28467 + Runtime.publicizeProperties = publicizeProperties; 1.28468 + function asGetSlot(object, index) { 1.28469 + return object[object.asSlots.byID[index].name]; 1.28470 + } 1.28471 + Runtime.asGetSlot = asGetSlot; 1.28472 + function asSetSlot(object, index, value) { 1.28473 + var slotInfo = object.asSlots.byID[index]; 1.28474 + if (slotInfo.const) { 1.28475 + return; 1.28476 + } 1.28477 + var name = slotInfo.name; 1.28478 + var type = slotInfo.type; 1.28479 + if (type && type.coerce) { 1.28480 + object[name] = type.coerce(value); 1.28481 + } else { 1.28482 + object[name] = value; 1.28483 + } 1.28484 + } 1.28485 + Runtime.asSetSlot = asSetSlot; 1.28486 + function throwError(name, error) { 1.28487 + if (true) { 1.28488 + var message = Shumway.AVM2.formatErrorMessage.apply(null, Array.prototype.slice.call(arguments, 1)); 1.28489 + throwErrorFromVM(Shumway.AVM2.Runtime.AVM2.currentDomain(), name, message, error.code); 1.28490 + } else { 1.28491 + throwErrorFromVM(Shumway.AVM2.Runtime.AVM2.currentDomain(), name, Shumway.AVM2.getErrorMessage(error.code), error.code); 1.28492 + } 1.28493 + } 1.28494 + Runtime.throwError = throwError; 1.28495 + function throwErrorFromVM(domain, errorClass, message, id) { 1.28496 + var error = new (domain.getClass(errorClass)).instanceConstructor(message, id); 1.28497 + throw error; 1.28498 + } 1.28499 + Runtime.throwErrorFromVM = throwErrorFromVM; 1.28500 + function translateError(domain, error) { 1.28501 + if (error instanceof Error) { 1.28502 + var type = domain.getClass(error.name); 1.28503 + if (type) { 1.28504 + return new type.instanceConstructor(Shumway.AVM2.translateErrorMessage(error)); 1.28505 + } 1.28506 + Shumway.Debug.unexpected('Can\'t translate error: ' + error); 1.28507 + } 1.28508 + return error; 1.28509 + } 1.28510 + Runtime.translateError = translateError; 1.28511 + function asIsInstanceOf(type, value) { 1.28512 + return type.isInstanceOf(value); 1.28513 + } 1.28514 + Runtime.asIsInstanceOf = asIsInstanceOf; 1.28515 + function asIsType(type, value) { 1.28516 + return type.isInstance(value); 1.28517 + } 1.28518 + Runtime.asIsType = asIsType; 1.28519 + function asAsType(type, value) { 1.28520 + return asIsType(type, value) ? value : null; 1.28521 + } 1.28522 + Runtime.asAsType = asAsType; 1.28523 + function asCoerceByMultiname(domain, multiname, value) { 1.28524 + true; 1.28525 + switch (Multiname.getQualifiedName(multiname)) { 1.28526 + case Multiname.Int: 1.28527 + return asCoerceInt(value); 1.28528 + case Multiname.Uint: 1.28529 + return asCoerceUint(value); 1.28530 + case Multiname.String: 1.28531 + return asCoerceString(value); 1.28532 + case Multiname.Number: 1.28533 + return asCoerceNumber(value); 1.28534 + case Multiname.Boolean: 1.28535 + return asCoerceBoolean(value); 1.28536 + case Multiname.Object: 1.28537 + return asCoerceObject(value); 1.28538 + } 1.28539 + return asCoerce(domain.getType(multiname), value); 1.28540 + } 1.28541 + Runtime.asCoerceByMultiname = asCoerceByMultiname; 1.28542 + function asCoerce(type, value) { 1.28543 + if (type.coerce) { 1.28544 + return type.coerce(value); 1.28545 + } 1.28546 + if (Shumway.isNullOrUndefined(value)) { 1.28547 + return null; 1.28548 + } 1.28549 + if (type.isInstance(value)) { 1.28550 + return value; 1.28551 + } else { 1.28552 + true; 1.28553 + } 1.28554 + } 1.28555 + Runtime.asCoerce = asCoerce; 1.28556 + function asCoerceString(x) { 1.28557 + if (typeof x === 'string') { 1.28558 + return x; 1.28559 + } else if (x == undefined) { 1.28560 + return null; 1.28561 + } 1.28562 + return x + ''; 1.28563 + } 1.28564 + Runtime.asCoerceString = asCoerceString; 1.28565 + function asCoerceInt(x) { 1.28566 + return x | 0; 1.28567 + } 1.28568 + Runtime.asCoerceInt = asCoerceInt; 1.28569 + function asCoerceUint(x) { 1.28570 + return x >>> 0; 1.28571 + } 1.28572 + Runtime.asCoerceUint = asCoerceUint; 1.28573 + function asCoerceNumber(x) { 1.28574 + return +x; 1.28575 + } 1.28576 + Runtime.asCoerceNumber = asCoerceNumber; 1.28577 + function asCoerceBoolean(x) { 1.28578 + return !(!x); 1.28579 + } 1.28580 + Runtime.asCoerceBoolean = asCoerceBoolean; 1.28581 + function asCoerceObject(x) { 1.28582 + if (x == undefined) { 1.28583 + return null; 1.28584 + } 1.28585 + if (typeof x === 'string' || typeof x === 'number') { 1.28586 + return x; 1.28587 + } 1.28588 + return Object(x); 1.28589 + } 1.28590 + Runtime.asCoerceObject = asCoerceObject; 1.28591 + function asDefaultCompareFunction(a, b) { 1.28592 + return String(a).localeCompare(String(b)); 1.28593 + } 1.28594 + Runtime.asDefaultCompareFunction = asDefaultCompareFunction; 1.28595 + function asCompare(a, b, options, compareFunction) { 1.28596 + true; 1.28597 + true; 1.28598 + var result = 0; 1.28599 + if (!compareFunction) { 1.28600 + compareFunction = asDefaultCompareFunction; 1.28601 + } 1.28602 + if (options & 1) { 1.28603 + a = String(a).toLowerCase(); 1.28604 + b = String(b).toLowerCase(); 1.28605 + } 1.28606 + if (options & 16) { 1.28607 + a = Shumway.toNumber(a); 1.28608 + b = Shumway.toNumber(b); 1.28609 + result = a < b ? -1 : a > b ? 1 : 0; 1.28610 + } else { 1.28611 + result = compareFunction(a, b); 1.28612 + } 1.28613 + if (options & 2) { 1.28614 + result *= -1; 1.28615 + } 1.28616 + return result; 1.28617 + } 1.28618 + Runtime.asCompare = asCompare; 1.28619 + function asAdd(l, r) { 1.28620 + if (typeof l === 'string' || typeof r === 'string') { 1.28621 + return String(l) + String(r); 1.28622 + } 1.28623 + return l + r; 1.28624 + } 1.28625 + Runtime.asAdd = asAdd; 1.28626 + function asHasNext2(object, index) { 1.28627 + if (Shumway.isNullOrUndefined(object)) { 1.28628 + return { 1.28629 + index: 0, 1.28630 + object: null 1.28631 + }; 1.28632 + } 1.28633 + object = boxValue(object); 1.28634 + var nextIndex = object.asNextNameIndex(index); 1.28635 + if (nextIndex > 0) { 1.28636 + return { 1.28637 + index: nextIndex, 1.28638 + object: object 1.28639 + }; 1.28640 + } 1.28641 + while (true) { 1.28642 + var object = Object.getPrototypeOf(object); 1.28643 + if (!object) { 1.28644 + return { 1.28645 + index: 0, 1.28646 + object: null 1.28647 + }; 1.28648 + } 1.28649 + nextIndex = object.asNextNameIndex(0); 1.28650 + if (nextIndex > 0) { 1.28651 + return { 1.28652 + index: nextIndex, 1.28653 + object: object 1.28654 + }; 1.28655 + } 1.28656 + } 1.28657 + return { 1.28658 + index: 0, 1.28659 + object: null 1.28660 + }; 1.28661 + } 1.28662 + Runtime.asHasNext2 = asHasNext2; 1.28663 + function getDescendants(object, mn) { 1.28664 + if (!isXMLType(object)) { 1.28665 + throw 'Not XML object in getDescendants'; 1.28666 + } 1.28667 + return object.descendants(mn); 1.28668 + } 1.28669 + Runtime.getDescendants = getDescendants; 1.28670 + function checkFilter(value) { 1.28671 + if (!value.class || !isXMLType(value)) { 1.28672 + throw 'TypeError operand of childFilter not of XML type'; 1.28673 + } 1.28674 + return value; 1.28675 + } 1.28676 + Runtime.checkFilter = checkFilter; 1.28677 + function initializeGlobalObject(global) { 1.28678 + var VM_NATIVE_BUILTIN_SURROGATES = [ 1.28679 + { 1.28680 + name: 'Object', 1.28681 + methods: [ 1.28682 + 'toString', 1.28683 + 'valueOf' 1.28684 + ] 1.28685 + }, 1.28686 + { 1.28687 + name: 'Function', 1.28688 + methods: [ 1.28689 + 'toString', 1.28690 + 'valueOf' 1.28691 + ] 1.28692 + } 1.28693 + ]; 1.28694 + var originals = global[Runtime.VM_NATIVE_BUILTIN_ORIGINALS] = createEmptyObject(); 1.28695 + VM_NATIVE_BUILTIN_SURROGATES.forEach(function (surrogate) { 1.28696 + var object = global[surrogate.name]; 1.28697 + originals[surrogate.name] = createEmptyObject(); 1.28698 + surrogate.methods.forEach(function (originalFunctionName) { 1.28699 + var originalFunction; 1.28700 + if (object.prototype.hasOwnProperty(originalFunctionName)) { 1.28701 + originalFunction = object.prototype[originalFunctionName]; 1.28702 + } else { 1.28703 + originalFunction = originals['Object'][originalFunctionName]; 1.28704 + } 1.28705 + originals[surrogate.name][originalFunctionName] = originalFunction; 1.28706 + var overrideFunctionName = Multiname.getPublicQualifiedName(originalFunctionName); 1.28707 + if (useSurrogates) { 1.28708 + global[surrogate.name].prototype[originalFunctionName] = function surrogate() { 1.28709 + if (this[overrideFunctionName]) { 1.28710 + return this[overrideFunctionName](); 1.28711 + } 1.28712 + return originalFunction.call(this); 1.28713 + }; 1.28714 + } 1.28715 + }); 1.28716 + }); 1.28717 + [ 1.28718 + 'Object', 1.28719 + 'Number', 1.28720 + 'Boolean', 1.28721 + 'String', 1.28722 + 'Array', 1.28723 + 'Date', 1.28724 + 'RegExp' 1.28725 + ].forEach(function (name) { 1.28726 + defineReadOnlyProperty(global[name].prototype, Runtime.VM_NATIVE_PROTOTYPE_FLAG, true); 1.28727 + }); 1.28728 + defineNonEnumerableProperty(global.Object.prototype, 'getNamespaceResolutionMap', getNamespaceResolutionMap); 1.28729 + defineNonEnumerableProperty(global.Object.prototype, 'resolveMultinameProperty', resolveMultinameProperty); 1.28730 + defineNonEnumerableProperty(global.Object.prototype, 'asGetProperty', asGetProperty); 1.28731 + defineNonEnumerableProperty(global.Object.prototype, 'asGetPublicProperty', asGetPublicProperty); 1.28732 + defineNonEnumerableProperty(global.Object.prototype, 'asGetResolvedStringProperty', asGetResolvedStringProperty); 1.28733 + defineNonEnumerableProperty(global.Object.prototype, 'asSetProperty', asSetProperty); 1.28734 + defineNonEnumerableProperty(global.Object.prototype, 'asSetPublicProperty', asSetPublicProperty); 1.28735 + defineNonEnumerableProperty(global.Object.prototype, 'asDefineProperty', asDefineProperty); 1.28736 + defineNonEnumerableProperty(global.Object.prototype, 'asDefinePublicProperty', asDefinePublicProperty); 1.28737 + defineNonEnumerableProperty(global.Object.prototype, 'asCallProperty', asCallProperty); 1.28738 + defineNonEnumerableProperty(global.Object.prototype, 'asCallSuper', asCallSuper); 1.28739 + defineNonEnumerableProperty(global.Object.prototype, 'asGetSuper', asGetSuper); 1.28740 + defineNonEnumerableProperty(global.Object.prototype, 'asSetSuper', asSetSuper); 1.28741 + defineNonEnumerableProperty(global.Object.prototype, 'asCallPublicProperty', asCallPublicProperty); 1.28742 + defineNonEnumerableProperty(global.Object.prototype, 'asCallResolvedStringProperty', asCallResolvedStringProperty); 1.28743 + defineNonEnumerableProperty(global.Object.prototype, 'asConstructProperty', asConstructProperty); 1.28744 + defineNonEnumerableProperty(global.Object.prototype, 'asHasProperty', asHasProperty); 1.28745 + defineNonEnumerableProperty(global.Object.prototype, 'asHasTraitProperty', asHasTraitProperty); 1.28746 + defineNonEnumerableProperty(global.Object.prototype, 'asDeleteProperty', asDeleteProperty); 1.28747 + defineNonEnumerableProperty(global.Object.prototype, 'asNextName', asNextName); 1.28748 + defineNonEnumerableProperty(global.Object.prototype, 'asNextValue', asNextValue); 1.28749 + defineNonEnumerableProperty(global.Object.prototype, 'asNextNameIndex', asNextNameIndex); 1.28750 + defineNonEnumerableProperty(global.Object.prototype, 'asGetEnumerableKeys', asGetEnumerableKeys); 1.28751 + [ 1.28752 + 'Array', 1.28753 + 'Int8Array', 1.28754 + 'Uint8Array', 1.28755 + 'Uint8ClampedArray', 1.28756 + 'Int16Array', 1.28757 + 'Uint16Array', 1.28758 + 'Int32Array', 1.28759 + 'Uint32Array', 1.28760 + 'Float32Array', 1.28761 + 'Float64Array' 1.28762 + ].forEach(function (name) { 1.28763 + if (!(name in global)) { 1.28764 + log(name + ' was not found in globals'); 1.28765 + return; 1.28766 + } 1.28767 + defineNonEnumerableProperty(global[name].prototype, 'asGetNumericProperty', asGetNumericProperty); 1.28768 + defineNonEnumerableProperty(global[name].prototype, 'asSetNumericProperty', asSetNumericProperty); 1.28769 + defineNonEnumerableProperty(global[name].prototype, 'asGetProperty', asGetPropertyLikelyNumeric); 1.28770 + defineNonEnumerableProperty(global[name].prototype, 'asSetProperty', asSetPropertyLikelyNumeric); 1.28771 + }); 1.28772 + global.Array.prototype.asGetProperty = function (namespaces, name, flags) { 1.28773 + if (typeof name === 'number') { 1.28774 + return this[name]; 1.28775 + } 1.28776 + return asGetProperty.call(this, namespaces, name, flags); 1.28777 + }; 1.28778 + global.Array.prototype.asSetProperty = function (namespaces, name, flags, value) { 1.28779 + if (typeof name === 'number') { 1.28780 + this[name] = value; 1.28781 + return; 1.28782 + } 1.28783 + return asSetProperty.call(this, namespaces, name, flags, value); 1.28784 + }; 1.28785 + } 1.28786 + Runtime.initializeGlobalObject = initializeGlobalObject; 1.28787 + function nameInTraits(object, qn) { 1.28788 + if (object.hasOwnProperty(Runtime.VM_BINDINGS) && object.hasOwnProperty(qn)) { 1.28789 + return true; 1.28790 + } 1.28791 + var proto = Object.getPrototypeOf(object); 1.28792 + return proto.hasOwnProperty(Runtime.VM_BINDINGS) && proto.hasOwnProperty(qn); 1.28793 + } 1.28794 + Runtime.nameInTraits = nameInTraits; 1.28795 + function CatchScopeObject(domain, trait) { 1.28796 + if (trait) { 1.28797 + new Shumway.AVM2.Runtime.CatchBindings(new Shumway.AVM2.Runtime.Scope(null, this), trait).applyTo(domain, this); 1.28798 + } 1.28799 + } 1.28800 + Runtime.CatchScopeObject = CatchScopeObject; 1.28801 + var Global = function () { 1.28802 + function Global(script) { 1.28803 + this.scriptInfo = script; 1.28804 + script.global = this; 1.28805 + this.scriptBindings = new Shumway.AVM2.Runtime.ScriptBindings(script, new Shumway.AVM2.Runtime.Scope(null, this, false)); 1.28806 + this.scriptBindings.applyTo(script.abc.applicationDomain, this); 1.28807 + script.loaded = true; 1.28808 + } 1.28809 + Global.prototype.toString = function () { 1.28810 + return '[object global]'; 1.28811 + }; 1.28812 + Global.prototype.isExecuted = function () { 1.28813 + return this.scriptInfo.executed; 1.28814 + }; 1.28815 + Global.prototype.isExecuting = function () { 1.28816 + return this.scriptInfo.executing; 1.28817 + }; 1.28818 + Global.prototype.ensureExecuted = function () { 1.28819 + Shumway.AVM2.Runtime.ensureScriptIsExecuted(this.scriptInfo); 1.28820 + }; 1.28821 + return Global; 1.28822 + }(); 1.28823 + Runtime.Global = Global; 1.28824 + defineNonEnumerableProperty(Global.prototype, Multiname.getPublicQualifiedName('toString'), function () { 1.28825 + return this.toString(); 1.28826 + }); 1.28827 + var LazyInitializer = function () { 1.28828 + function LazyInitializer(target) { 1.28829 + this.target = target; 1.28830 + } 1.28831 + LazyInitializer.create = function (target) { 1.28832 + if (target.asLazyInitializer) { 1.28833 + return target.asLazyInitializer; 1.28834 + } 1.28835 + return target.asLazyInitializer = new LazyInitializer(target); 1.28836 + }; 1.28837 + LazyInitializer.prototype.getName = function () { 1.28838 + if (this.name) { 1.28839 + return this.name; 1.28840 + } 1.28841 + var target = this.target, initialize; 1.28842 + if (this.target instanceof ScriptInfo) { 1.28843 + var scriptInfo = target; 1.28844 + this.name = '$' + Shumway.StringUtilities.variableLengthEncodeInt32(scriptInfo.hash); 1.28845 + initialize = function () { 1.28846 + Shumway.AVM2.Runtime.ensureScriptIsExecuted(target, 'Lazy Initializer'); 1.28847 + return scriptInfo.global; 1.28848 + }; 1.28849 + } else if (this.target instanceof ClassInfo) { 1.28850 + var classInfo = target; 1.28851 + this.name = '$' + Shumway.StringUtilities.variableLengthEncodeInt32(classInfo.hash); 1.28852 + initialize = function () { 1.28853 + if (classInfo.classObject) { 1.28854 + return classInfo.classObject; 1.28855 + } 1.28856 + return classInfo.abc.applicationDomain.getProperty(classInfo.instanceInfo.name); 1.28857 + }; 1.28858 + } else { 1.28859 + Shumway.Debug.notImplemented(String(target)); 1.28860 + } 1.28861 + var name = this.name; 1.28862 + Object.defineProperty(LazyInitializer._holder, name, { 1.28863 + get: function () { 1.28864 + var value = initialize(); 1.28865 + Object.defineProperty(LazyInitializer._holder, name, { 1.28866 + value: value, 1.28867 + writable: true 1.28868 + }); 1.28869 + return value; 1.28870 + }, 1.28871 + configurable: true 1.28872 + }); 1.28873 + return name; 1.28874 + }; 1.28875 + LazyInitializer._holder = jsGlobal; 1.28876 + return LazyInitializer; 1.28877 + }(); 1.28878 + Runtime.LazyInitializer = LazyInitializer; 1.28879 + function forEachPublicProperty(object, fn, self) { 1.28880 + if (!object.asBindings) { 1.28881 + for (var key in object) { 1.28882 + fn.call(self, key, object[key]); 1.28883 + } 1.28884 + return; 1.28885 + } 1.28886 + for (var key in object) { 1.28887 + if (Shumway.isNumeric(key)) { 1.28888 + fn.call(self, key, object[key]); 1.28889 + } else if (Multiname.isPublicQualifiedName(key) && object.asBindings.indexOf(key) < 0) { 1.28890 + var name = Multiname.stripPublicQualifier(key); 1.28891 + fn.call(self, name, object[key]); 1.28892 + } 1.28893 + } 1.28894 + } 1.28895 + Runtime.forEachPublicProperty = forEachPublicProperty; 1.28896 + function wrapJSObject(object) { 1.28897 + var wrapper = Object.create(object); 1.28898 + for (var i in object) { 1.28899 + Object.defineProperty(wrapper, Multiname.getPublicQualifiedName(i), function (object, i) { 1.28900 + return { 1.28901 + get: function () { 1.28902 + return object[i]; 1.28903 + }, 1.28904 + set: function (value) { 1.28905 + object[i] = value; 1.28906 + }, 1.28907 + enumerable: true 1.28908 + }; 1.28909 + }(object, i)); 1.28910 + } 1.28911 + return wrapper; 1.28912 + } 1.28913 + Runtime.wrapJSObject = wrapJSObject; 1.28914 + function asCreateActivation(methodInfo) { 1.28915 + return Object.create(methodInfo.activationPrototype); 1.28916 + } 1.28917 + Runtime.asCreateActivation = asCreateActivation; 1.28918 + var GlobalMultinameResolver = function () { 1.28919 + function GlobalMultinameResolver() { 1.28920 + } 1.28921 + GlobalMultinameResolver.updateTraits = function (traits) { 1.28922 + for (var i = 0; i < traits.length; i++) { 1.28923 + var trait = traits[i]; 1.28924 + var name = trait.name.name; 1.28925 + var namespace = trait.name.getNamespace(); 1.28926 + if (!namespace.isDynamic()) { 1.28927 + GlobalMultinameResolver.hasNonDynamicNamespaces[name] = true; 1.28928 + if (GlobalMultinameResolver.wasResolved[name]) { 1.28929 + Shumway.Debug.notImplemented('We have to the undo the optimization, ' + name + ' can now bind to ' + namespace); 1.28930 + } 1.28931 + } 1.28932 + } 1.28933 + }; 1.28934 + GlobalMultinameResolver.loadAbc = function (abc) { 1.28935 + if (!Runtime.globalMultinameAnalysis.value) { 1.28936 + return; 1.28937 + } 1.28938 + var scripts = abc.scripts; 1.28939 + var classes = abc.classes; 1.28940 + var methods = abc.methods; 1.28941 + for (var i = 0; i < scripts.length; i++) { 1.28942 + GlobalMultinameResolver.updateTraits(scripts[i].traits); 1.28943 + } 1.28944 + for (var i = 0; i < classes.length; i++) { 1.28945 + GlobalMultinameResolver.updateTraits(classes[i].traits); 1.28946 + GlobalMultinameResolver.updateTraits(classes[i].instanceInfo.traits); 1.28947 + } 1.28948 + for (var i = 0; i < methods.length; i++) { 1.28949 + if (methods[i].traits) { 1.28950 + GlobalMultinameResolver.updateTraits(methods[i].traits); 1.28951 + } 1.28952 + } 1.28953 + }; 1.28954 + GlobalMultinameResolver.resolveMultiname = function (multiname) { 1.28955 + var name = multiname.name; 1.28956 + if (GlobalMultinameResolver.hasNonDynamicNamespaces[name]) { 1.28957 + return; 1.28958 + } 1.28959 + GlobalMultinameResolver.wasResolved[name] = true; 1.28960 + return new Multiname([ 1.28961 + Namespace.PUBLIC 1.28962 + ], multiname.name); 1.28963 + }; 1.28964 + GlobalMultinameResolver.hasNonDynamicNamespaces = createEmptyObject(); 1.28965 + GlobalMultinameResolver.wasResolved = createEmptyObject(); 1.28966 + return GlobalMultinameResolver; 1.28967 + }(); 1.28968 + Runtime.GlobalMultinameResolver = GlobalMultinameResolver; 1.28969 + var ActivationInfo = function () { 1.28970 + function ActivationInfo(methodInfo) { 1.28971 + this.methodInfo = methodInfo; 1.28972 + } 1.28973 + return ActivationInfo; 1.28974 + }(); 1.28975 + Runtime.ActivationInfo = ActivationInfo; 1.28976 + function sliceArguments(args, offset) { 1.28977 + if (typeof offset === 'undefined') { 1.28978 + offset = 0; 1.28979 + } 1.28980 + return Array.prototype.slice.call(args, offset); 1.28981 + } 1.28982 + Runtime.sliceArguments = sliceArguments; 1.28983 + function canCompile(mi) { 1.28984 + if (!mi.hasBody) { 1.28985 + return false; 1.28986 + } 1.28987 + if (mi.hasExceptions() && !compilerEnableExceptions.value) { 1.28988 + return false; 1.28989 + } else if (mi.code.length > compilerMaximumMethodSize.value) { 1.28990 + return false; 1.28991 + } 1.28992 + return true; 1.28993 + } 1.28994 + Runtime.canCompile = canCompile; 1.28995 + function shouldCompile(mi) { 1.28996 + if (!canCompile(mi)) { 1.28997 + return false; 1.28998 + } 1.28999 + if (mi.isClassInitializer || mi.isScriptInitializer) { 1.29000 + return false; 1.29001 + } 1.29002 + return true; 1.29003 + } 1.29004 + Runtime.shouldCompile = shouldCompile; 1.29005 + function forceCompile(mi) { 1.29006 + if (mi.hasExceptions()) { 1.29007 + return false; 1.29008 + } 1.29009 + var holder = mi.holder; 1.29010 + if (holder instanceof ClassInfo) { 1.29011 + holder = holder.instanceInfo; 1.29012 + } 1.29013 + if (holder instanceof InstanceInfo) { 1.29014 + var packageName = holder.name.namespaces[0].uri; 1.29015 + switch (packageName) { 1.29016 + case 'flash.geom': 1.29017 + case 'flash.events': 1.29018 + return true; 1.29019 + default: 1.29020 + break; 1.29021 + } 1.29022 + var className = holder.name.getOriginalName(); 1.29023 + switch (className) { 1.29024 + case 'com.google.youtube.model.VideoData': 1.29025 + return true; 1.29026 + } 1.29027 + } 1.29028 + return false; 1.29029 + } 1.29030 + Runtime.forceCompile = forceCompile; 1.29031 + Runtime.CODE_CACHE = createEmptyObject(); 1.29032 + function searchCodeCache(methodInfo) { 1.29033 + if (!Runtime.codeCaching.value) { 1.29034 + return; 1.29035 + } 1.29036 + var cacheInfo = Runtime.CODE_CACHE[methodInfo.abc.hash]; 1.29037 + if (!cacheInfo) { 1.29038 + warn('Cannot Find Code Cache For ABC, name: ' + methodInfo.abc.name + ', hash: ' + methodInfo.abc.hash); 1.29039 + Counter.count('Code Cache ABC Miss'); 1.29040 + return; 1.29041 + } 1.29042 + if (!cacheInfo.isInitialized) { 1.29043 + methodInfo.abc.scripts.forEach(function (scriptInfo) { 1.29044 + LazyInitializer.create(scriptInfo).getName(); 1.29045 + }); 1.29046 + methodInfo.abc.classes.forEach(function (classInfo) { 1.29047 + LazyInitializer.create(classInfo).getName(); 1.29048 + }); 1.29049 + cacheInfo.isInitialized = true; 1.29050 + } 1.29051 + var method = cacheInfo.methods[methodInfo.index]; 1.29052 + if (!method) { 1.29053 + if (methodInfo.isInstanceInitializer || methodInfo.isClassInitializer) { 1.29054 + Counter.count('Code Cache Query On Initializer'); 1.29055 + } else { 1.29056 + Counter.count('Code Cache MISS ON OTHER'); 1.29057 + warn('Shouldn\'t MISS: ' + methodInfo + ' ' + methodInfo.debugName); 1.29058 + } 1.29059 + Counter.count('Code Cache Miss'); 1.29060 + return; 1.29061 + } 1.29062 + log('Linking CC: ' + methodInfo); 1.29063 + Counter.count('Code Cache Hit'); 1.29064 + return method; 1.29065 + } 1.29066 + Runtime.searchCodeCache = searchCodeCache; 1.29067 + function createInterpretedFunction(methodInfo, scope, hasDynamicScope) { 1.29068 + var mi = methodInfo; 1.29069 + var hasDefaults = false; 1.29070 + var defaults = mi.parameters.map(function (p) { 1.29071 + if (p.value !== undefined) { 1.29072 + hasDefaults = true; 1.29073 + } 1.29074 + return p.value; 1.29075 + }); 1.29076 + var fn; 1.29077 + if (hasDynamicScope) { 1.29078 + fn = function (scope) { 1.29079 + var global = this === jsGlobal ? scope.global.object : this; 1.29080 + var args = sliceArguments(arguments, 1); 1.29081 + if (hasDefaults && args.length < defaults.length) { 1.29082 + args = args.concat(defaults.slice(args.length - defaults.length)); 1.29083 + } 1.29084 + return Shumway.AVM2.Interpreter.interpretMethod(global, methodInfo, scope, args); 1.29085 + }; 1.29086 + } else { 1.29087 + fn = function () { 1.29088 + var global = this === jsGlobal ? scope.global.object : this; 1.29089 + var args = sliceArguments(arguments); 1.29090 + if (hasDefaults && args.length < defaults.length) { 1.29091 + args = args.concat(defaults.slice(arguments.length - defaults.length)); 1.29092 + } 1.29093 + return Shumway.AVM2.Interpreter.interpretMethod(global, methodInfo, scope, args); 1.29094 + }; 1.29095 + } 1.29096 + fn.instanceConstructor = fn; 1.29097 + fn.debugName = 'Interpreter Function #' + vmNextInterpreterFunctionId++; 1.29098 + return fn; 1.29099 + } 1.29100 + Runtime.createInterpretedFunction = createInterpretedFunction; 1.29101 + function debugName(value) { 1.29102 + if (Shumway.isFunction(value)) { 1.29103 + return value.debugName; 1.29104 + } 1.29105 + return value; 1.29106 + } 1.29107 + Runtime.debugName = debugName; 1.29108 + function createCompiledFunction(methodInfo, scope, hasDynamicScope, breakpoint, deferCompilation) { 1.29109 + var mi = methodInfo; 1.29110 + var cached = searchCodeCache(mi); 1.29111 + if (!cached) { 1.29112 + var result = Compiler.compileMethod(mi, scope, hasDynamicScope); 1.29113 + var parameters = result.parameters; 1.29114 + var body = result.body; 1.29115 + } 1.29116 + var fnName = mi.name ? Multiname.getQualifiedName(mi.name) : 'fn' + compiledFunctionCount; 1.29117 + if (mi.holder) { 1.29118 + var fnNamePrefix = ''; 1.29119 + if (mi.holder instanceof ClassInfo) { 1.29120 + fnNamePrefix = 'static$' + mi.holder.instanceInfo.name.getName(); 1.29121 + } else if (mi.holder instanceof InstanceInfo) { 1.29122 + fnNamePrefix = mi.holder.name.getName(); 1.29123 + } else if (mi.holder instanceof ScriptInfo) { 1.29124 + fnNamePrefix = 'script'; 1.29125 + } 1.29126 + fnName = fnNamePrefix + '$' + fnName; 1.29127 + } 1.29128 + fnName = Shumway.StringUtilities.escapeString(fnName); 1.29129 + if (mi.verified) { 1.29130 + fnName += '$V'; 1.29131 + } 1.29132 + if (compiledFunctionCount == functionBreak.value || breakpoint) { 1.29133 + body = '{ debugger; \n' + body + '}'; 1.29134 + } 1.29135 + if (!cached) { 1.29136 + var fnSource = 'function ' + fnName + ' (' + parameters.join(', ') + ') ' + body; 1.29137 + } 1.29138 + if (traceLevel.value > 1) { 1.29139 + mi.trace(new IndentingWriter(), mi.abc); 1.29140 + } 1.29141 + mi.debugTrace = function () { 1.29142 + mi.trace(new IndentingWriter(), mi.abc); 1.29143 + }; 1.29144 + if (traceLevel.value > 0) { 1.29145 + log(fnSource); 1.29146 + } 1.29147 + var fn = cached || new Function('return ' + fnSource)(); 1.29148 + fn.debugName = 'Compiled Function #' + vmNextCompiledFunctionId++; 1.29149 + return fn; 1.29150 + } 1.29151 + Runtime.createCompiledFunction = createCompiledFunction; 1.29152 + function createFunction(mi, scope, hasDynamicScope, breakpoint) { 1.29153 + if (typeof breakpoint === 'undefined') { 1.29154 + breakpoint = false; 1.29155 + } 1.29156 + true; 1.29157 + if (mi.freeMethod) { 1.29158 + if (hasDynamicScope) { 1.29159 + return Shumway.AVM2.Runtime.bindFreeMethodScope(mi, scope); 1.29160 + } 1.29161 + return mi.freeMethod; 1.29162 + } 1.29163 + var fn; 1.29164 + if (fn = Shumway.AVM2.Runtime.checkMethodOverrides(mi)) { 1.29165 + true; 1.29166 + return fn; 1.29167 + } 1.29168 + ensureFunctionIsInitialized(mi); 1.29169 + totalFunctionCount++; 1.29170 + var useInterpreter = false; 1.29171 + if ((mi.abc.applicationDomain.mode === 1 || !shouldCompile(mi)) && !forceCompile(mi)) { 1.29172 + useInterpreter = true; 1.29173 + } 1.29174 + if (compileOnly.value >= 0) { 1.29175 + if (Number(compileOnly.value) !== totalFunctionCount) { 1.29176 + log('Compile Only Skipping ' + totalFunctionCount); 1.29177 + useInterpreter = true; 1.29178 + } 1.29179 + } 1.29180 + if (compileUntil.value >= 0) { 1.29181 + if (totalFunctionCount > 1000) { 1.29182 + log(Shumway.Debug.backtrace()); 1.29183 + log(Shumway.AVM2.Runtime.AVM2.getStackTrace()); 1.29184 + } 1.29185 + if (totalFunctionCount > compileUntil.value) { 1.29186 + log('Compile Until Skipping ' + totalFunctionCount); 1.29187 + useInterpreter = true; 1.29188 + } 1.29189 + } 1.29190 + if (useInterpreter) { 1.29191 + mi.freeMethod = createInterpretedFunction(mi, scope, hasDynamicScope); 1.29192 + } else { 1.29193 + compiledFunctionCount++; 1.29194 + if (compileOnly.value >= 0 || compileUntil.value >= 0) { 1.29195 + log('Compiling ' + totalFunctionCount); 1.29196 + } 1.29197 + mi.freeMethod = createCompiledFunction(mi, scope, hasDynamicScope, breakpoint, mi.isInstanceInitializer); 1.29198 + } 1.29199 + mi.freeMethod.methodInfo = mi; 1.29200 + if (hasDynamicScope) { 1.29201 + return Shumway.AVM2.Runtime.bindFreeMethodScope(mi, scope); 1.29202 + } 1.29203 + return mi.freeMethod; 1.29204 + } 1.29205 + Runtime.createFunction = createFunction; 1.29206 + function ensureFunctionIsInitialized(methodInfo) { 1.29207 + var mi = methodInfo; 1.29208 + if (!mi.analysis) { 1.29209 + mi.analysis = new Analysis(mi); 1.29210 + if (mi.needsActivation()) { 1.29211 + mi.activationPrototype = new ActivationInfo(mi); 1.29212 + new Shumway.AVM2.Runtime.ActivationBindings(mi).applyTo(mi.abc.applicationDomain, mi.activationPrototype); 1.29213 + } 1.29214 + var exceptions = mi.exceptions; 1.29215 + for (var i = 0, j = exceptions.length; i < j; i++) { 1.29216 + var handler = exceptions[i]; 1.29217 + if (handler.varName) { 1.29218 + var varTrait = Object.create(Trait.prototype); 1.29219 + varTrait.kind = 0; 1.29220 + varTrait.name = handler.varName; 1.29221 + varTrait.typeName = handler.typeName; 1.29222 + varTrait.holder = mi; 1.29223 + handler.scopeObject = new CatchScopeObject(mi.abc.applicationDomain, varTrait); 1.29224 + } else { 1.29225 + handler.scopeObject = new CatchScopeObject(undefined, undefined); 1.29226 + } 1.29227 + } 1.29228 + } 1.29229 + } 1.29230 + Runtime.ensureFunctionIsInitialized = ensureFunctionIsInitialized; 1.29231 + function getTraitFunction(trait, scope, natives) { 1.29232 + true; 1.29233 + true; 1.29234 + var mi = trait.methodInfo; 1.29235 + var fn; 1.29236 + if (mi.isNative()) { 1.29237 + var md = trait.metadata; 1.29238 + if (md && md.native) { 1.29239 + var nativeName = md.native.value[0].value; 1.29240 + var makeNativeFunction = getNative(nativeName); 1.29241 + fn = makeNativeFunction && makeNativeFunction(null, scope); 1.29242 + } else if (md && md.unsafeJSNative) { 1.29243 + fn = getNative(md.unsafeJSNative.value[0].value); 1.29244 + } else if (natives) { 1.29245 + var k = Multiname.getName(mi.name); 1.29246 + if (trait.isGetter()) { 1.29247 + fn = natives[k] ? natives[k].get : undefined; 1.29248 + } else if (trait.isSetter()) { 1.29249 + fn = natives[k] ? natives[k].set : undefined; 1.29250 + } else { 1.29251 + fn = natives[k]; 1.29252 + } 1.29253 + } 1.29254 + if (!fn) { 1.29255 + Shumway.Debug.warning('No native method for: ' + trait.kindName() + ' ' + mi.holder.name + '::' + Multiname.getQualifiedName(mi.name)); 1.29256 + return function (mi) { 1.29257 + return function () { 1.29258 + Shumway.Debug.warning('Calling undefined native method: ' + trait.kindName() + ' ' + mi.holder.name + '::' + Multiname.getQualifiedName(mi.name)); 1.29259 + }; 1.29260 + }(mi); 1.29261 + } 1.29262 + } else { 1.29263 + if (Runtime.traceExecution.value >= 2) { 1.29264 + log('Creating Function For Trait: ' + trait.holder + ' ' + trait); 1.29265 + } 1.29266 + fn = createFunction(mi, scope, false, false); 1.29267 + true; 1.29268 + } 1.29269 + if (Runtime.traceExecution.value >= 3) { 1.29270 + log('Made Function: ' + Multiname.getQualifiedName(mi.name)); 1.29271 + } 1.29272 + return fn; 1.29273 + } 1.29274 + Runtime.getTraitFunction = getTraitFunction; 1.29275 + function createClass(classInfo, baseClass, scope) { 1.29276 + true; 1.29277 + var ci = classInfo; 1.29278 + var ii = ci.instanceInfo; 1.29279 + var domain = ci.abc.applicationDomain; 1.29280 + var className = Multiname.getName(ii.name); 1.29281 + if (Runtime.traceExecution.value) { 1.29282 + log('Creating ' + (ii.isInterface() ? 'Interface' : 'Class') + ': ' + className + (ci.native ? ' replaced with native ' + ci.native.cls : '')); 1.29283 + } 1.29284 + var cls; 1.29285 + if (ii.isInterface()) { 1.29286 + cls = Shumway.AVM2.Runtime.Interface.createInterface(classInfo); 1.29287 + } else { 1.29288 + cls = Shumway.AVM2.Runtime.Class.createClass(classInfo, baseClass, scope); 1.29289 + } 1.29290 + if (Runtime.traceClasses.value) { 1.29291 + domain.loadedClasses.push(cls); 1.29292 + domain.traceLoadedClasses(true); 1.29293 + } 1.29294 + if (ii.isInterface()) { 1.29295 + return cls; 1.29296 + } 1.29297 + domain.onMessage.notify1('classCreated', cls); 1.29298 + if (cls.instanceConstructor && cls !== Shumway.AVM2.Runtime.Class) { 1.29299 + cls.verify(); 1.29300 + } 1.29301 + if (baseClass && (Multiname.getQualifiedName(baseClass.classInfo.instanceInfo.name.name) === 'Proxy' || baseClass.isProxy)) { 1.29302 + installProxyClassWrapper(cls); 1.29303 + cls.isProxy = true; 1.29304 + } 1.29305 + classInfo.classObject = cls; 1.29306 + createFunction(classInfo.init, scope, false, false).call(cls); 1.29307 + if (Runtime.sealConstTraits) { 1.29308 + this.sealConstantTraits(cls, ci.traits); 1.29309 + } 1.29310 + return cls; 1.29311 + } 1.29312 + Runtime.createClass = createClass; 1.29313 + function sealConstantTraits(object, traits) { 1.29314 + for (var i = 0, j = traits.length; i < j; i++) { 1.29315 + var trait = traits[i]; 1.29316 + if (trait.isConst()) { 1.29317 + var qn = Multiname.getQualifiedName(trait.name); 1.29318 + var value = object[qn]; 1.29319 + (function (qn, value) { 1.29320 + Object.defineProperty(object, qn, { 1.29321 + configurable: false, 1.29322 + enumerable: false, 1.29323 + get: function () { 1.29324 + return value; 1.29325 + }, 1.29326 + set: function () { 1.29327 + throwErrorFromVM(Shumway.AVM2.Runtime.AVM2.currentDomain(), 'ReferenceError', 'Illegal write to read-only property ' + qn + '.', 0); 1.29328 + } 1.29329 + }); 1.29330 + }(qn, value)); 1.29331 + } 1.29332 + } 1.29333 + } 1.29334 + Runtime.sealConstantTraits = sealConstantTraits; 1.29335 + function applyType(domain, factory, types) { 1.29336 + var factoryClassName = factory.classInfo.instanceInfo.name.name; 1.29337 + if (factoryClassName === 'Vector') { 1.29338 + true; 1.29339 + var type = types[0]; 1.29340 + var typeClassName; 1.29341 + if (!Shumway.isNullOrUndefined(type)) { 1.29342 + typeClassName = type.classInfo.instanceInfo.name.name.toLowerCase(); 1.29343 + switch (typeClassName) { 1.29344 + case 'int': 1.29345 + case 'uint': 1.29346 + case 'double': 1.29347 + case 'object': 1.29348 + return domain.getClass('packageInternal __AS3__.vec.Vector$' + typeClassName); 1.29349 + } 1.29350 + } 1.29351 + return domain.getClass('packageInternal __AS3__.vec.Vector$object').applyType(type); 1.29352 + } else { 1.29353 + return Shumway.Debug.notImplemented(factoryClassName); 1.29354 + } 1.29355 + } 1.29356 + Runtime.applyType = applyType; 1.29357 + }(AVM2.Runtime || (AVM2.Runtime = {}))); 1.29358 + var Runtime = AVM2.Runtime; 1.29359 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.29360 + var AVM2 = Shumway.AVM2; 1.29361 +}(Shumway || (Shumway = {}))); 1.29362 +var CC = Shumway.AVM2.Runtime.CODE_CACHE; 1.29363 +var VM_LENGTH = Shumway.AVM2.Runtime.VM_LENGTH; 1.29364 +var VM_IS_PROXY = Shumway.AVM2.Runtime.VM_IS_PROXY; 1.29365 +var VM_CALL_PROXY = Shumway.AVM2.Runtime.VM_CALL_PROXY; 1.29366 +var VM_NATIVE_BUILTIN_ORIGINALS = Shumway.AVM2.Runtime.VM_NATIVE_BUILTIN_ORIGINALS; 1.29367 +var VM_OPEN_METHOD_PREFIX = 'm'; 1.29368 +var VM_OPEN_SET_METHOD_PREFIX = 's'; 1.29369 +var VM_OPEN_GET_METHOD_PREFIX = 'g'; 1.29370 +var SAVED_SCOPE_NAME = '$SS'; 1.29371 +var originalStringReplace = String.prototype.replace; 1.29372 +XRegExp.install({ 1.29373 + natives: true 1.29374 +}); 1.29375 +var callWriter = new IndentingWriter(false, function (str) { 1.29376 + print(str); 1.29377 + }); 1.29378 +var objectIDs = 0; 1.29379 +var OBJECT_NAME = 'Object Name'; 1.29380 +function objectConstantName(object) { 1.29381 + true; 1.29382 + if (object.hasOwnProperty(OBJECT_NAME)) { 1.29383 + return object[OBJECT_NAME]; 1.29384 + } 1.29385 + if (object instanceof LazyInitializer) { 1.29386 + return object.getName(); 1.29387 + } 1.29388 + var name, id = objectIDs++; 1.29389 + if (object instanceof Global) { 1.29390 + name = '$G' + id; 1.29391 + } else if (object instanceof Multiname) { 1.29392 + name = '$M' + id; 1.29393 + } else if (isClass(object)) { 1.29394 + name = '$C' + id; 1.29395 + } else { 1.29396 + name = '$O' + id; 1.29397 + } 1.29398 + Object.defineProperty(object, OBJECT_NAME, { 1.29399 + value: name, 1.29400 + writable: false, 1.29401 + enumerable: false 1.29402 + }); 1.29403 + jsGlobal[name] = object; 1.29404 + return name; 1.29405 +} 1.29406 +var isClass = Shumway.AVM2.Runtime.isClass; 1.29407 +var isTrampoline = Shumway.AVM2.Runtime.isTrampoline; 1.29408 +var isMemoizer = Shumway.AVM2.Runtime.isMemoizer; 1.29409 +var LazyInitializer = Shumway.AVM2.Runtime.LazyInitializer; 1.29410 +var getNamespaceResolutionMap = Shumway.AVM2.Runtime.getNamespaceResolutionMap; 1.29411 +var resolveMultinameProperty = Shumway.AVM2.Runtime.resolveMultinameProperty; 1.29412 +var asGetPublicProperty = Shumway.AVM2.Runtime.asGetPublicProperty; 1.29413 +var asGetProperty = Shumway.AVM2.Runtime.asGetProperty; 1.29414 +var asGetPropertyLikelyNumeric = Shumway.AVM2.Runtime.asGetPropertyLikelyNumeric; 1.29415 +var asGetResolvedStringProperty = Shumway.AVM2.Runtime.asGetResolvedStringProperty; 1.29416 +var asCallResolvedStringProperty = Shumway.AVM2.Runtime.asCallResolvedStringProperty; 1.29417 +var asGetResolvedStringPropertyFallback = Shumway.AVM2.Runtime.asGetResolvedStringPropertyFallback; 1.29418 +var asSetPublicProperty = Shumway.AVM2.Runtime.asSetPublicProperty; 1.29419 +var asSetProperty = Shumway.AVM2.Runtime.asSetProperty; 1.29420 +var asSetPropertyLikelyNumeric = Shumway.AVM2.Runtime.asSetPropertyLikelyNumeric; 1.29421 +var asDefinePublicProperty = Shumway.AVM2.Runtime.asDefinePublicProperty; 1.29422 +var asDefineProperty = Shumway.AVM2.Runtime.asDefineProperty; 1.29423 +var asCallPublicProperty = Shumway.AVM2.Runtime.asCallPublicProperty; 1.29424 +var asCallProperty = Shumway.AVM2.Runtime.asCallProperty; 1.29425 +var asCallSuper = Shumway.AVM2.Runtime.asCallSuper; 1.29426 +var asSetSuper = Shumway.AVM2.Runtime.asSetSuper; 1.29427 +var asGetSuper = Shumway.AVM2.Runtime.asGetSuper; 1.29428 +var construct = Shumway.AVM2.Runtime.construct; 1.29429 +var asConstructProperty = Shumway.AVM2.Runtime.asConstructProperty; 1.29430 +var asHasProperty = Shumway.AVM2.Runtime.asHasProperty; 1.29431 +var asDeleteProperty = Shumway.AVM2.Runtime.asDeleteProperty; 1.29432 +var asGetNumericProperty = Shumway.AVM2.Runtime.asGetNumericProperty; 1.29433 +var asSetNumericProperty = Shumway.AVM2.Runtime.asSetNumericProperty; 1.29434 +var asGetDescendants = Shumway.AVM2.Runtime.asGetDescendants; 1.29435 +var asNextNameIndex = Shumway.AVM2.Runtime.asNextNameIndex; 1.29436 +var asNextName = Shumway.AVM2.Runtime.asNextName; 1.29437 +var asNextValue = Shumway.AVM2.Runtime.asNextValue; 1.29438 +var asGetEnumerableKeys = Shumway.AVM2.Runtime.asGetEnumerableKeys; 1.29439 +var initializeGlobalObject = Shumway.AVM2.Runtime.initializeGlobalObject; 1.29440 +initializeGlobalObject(jsGlobal); 1.29441 +var asTypeOf = Shumway.AVM2.Runtime.asTypeOf; 1.29442 +var publicizeProperties = Shumway.AVM2.Runtime.publicizeProperties; 1.29443 +var asGetSlot = Shumway.AVM2.Runtime.asGetSlot; 1.29444 +var asSetSlot = Shumway.AVM2.Runtime.asSetSlot; 1.29445 +var asHasNext2 = Shumway.AVM2.Runtime.asHasNext2; 1.29446 +var getDescendants = Shumway.AVM2.Runtime.getDescendants; 1.29447 +var checkFilter = Shumway.AVM2.Runtime.checkFilter; 1.29448 +var ActivationInfo = Shumway.AVM2.Runtime.ActivationInfo; 1.29449 +var ScopeStack = Shumway.AVM2.Runtime.ScopeStack; 1.29450 +var Scope = Shumway.AVM2.Runtime.Scope; 1.29451 +var bindFreeMethodScope = Shumway.AVM2.Runtime.bindFreeMethodScope; 1.29452 +var nameInTraits = Shumway.AVM2.Runtime.nameInTraits; 1.29453 +function resolveMultiname(object, mn, traitsOnly) { 1.29454 + return object.resolveMultinameProperty(mn.namespaces, mn.name, mn.flags); 1.29455 +} 1.29456 +var sliceArguments = Shumway.AVM2.Runtime.sliceArguments; 1.29457 +var nonProxyingHasProperty = Shumway.AVM2.Runtime.nonProxyingHasProperty; 1.29458 +var forEachPublicProperty = Shumway.AVM2.Runtime.forEachPublicProperty; 1.29459 +var wrapJSObject = Shumway.AVM2.Runtime.wrapJSObject; 1.29460 +var asCreateActivation = Shumway.AVM2.Runtime.asCreateActivation; 1.29461 +var CatchScopeObject = Shumway.AVM2.Runtime.CatchScopeObject; 1.29462 +var Global = Shumway.AVM2.Runtime.Global; 1.29463 +var canCompile = Shumway.AVM2.Runtime.canCompile; 1.29464 +var shouldCompile = Shumway.AVM2.Runtime.shouldCompile; 1.29465 +var forceCompile = Shumway.AVM2.Runtime.forceCompile; 1.29466 +var createInterpretedFunction = Shumway.AVM2.Runtime.createInterpretedFunction; 1.29467 +var debugName = Shumway.AVM2.Runtime.debugName; 1.29468 +var createCompiledFunction = Shumway.AVM2.Runtime.createCompiledFunction; 1.29469 +var getMethodOverrideKey = Shumway.AVM2.Runtime.getMethodOverrideKey; 1.29470 +var checkMethodOverrides = Shumway.AVM2.Runtime.checkMethodOverrides; 1.29471 +var makeTrampoline = Shumway.AVM2.Runtime.makeTrampoline; 1.29472 +var makeMemoizer = Shumway.AVM2.Runtime.makeMemoizer; 1.29473 +var createFunction = Shumway.AVM2.Runtime.createFunction; 1.29474 +var ensureFunctionIsInitialized = Shumway.AVM2.Runtime.ensureFunctionIsInitialized; 1.29475 +var getTraitFunction = Shumway.AVM2.Runtime.getTraitFunction; 1.29476 +var createClass = Shumway.AVM2.Runtime.createClass; 1.29477 +var sealConstantTraits = Shumway.AVM2.Runtime.sealConstantTraits; 1.29478 +var applyType = Shumway.AVM2.Runtime.applyType; 1.29479 +var throwError = Shumway.AVM2.Runtime.throwError; 1.29480 +var throwErrorFromVM = Shumway.AVM2.Runtime.throwErrorFromVM; 1.29481 +var translateError = Shumway.AVM2.Runtime.translateError; 1.29482 +var asIsInstanceOf = Shumway.AVM2.Runtime.asIsInstanceOf; 1.29483 +var asIsType = Shumway.AVM2.Runtime.asIsType; 1.29484 +var asAsType = Shumway.AVM2.Runtime.asAsType; 1.29485 +var asCoerceByMultiname = Shumway.AVM2.Runtime.asCoerceByMultiname; 1.29486 +var asCoerce = Shumway.AVM2.Runtime.asCoerce; 1.29487 +var asCoerceString = Shumway.AVM2.Runtime.asCoerceString; 1.29488 +var asCoerceInt = Shumway.AVM2.Runtime.asCoerceInt; 1.29489 +var asCoerceUint = Shumway.AVM2.Runtime.asCoerceUint; 1.29490 +var asCoerceNumber = Shumway.AVM2.Runtime.asCoerceNumber; 1.29491 +var asCoerceBoolean = Shumway.AVM2.Runtime.asCoerceBoolean; 1.29492 +var asCoerceObject = Shumway.AVM2.Runtime.asCoerceObject; 1.29493 +var asDefaultCompareFunction = Shumway.AVM2.Runtime.asDefaultCompareFunction; 1.29494 +var asCompare = Shumway.AVM2.Runtime.asCompare; 1.29495 +var asAdd = Shumway.AVM2.Runtime.asAdd; 1.29496 +var GlobalMultinameResolver = Shumway.AVM2.Runtime.GlobalMultinameResolver; 1.29497 +var Shumway; 1.29498 +(function (Shumway) { 1.29499 + (function (AVM2) { 1.29500 + (function (Runtime) { 1.29501 + Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES['static mochi.as3.MochiServices::connect'] = function () { 1.29502 + return; 1.29503 + }; 1.29504 + Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES['static MochiBot::track'] = function () { 1.29505 + return; 1.29506 + }; 1.29507 + Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES['com.midasplayer.debug.DebugLog::trace'] = function (msg) { 1.29508 + log(msg); 1.29509 + }; 1.29510 + Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES['com.midasplayer.engine.comm.DebugGameComm::getGameData'] = function () { 1.29511 + return '<gamedata randomseed="554884453" version="1">\n<musicOn>true</musicOn>\n<soundOn>true</soundOn>\n<isShortGame>false</isShortGame>\n<booster_1>0</booster_1>\n<booster_2>0</booster_2>\n<booster_3>0</booster_3>\n<booster_4>0</booster_4>\n<booster_5>0</booster_5>\n<bestScore>0</bestScore>\n<bestChain>0</bestChain>\n<bestLevel>0</bestLevel>\n<bestCrushed>0</bestCrushed>\n<bestMixed>0</bestMixed>\n<text id="outro.crushed">Candy crushed</text>\n<text id="outro.bestever">best ever</text>\n<text id="outro.trophy.two">scored {0} in one game</text>\n<text id="outro.combo_color_color">All Clear Created</text>\n<text id="outro.trophy.one">crushed {0} candy in one game</text>\n<text id="outro.score">Score</text>\n<text id="outro.opengame">Please register to play the full game</text>\n<text id="outro.chain">Longest chain</text>\n<text id="outro.time">Game ends in {0} seconds</text>\n<text id="outro.combo_color_line">Super Stripes Created</text>\n<text id="game.nomoves">No more moves!</text>\n<text id="outro.combo_wrapper_line">Mega-Candy Created</text>\n<text id="intro.time">Game starts in {0} seconds</text>\n<text id="outro.now">now</text>\n<text id="outro.level">Level reached</text>\n<text id="outro.title">Game Over</text>\n<text id="intro.info1">Match 3 Candy of the same colour to crush them. Matching 4 or 5 in different formations generates special sweets that are extra tasty.</text>\n<text id="intro.info2">You can also combine the special sweets for additional effects by switching them with each other. Try these combinations for a taste you will not forget: </text>\n<text id="outro.combo_color_wrapper">Double Colour Bombs Created</text>\n<text id="outro.trophy.three">made {0} combined candy in one game</text>\n<text id="intro.title">Play like this:</text>\n</gamedata>'; 1.29512 + }; 1.29513 + Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES['com.antkarlov.Preloader::com.antkarlov:Preloader.isUrl'] = function () { 1.29514 + return true; 1.29515 + }; 1.29516 + Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES['static com.demonsters.debugger.MonsterDebugger::initialize'] = function () { 1.29517 + }; 1.29518 + Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES['com.spilgames.api.core.tracking.TrackConfig::getTrackers'] = function () { 1.29519 + return []; 1.29520 + }; 1.29521 + Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES['com.spilgames.api.components.TextFields.AutoFitTextFieldEx::com.spilgames.api.components.TextFields:AutoFitTextFieldEx.updateProperties'] = Shumway.AVM2.Runtime.VM_METHOD_OVERRIDES['com.spilgames.api.components.TextFields.AutoFitTextFieldEx::com.spilgames.api.components.TextFields:AutoFitTextFieldEx.updateTextSize'] = function () { 1.29522 + }; 1.29523 + }(AVM2.Runtime || (AVM2.Runtime = {}))); 1.29524 + var Runtime = AVM2.Runtime; 1.29525 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.29526 + var AVM2 = Shumway.AVM2; 1.29527 +}(Shumway || (Shumway = {}))); 1.29528 +var checkArguments = true; 1.29529 +function asCheckVectorSetNumericProperty(i, length, fixed) { 1.29530 + if (i < 0 || i > length || i === length && fixed || !isNumeric(i)) { 1.29531 + throwError('RangeError', Errors.OutOfRangeError, i, length); 1.29532 + } 1.29533 +} 1.29534 +function asCheckVectorGetNumericProperty(i, length) { 1.29535 + if (i < 0 || i >= length || !isNumeric(i)) { 1.29536 + throwError('RangeError', Errors.OutOfRangeError, i, length); 1.29537 + } 1.29538 +} 1.29539 +var TypedArrayVector = function () { 1.29540 + var EXTRA_CAPACITY = 4; 1.29541 + var INITIAL_CAPACITY = 10; 1.29542 + var DEFAULT_VALUE = 0; 1.29543 + function vector(length, fixed) { 1.29544 + length = length | 0; 1.29545 + this._fixed = !(!fixed); 1.29546 + this._buffer = new Int32Array(Math.max(INITIAL_CAPACITY, length + EXTRA_CAPACITY)); 1.29547 + this._offset = 0; 1.29548 + this._length = length; 1.29549 + } 1.29550 + vector.callable = function (object) { 1.29551 + if (object instanceof vector) { 1.29552 + return object; 1.29553 + } 1.29554 + var length = object.asGetProperty(undefined, 'length'); 1.29555 + if (length !== undefined) { 1.29556 + var v = new vector(length, false); 1.29557 + for (var i = 0; i < length; i++) { 1.29558 + v.asSetNumericProperty(i, object.asGetPublicProperty(i)); 1.29559 + } 1.29560 + return v; 1.29561 + } 1.29562 + unexpected(); 1.29563 + }; 1.29564 + vector.prototype.internalToString = function () { 1.29565 + var str = ''; 1.29566 + var start = this._offset; 1.29567 + var end = start + this._length; 1.29568 + for (var i = 0; i < this._buffer.length; i++) { 1.29569 + if (i === start) { 1.29570 + str += '['; 1.29571 + } 1.29572 + if (i === end) { 1.29573 + str += ']'; 1.29574 + } 1.29575 + str += this._buffer[i]; 1.29576 + if (i < this._buffer.length - 1) { 1.29577 + str += ','; 1.29578 + } 1.29579 + } 1.29580 + if (this._offset + this._length === this._buffer.length) { 1.29581 + str += ']'; 1.29582 + } 1.29583 + return str + ': offset: ' + this._offset + ', length: ' + this._length + ', capacity: ' + this._buffer.length; 1.29584 + }; 1.29585 + vector.prototype.toString = function () { 1.29586 + var str = ''; 1.29587 + for (var i = 0; i < this._length; i++) { 1.29588 + str += this._buffer[this._offset + i]; 1.29589 + if (i < this._length - 1) { 1.29590 + str += ','; 1.29591 + } 1.29592 + } 1.29593 + return str; 1.29594 + }; 1.29595 + vector.prototype._view = function () { 1.29596 + return this._buffer.subarray(this._offset, this._offset + this._length); 1.29597 + }; 1.29598 + vector.prototype._ensureCapacity = function (length) { 1.29599 + var minCapacity = this._offset + length; 1.29600 + if (minCapacity < this._buffer.length) { 1.29601 + return; 1.29602 + } 1.29603 + if (length <= this._buffer.length) { 1.29604 + var offset = this._buffer.length - length >> 2; 1.29605 + this._buffer.set(this._view(), offset); 1.29606 + this._offset = offset; 1.29607 + return; 1.29608 + } 1.29609 + var oldCapacity = this._buffer.length; 1.29610 + var newCapacity = oldCapacity * 3 >> 2; 1.29611 + if (newCapacity < minCapacity) { 1.29612 + newCapacity = minCapacity; 1.29613 + } 1.29614 + var buffer = new Int32Array(newCapacity); 1.29615 + buffer.set(this._buffer, 0); 1.29616 + this._buffer = buffer; 1.29617 + }; 1.29618 + vector.prototype.concat = function () { 1.29619 + notImplemented('TypedArrayVector.concat'); 1.29620 + }; 1.29621 + vector.prototype.every = function (callback, thisObject) { 1.29622 + for (var i = 0; i < this._length; i++) { 1.29623 + if (!callback.call(thisObject, this.asGetNumericProperty(i), i, this)) { 1.29624 + return false; 1.29625 + } 1.29626 + } 1.29627 + return true; 1.29628 + }; 1.29629 + vector.prototype.filter = function (callback, thisObject) { 1.29630 + var v = new vector(); 1.29631 + for (var i = 0; i < this._length; i++) { 1.29632 + if (callback.call(thisObject, this.asGetNumericProperty(i), i, this)) { 1.29633 + v.push(this.asGetNumericProperty(i)); 1.29634 + } 1.29635 + } 1.29636 + return v; 1.29637 + }; 1.29638 + vector.prototype.some = function (callback, thisObject) { 1.29639 + if (arguments.length !== 2) { 1.29640 + throwError('ArgumentError', Errors.WrongArgumentCountError); 1.29641 + } else if (!isFunction(callback)) { 1.29642 + throwError('ArgumentError', Errors.CheckTypeFailedError); 1.29643 + } 1.29644 + for (var i = 0; i < this._length; i++) { 1.29645 + if (callback.call(thisObject, this.asGetNumericProperty(i), i, this)) { 1.29646 + return true; 1.29647 + } 1.29648 + } 1.29649 + return false; 1.29650 + }; 1.29651 + vector.prototype.forEach = function (callback, thisObject) { 1.29652 + for (var i = 0; i < this._length; i++) { 1.29653 + callback.call(thisObject, this.asGetNumericProperty(i), i, this); 1.29654 + } 1.29655 + }; 1.29656 + vector.prototype.join = function (sep) { 1.29657 + notImplemented('TypedArrayVector.join'); 1.29658 + }; 1.29659 + vector.prototype.indexOf = function (searchElement, fromIndex) { 1.29660 + notImplemented('TypedArrayVector.indexOf'); 1.29661 + }; 1.29662 + vector.prototype.lastIndexOf = function (searchElement, fromIndex) { 1.29663 + notImplemented('TypedArrayVector.lastIndexOf'); 1.29664 + }; 1.29665 + vector.prototype.map = function (callback, thisObject) { 1.29666 + if (!isFunction(callback)) { 1.29667 + throwError('ArgumentError', Errors.CheckTypeFailedError); 1.29668 + } 1.29669 + var v = new vector(); 1.29670 + for (var i = 0; i < this._length; i++) { 1.29671 + v.push(callback.call(thisObject, this.asGetNumericProperty(i), i, this)); 1.29672 + } 1.29673 + return v; 1.29674 + }; 1.29675 + vector.prototype.push = function () { 1.29676 + this._checkFixed(); 1.29677 + this._ensureCapacity(this._length + arguments.length); 1.29678 + for (var i = 0; i < arguments.length; i++) { 1.29679 + this._buffer[this._offset + this._length++] = arguments[i]; 1.29680 + } 1.29681 + }; 1.29682 + vector.prototype.pop = function () { 1.29683 + this._checkFixed(); 1.29684 + if (this._length === 0) { 1.29685 + return DEFAULT_VALUE; 1.29686 + } 1.29687 + this._length--; 1.29688 + return this._buffer[this._offset + this._length]; 1.29689 + }; 1.29690 + vector.prototype.reverse = function () { 1.29691 + var l = this._offset; 1.29692 + var r = this._offset + this._length - 1; 1.29693 + var b = this._buffer; 1.29694 + while (l < r) { 1.29695 + var t = b[l]; 1.29696 + b[l] = b[r]; 1.29697 + b[r] = t; 1.29698 + l++; 1.29699 + r--; 1.29700 + } 1.29701 + }; 1.29702 + vector.CASEINSENSITIVE = 1; 1.29703 + vector.DESCENDING = 2; 1.29704 + vector.UNIQUESORT = 4; 1.29705 + vector.RETURNINDEXEDARRAY = 8; 1.29706 + vector.NUMERIC = 16; 1.29707 + function defaultCompareFunction(a, b) { 1.29708 + return String(a).localeCompare(String(b)); 1.29709 + } 1.29710 + function compare(a, b, options, compareFunction) { 1.29711 + assertNotImplemented(!(options & vector.CASEINSENSITIVE), 'CASEINSENSITIVE'); 1.29712 + assertNotImplemented(!(options & vector.UNIQUESORT), 'UNIQUESORT'); 1.29713 + assertNotImplemented(!(options & vector.RETURNINDEXEDARRAY), 'RETURNINDEXEDARRAY'); 1.29714 + var result = 0; 1.29715 + if (!compareFunction) { 1.29716 + compareFunction = defaultCompareFunction; 1.29717 + } 1.29718 + if (options & vector.NUMERIC) { 1.29719 + a = toNumber(a); 1.29720 + b = toNumber(b); 1.29721 + result = a < b ? -1 : a > b ? 1 : 0; 1.29722 + } else { 1.29723 + result = compareFunction(a, b); 1.29724 + } 1.29725 + if (options & vector.DESCENDING) { 1.29726 + result *= -1; 1.29727 + } 1.29728 + return result; 1.29729 + } 1.29730 + function _sort(a) { 1.29731 + var stack = []; 1.29732 + var sp = -1; 1.29733 + var l = 0; 1.29734 + var r = a.length - 1; 1.29735 + var i, j, swap, temp; 1.29736 + while (true) { 1.29737 + if (r - l <= 100) { 1.29738 + for (j = l + 1; j <= r; j++) { 1.29739 + swap = a[j]; 1.29740 + i = j - 1; 1.29741 + while (i >= l && a[i] > swap) { 1.29742 + a[i + 1] = a[i--]; 1.29743 + } 1.29744 + a[i + 1] = swap; 1.29745 + } 1.29746 + if (sp == -1) { 1.29747 + break; 1.29748 + } 1.29749 + r = stack[sp--]; 1.29750 + l = stack[sp--]; 1.29751 + } else { 1.29752 + var median = l + r >> 1; 1.29753 + i = l + 1; 1.29754 + j = r; 1.29755 + swap = a[median]; 1.29756 + a[median] = a[i]; 1.29757 + a[i] = swap; 1.29758 + if (a[l] > a[r]) { 1.29759 + swap = a[l]; 1.29760 + a[l] = a[r]; 1.29761 + a[r] = swap; 1.29762 + } 1.29763 + if (a[i] > a[r]) { 1.29764 + swap = a[i]; 1.29765 + a[i] = a[r]; 1.29766 + a[r] = swap; 1.29767 + } 1.29768 + if (a[l] > a[i]) { 1.29769 + swap = a[l]; 1.29770 + a[l] = a[i]; 1.29771 + a[i] = swap; 1.29772 + } 1.29773 + temp = a[i]; 1.29774 + while (true) { 1.29775 + do { 1.29776 + i++; 1.29777 + } while (a[i] < temp); 1.29778 + do { 1.29779 + j--; 1.29780 + } while (a[j] > temp); 1.29781 + if (j < i) { 1.29782 + break; 1.29783 + } 1.29784 + swap = a[i]; 1.29785 + a[i] = a[j]; 1.29786 + a[j] = swap; 1.29787 + } 1.29788 + a[l + 1] = a[j]; 1.29789 + a[j] = temp; 1.29790 + if (r - i + 1 >= j - l) { 1.29791 + stack[++sp] = i; 1.29792 + stack[++sp] = r; 1.29793 + r = j - 1; 1.29794 + } else { 1.29795 + stack[++sp] = l; 1.29796 + stack[++sp] = j - 1; 1.29797 + l = i; 1.29798 + } 1.29799 + } 1.29800 + } 1.29801 + return a; 1.29802 + } 1.29803 + vector.prototype._sortNumeric = function (descending) { 1.29804 + _sort(this._view()); 1.29805 + if (descending) { 1.29806 + this.reverse(); 1.29807 + } 1.29808 + }; 1.29809 + vector.prototype.sort = function () { 1.29810 + if (arguments.length === 0) { 1.29811 + return Array.prototype.sort.call(this._view()); 1.29812 + } 1.29813 + var compareFunction, options = 0; 1.29814 + if (arguments[0] instanceof Function) { 1.29815 + compareFunction = arguments[0]; 1.29816 + } else if (isNumber(arguments[0])) { 1.29817 + options = arguments[0]; 1.29818 + } 1.29819 + if (isNumber(arguments[1])) { 1.29820 + options = arguments[1]; 1.29821 + } 1.29822 + if (options & TypedArrayVector.NUMERIC) { 1.29823 + return this._sortNumeric(options & vector.DESCENDING); 1.29824 + } 1.29825 + Array.prototype.sort.call(this._view(), function (a, b) { 1.29826 + return compare(a, b, options, compareFunction); 1.29827 + }); 1.29828 + }; 1.29829 + vector.prototype.asGetNumericProperty = function (i) { 1.29830 + checkArguments && asCheckVectorGetNumericProperty(i, this._length); 1.29831 + return this._buffer[this._offset + i]; 1.29832 + }; 1.29833 + vector.prototype.asSetNumericProperty = function (i, v) { 1.29834 + checkArguments && asCheckVectorSetNumericProperty(i, this._length, this._fixed); 1.29835 + if (i === this._length) { 1.29836 + this._ensureCapacity(this._length + 1); 1.29837 + this._length++; 1.29838 + } 1.29839 + this._buffer[this._offset + i] = v; 1.29840 + }; 1.29841 + vector.prototype.shift = function () { 1.29842 + this._checkFixed(); 1.29843 + if (this._length === 0) { 1.29844 + return 0; 1.29845 + } 1.29846 + this._length--; 1.29847 + return this._buffer[this._offset++]; 1.29848 + }; 1.29849 + vector.prototype._checkFixed = function () { 1.29850 + if (this._fixed) { 1.29851 + throwError('RangeError', Errors.VectorFixedError); 1.29852 + } 1.29853 + }; 1.29854 + vector.prototype._slide = function (distance) { 1.29855 + this._buffer.set(this._view(), this._offset + distance); 1.29856 + this._offset += distance; 1.29857 + }; 1.29858 + vector.prototype.unshift = function () { 1.29859 + this._checkFixed(); 1.29860 + if (!arguments.length) { 1.29861 + return; 1.29862 + } 1.29863 + this._ensureCapacity(this._length + arguments.length); 1.29864 + this._slide(arguments.length); 1.29865 + this._offset -= arguments.length; 1.29866 + this._length += arguments.length; 1.29867 + for (var i = 0; i < arguments.length; i++) { 1.29868 + this._buffer[this._offset + i] = arguments[i]; 1.29869 + } 1.29870 + }; 1.29871 + vector.prototype.asGetEnumerableKeys = function () { 1.29872 + if (vector.prototype === this) { 1.29873 + return Object.prototype.asGetEnumerableKeys.call(this); 1.29874 + } 1.29875 + var keys = []; 1.29876 + for (var i = 0; i < this._length; i++) { 1.29877 + keys.push(i); 1.29878 + } 1.29879 + return keys; 1.29880 + }; 1.29881 + vector.prototype.asHasProperty = function (namespaces, name, flags) { 1.29882 + if (vector.prototype === this || !isNumeric(name)) { 1.29883 + return Object.prototype.asHasProperty.call(this, namespaces, name, flags); 1.29884 + } 1.29885 + var index = toNumber(name); 1.29886 + return index >= 0 && index < this._length; 1.29887 + }; 1.29888 + Object.defineProperty(vector.prototype, 'length', { 1.29889 + get: function () { 1.29890 + return this._length; 1.29891 + }, 1.29892 + set: function (length) { 1.29893 + length = length >>> 0; 1.29894 + if (length > this._length) { 1.29895 + this._ensureCapacity(length); 1.29896 + for (var i = this._offset + this._length, j = this._offset + length; i < j; i++) { 1.29897 + this._buffer[i] = DEFAULT_VALUE; 1.29898 + } 1.29899 + } 1.29900 + this._length = length; 1.29901 + } 1.29902 + }); 1.29903 + vector.prototype._spliceHelper = function (index, insertCount, deleteCount, args, offset) { 1.29904 + insertCount = clamp(insertCount, 0, args.length - offset); 1.29905 + deleteCount = clamp(deleteCount, 0, this._length - index); 1.29906 + this._ensureCapacity(this._length - deleteCount + insertCount); 1.29907 + var right = this._offset + index + deleteCount; 1.29908 + var slice = this._buffer.subarray(right, right + this._length - index - deleteCount); 1.29909 + this._buffer.set(slice, this._offset + index + insertCount); 1.29910 + this._length += insertCount - deleteCount; 1.29911 + for (var i = 0; i < insertCount; i++) { 1.29912 + this._buffer[this._offset + index + i] = args.asGetNumericProperty(offset + i); 1.29913 + } 1.29914 + }; 1.29915 + vector.prototype.asGetEnumerableKeys = function () { 1.29916 + if (vector.prototype === this) { 1.29917 + return Object.prototype.asGetEnumerableKeys.call(this); 1.29918 + } 1.29919 + var keys = []; 1.29920 + for (var i = 0; i < this._length; i++) { 1.29921 + keys.push(i); 1.29922 + } 1.29923 + return keys; 1.29924 + }; 1.29925 + return vector; 1.29926 + }(); 1.29927 +var typedArrayVectorTemplate = 'var EXTRA_CAPACITY=4,INITIAL_CAPACITY=10,DEFAULT_VALUE=0;function vector(a,b){a|=0;this._fixed=!!b;this._buffer=new Int32Array(Math.max(INITIAL_CAPACITY,a+EXTRA_CAPACITY));this._offset=0;this._length=a}vector.callable=function(a){if(a instanceof vector)return a;var b=a.asGetProperty(void 0,"length");if(void 0!==b){for(var c=new vector(b,!1),d=0;d<b;d++)c.asSetNumericProperty(d,a.asGetPublicProperty(d));return c}unexpected()}; vector.prototype.internalToString=function(){for(var a="",b=this._offset,c=b+this._length,d=0;d<this._buffer.length;d++)d===b&&(a+="["),d===c&&(a+="]"),a+=this._buffer[d],d<this._buffer.length-1&&(a+=",");this._offset+this._length===this._buffer.length&&(a+="]");return a+": offset: "+this._offset+", length: "+this._length+", capacity: "+this._buffer.length};vector.prototype.toString=function(){for(var a="",b=0;b<this._length;b++)a+=this._buffer[this._offset+b],b<this._length-1&&(a+=",");return a}; vector.prototype._view=function(){return this._buffer.subarray(this._offset,this._offset+this._length)};vector.prototype._ensureCapacity=function(a){var b=this._offset+a;b<this._buffer.length||(a<=this._buffer.length?(b=this._buffer.length-a>>2,this._buffer.set(this._view(),b),this._offset=b):(a=3*this._buffer.length>>2,a<b&&(a=b),b=new Int32Array(a),b.set(this._buffer,0),this._buffer=b))}; vector.prototype.every=function(a,b){for(var c=0;c<this._length;c++)if(!a.call(b,this.asGetNumericProperty(c),c,this))return!1;return!0};vector.prototype.filter=function(a,b){for(var c=new vector,d=0;d<this._length;d++)a.call(b,this.asGetNumericProperty(d),d,this)&&c.push(this.asGetNumericProperty(d));return c}; vector.prototype.some=function(a,b){2!==arguments.length?throwError("ArgumentError",Errors.WrongArgumentCountError):isFunction(a)||throwError("ArgumentError",Errors.CheckTypeFailedError);for(var c=0;c<this._length;c++)if(a.call(b,this.asGetNumericProperty(c),c,this))return!0;return!1};vector.prototype.forEach=function(a,b){for(var c=0;c<this._length;c++)a.call(b,this.asGetNumericProperty(c),c,this)};vector.prototype.join=function(a){notImplemented("TypedArrayVector.join")}; vector.prototype.indexOf=function(a,b){notImplemented("TypedArrayVector.indexOf")};vector.prototype.lastIndexOf=function(a,b){notImplemented("TypedArrayVector.lastIndexOf")};vector.prototype.map=function(a,b){isFunction(a)||throwError("ArgumentError",Errors.CheckTypeFailedError);for(var c=new vector,d=0;d<this._length;d++)c.push(a.call(b,this.asGetNumericProperty(d),d,this));return c}; vector.prototype.push=function(){this._checkFixed();this._ensureCapacity(this._length+arguments.length);for(var a=0;a<arguments.length;a++)this._buffer[this._offset+this._length++]=arguments[a]};vector.prototype.pop=function(){this._checkFixed();if(0===this._length)return DEFAULT_VALUE;this._length--;return this._buffer[this._offset+this._length]};vector.prototype.reverse=function(){for(var a=this._offset,b=this._offset+this._length-1,c=this._buffer;a<b;){var d=c[a];c[a]=c[b];c[b]=d;a++;b--}}; vector.CASEINSENSITIVE=1;vector.DESCENDING=2;vector.UNIQUESORT=4;vector.RETURNINDEXEDARRAY=8;vector.NUMERIC=16;function defaultCompareFunction(a,b){return String(a).localeCompare(String(b))} function compare(a,b,c,d){assertNotImplemented(!(c&vector.CASEINSENSITIVE),"CASEINSENSITIVE");assertNotImplemented(!(c&vector.UNIQUESORT),"UNIQUESORT");assertNotImplemented(!(c&vector.RETURNINDEXEDARRAY),"RETURNINDEXEDARRAY");var f=0;d||(d=defaultCompareFunction);c&vector.NUMERIC?(a=toNumber(a),b=toNumber(b),f=a<b?-1:a>b?1:0):f=d(a,b);c&vector.DESCENDING&&(f*=-1);return f} function _sort(a){for(var b=[],c=-1,d=0,f=a.length-1,e,g,h,k;;)if(100>=f-d){for(g=d+1;g<=f;g++){h=a[g];for(e=g-1;e>=d&&a[e]>h;)a[e+1]=a[e--];a[e+1]=h}if(-1==c)break;f=b[c--];d=b[c--]}else{k=d+f>>1;e=d+1;g=f;h=a[k];a[k]=a[e];a[e]=h;a[d]>a[f]&&(h=a[d],a[d]=a[f],a[f]=h);a[e]>a[f]&&(h=a[e],a[e]=a[f],a[f]=h);a[d]>a[e]&&(h=a[d],a[d]=a[e],a[e]=h);for(k=a[e];;){do e++;while(a[e]<k);do g--;while(a[g]>k);if(g<e)break;h=a[e];a[e]=a[g];a[g]=h}a[d+1]=a[g];a[g]=k;f-e+1>=g-d?(b[++c]=e,b[++c]=f,f=g-1):(b[++c]=d, b[++c]=g-1,d=e)}return a}vector.prototype._sortNumeric=function(a){_sort(this._view());a&&this.reverse()};vector.prototype.sort=function(){if(0===arguments.length)return Array.prototype.sort.call(this._view());var a,b=0;arguments[0]instanceof Function?a=arguments[0]:isNumber(arguments[0])&&(b=arguments[0]);isNumber(arguments[1])&&(b=arguments[1]);if(b&TypedArrayVector.NUMERIC)return this._sortNumeric(b&vector.DESCENDING);Array.prototype.sort.call(this._view(),function(c,d){return compare(c,d,b,a)})}; vector.prototype.asGetNumericProperty=function(a){checkArguments&&asCheckVectorGetNumericProperty(a,this._length);return this._buffer[this._offset+a]};vector.prototype.asSetNumericProperty=function(a,b){checkArguments&&asCheckVectorSetNumericProperty(a,this._length,this._fixed);a===this._length&&(this._ensureCapacity(this._length+1),this._length++);this._buffer[this._offset+a]=b};vector.prototype.shift=function(){this._checkFixed();if(0===this._length)return 0;this._length--;return this._buffer[this._offset++]}; vector.prototype._checkFixed=function(){this._fixed&&throwError("RangeError",Errors.VectorFixedError)};vector.prototype._slide=function(a){this._buffer.set(this._view(),this._offset+a);this._offset+=a};vector.prototype.unshift=function(){this._checkFixed();if(arguments.length){this._ensureCapacity(this._length+arguments.length);this._slide(arguments.length);this._offset-=arguments.length;this._length+=arguments.length;for(var a=0;a<arguments.length;a++)this._buffer[this._offset+a]=arguments[a]}}; vector.prototype.asGetEnumerableKeys=function(){if(vector.prototype===this)return Object.prototype.asGetEnumerableKeys.call(this);for(var a=[],b=0;b<this._length;b++)a.push(b);return a};vector.prototype.asHasProperty=function(a,b,c){if(vector.prototype===this||!isNumeric(b))return Object.prototype.asHasProperty.call(this,a,b,c);a=toNumber(b);return 0<=a&&a<this._length}; Object.defineProperty(vector.prototype,"length",{get:function(){return this._length},set:function(a){a>>>=0;if(a>this._length){this._ensureCapacity(a);for(var b=this._offset+this._length,c=this._offset+a;b<c;b++)this._buffer[b]=DEFAULT_VALUE}this._length=a}}); vector.prototype._spliceHelper=function(a,b,c,d,f){debugger;b=clamp(b,0,d.length-f);c=clamp(c,0,this._length-a);this._ensureCapacity(this._length-c+b);var e=this._offset+a+c,e=this._buffer.subarray(e,e+this._length-a-c);this._buffer.set(e,this._offset+a+b);this._length+=b-c;for(c=0;c<b;c++)this._buffer[this._offset+a+c]=d.asGetNumericProperty(f+c)}; vector.prototype.asGetEnumerableKeys=function(){if(vector.prototype===this)return Object.prototype.asGetEnumerableKeys.call(this);for(var a=[],b=0;b<this._length;b++)a.push(b);return a};'; 1.29928 +var Int32Vector = TypedArrayVector; 1.29929 +var Uint32Vector = new Function(originalStringReplace.call(typedArrayVectorTemplate, /Int32Array/g, 'Uint32Array') + ' return vector;')(); 1.29930 +var Float64Vector = new Function(originalStringReplace.call(typedArrayVectorTemplate, /Int32Array/g, 'Float64Array') + ' return vector;')(); 1.29931 +Int32Vector.prototype.asGetProperty = function (namespaces, name, flags) { 1.29932 + if (typeof name === 'number') { 1.29933 + return this.asGetNumericProperty(name); 1.29934 + } 1.29935 + return asGetProperty.call(this, namespaces, name, flags); 1.29936 +}; 1.29937 +Int32Vector.prototype.asSetProperty = function (namespaces, name, flags, value) { 1.29938 + if (typeof name === 'number') { 1.29939 + this.asSetNumericProperty(name, value); 1.29940 + return; 1.29941 + } 1.29942 + return asSetProperty.call(this, namespaces, name, flags, value); 1.29943 +}; 1.29944 +Uint32Vector.prototype.asGetProperty = function (namespaces, name, flags) { 1.29945 + if (typeof name === 'number') { 1.29946 + return this.asGetNumericProperty(name); 1.29947 + } 1.29948 + return asGetProperty.call(this, namespaces, name, flags); 1.29949 +}; 1.29950 +Uint32Vector.prototype.asSetProperty = function (namespaces, name, flags, value) { 1.29951 + if (typeof name === 'number') { 1.29952 + this.asSetNumericProperty(name, value); 1.29953 + return; 1.29954 + } 1.29955 + return asSetProperty.call(this, namespaces, name, flags, value); 1.29956 +}; 1.29957 +Float64Vector.prototype.asGetProperty = function (namespaces, name, flags) { 1.29958 + if (typeof name === 'number') { 1.29959 + return this.asGetNumericProperty(name); 1.29960 + } 1.29961 + return asGetProperty.call(this, namespaces, name, flags); 1.29962 +}; 1.29963 +Float64Vector.prototype.asSetProperty = function (namespaces, name, flags, value) { 1.29964 + if (typeof name === 'number') { 1.29965 + this.asSetNumericProperty(name, value); 1.29966 + return; 1.29967 + } 1.29968 + return asSetProperty.call(this, namespaces, name, flags, value); 1.29969 +}; 1.29970 +var GenericVector = function () { 1.29971 + function vector(length, fixed, type) { 1.29972 + length = length | 0; 1.29973 + this._fixed = !(!fixed); 1.29974 + this._buffer = new Array(length); 1.29975 + this._type = type; 1.29976 + this._defaultValue = type ? type.defaultValue : null; 1.29977 + this._fill(0, length, this._defaultValue); 1.29978 + } 1.29979 + vector.applyType = function applyType(type) { 1.29980 + function parameterizedVector(length, fixed) { 1.29981 + vector.call(this, length, fixed, type); 1.29982 + } 1.29983 + parameterizedVector.prototype = Object.create(vector.prototype); 1.29984 + parameterizedVector.callable = vector.callable; 1.29985 + return parameterizedVector; 1.29986 + }; 1.29987 + vector.callable = function (object) { 1.29988 + if (object instanceof vector) { 1.29989 + return object; 1.29990 + } 1.29991 + var length = object.asGetProperty(undefined, 'length'); 1.29992 + if (length !== undefined) { 1.29993 + var v = new vector(length, false); 1.29994 + for (var i = 0; i < length; i++) { 1.29995 + v.asSetNumericProperty(i, object.asGetPublicProperty(i)); 1.29996 + } 1.29997 + return v; 1.29998 + } 1.29999 + unexpected(); 1.30000 + }; 1.30001 + vector.prototype._fill = function (index, length, value) { 1.30002 + for (var i = 0; i < length; i++) { 1.30003 + this._buffer[index + i] = value; 1.30004 + } 1.30005 + }; 1.30006 + vector.prototype.toString = function () { 1.30007 + var str = ''; 1.30008 + for (var i = 0; i < this._buffer.length; i++) { 1.30009 + str += this._buffer[i]; 1.30010 + if (i < this._buffer.length - 1) { 1.30011 + str += ','; 1.30012 + } 1.30013 + } 1.30014 + return str; 1.30015 + }; 1.30016 + vector.prototype.every = function (callback, thisObject) { 1.30017 + for (var i = 0; i < this._buffer.length; i++) { 1.30018 + if (!callback.call(thisObject, this.asGetNumericProperty(i), i, this)) { 1.30019 + return false; 1.30020 + } 1.30021 + } 1.30022 + return true; 1.30023 + }; 1.30024 + vector.prototype.filter = function (callback, thisObject) { 1.30025 + var v = new vector(); 1.30026 + for (var i = 0; i < this._buffer.length; i++) { 1.30027 + if (callback.call(thisObject, this.asGetNumericProperty(i), i, this)) { 1.30028 + v.push(this.asGetNumericProperty(i)); 1.30029 + } 1.30030 + } 1.30031 + return v; 1.30032 + }; 1.30033 + vector.prototype.some = function (callback, thisObject) { 1.30034 + if (arguments.length !== 2) { 1.30035 + throwError('ArgumentError', Errors.WrongArgumentCountError); 1.30036 + } else if (!isFunction(callback)) { 1.30037 + throwError('ArgumentError', Errors.CheckTypeFailedError); 1.30038 + } 1.30039 + for (var i = 0; i < this._buffer.length; i++) { 1.30040 + if (callback.call(thisObject, this.asGetNumericProperty(i), i, this)) { 1.30041 + return true; 1.30042 + } 1.30043 + } 1.30044 + return false; 1.30045 + }; 1.30046 + vector.prototype.forEach = function (callback, thisObject) { 1.30047 + if (!isFunction(callback)) { 1.30048 + throwError('ArgumentError', Errors.CheckTypeFailedError); 1.30049 + } 1.30050 + for (var i = 0; i < this._buffer.length; i++) { 1.30051 + callback.call(thisObject, this.asGetNumericProperty(i), i, this); 1.30052 + } 1.30053 + }; 1.30054 + vector.prototype.map = function (callback, thisObject) { 1.30055 + if (!isFunction(callback)) { 1.30056 + throwError('ArgumentError', Errors.CheckTypeFailedError); 1.30057 + } 1.30058 + var v = new vector(); 1.30059 + for (var i = 0; i < this._buffer.length; i++) { 1.30060 + v.push(callback.call(thisObject, this.asGetNumericProperty(i), i, this)); 1.30061 + } 1.30062 + return v; 1.30063 + }; 1.30064 + vector.prototype.push = function () { 1.30065 + this._checkFixed(); 1.30066 + for (var i = 0; i < arguments.length; i++) { 1.30067 + this._buffer.push(this._coerce(arguments[i])); 1.30068 + } 1.30069 + }; 1.30070 + vector.prototype.pop = function () { 1.30071 + this._checkFixed(); 1.30072 + if (this._buffer.length === 0) { 1.30073 + return undefined; 1.30074 + } 1.30075 + return this._buffer.pop(); 1.30076 + }; 1.30077 + vector.prototype.reverse = function () { 1.30078 + this._buffer.reverse(); 1.30079 + }; 1.30080 + vector.CASEINSENSITIVE = 1; 1.30081 + vector.DESCENDING = 2; 1.30082 + vector.UNIQUESORT = 4; 1.30083 + vector.RETURNINDEXEDARRAY = 8; 1.30084 + vector.NUMERIC = 16; 1.30085 + function defaultCompareFunction(a, b) { 1.30086 + return String(a).localeCompare(String(b)); 1.30087 + } 1.30088 + function compare(a, b, options, compareFunction) { 1.30089 + assertNotImplemented(!(options & CASEINSENSITIVE), 'CASEINSENSITIVE'); 1.30090 + assertNotImplemented(!(options & UNIQUESORT), 'UNIQUESORT'); 1.30091 + assertNotImplemented(!(options & RETURNINDEXEDARRAY), 'RETURNINDEXEDARRAY'); 1.30092 + var result = 0; 1.30093 + if (!compareFunction) { 1.30094 + compareFunction = defaultCompareFunction; 1.30095 + } 1.30096 + if (options & NUMERIC) { 1.30097 + a = toNumber(a); 1.30098 + b = toNumber(b); 1.30099 + result = a < b ? -1 : a > b ? 1 : 0; 1.30100 + } else { 1.30101 + result = compareFunction(a, b); 1.30102 + } 1.30103 + if (options & DESCENDING) { 1.30104 + result *= -1; 1.30105 + } 1.30106 + return result; 1.30107 + } 1.30108 + vector.prototype.sort = function (comparator) { 1.30109 + return this._buffer.sort(comparator); 1.30110 + }; 1.30111 + vector.prototype.asGetNumericProperty = function (i) { 1.30112 + checkArguments && asCheckVectorGetNumericProperty(i, this._buffer.length); 1.30113 + return this._buffer[i]; 1.30114 + }; 1.30115 + vector.prototype._coerce = function (v) { 1.30116 + if (this._type) { 1.30117 + return this._type.coerce(v); 1.30118 + } else if (v === undefined) { 1.30119 + return null; 1.30120 + } 1.30121 + return v; 1.30122 + }; 1.30123 + vector.prototype.asSetNumericProperty = function (i, v) { 1.30124 + checkArguments && asCheckVectorSetNumericProperty(i, this._buffer.length, this._fixed); 1.30125 + this._buffer[i] = this._coerce(v); 1.30126 + }; 1.30127 + vector.prototype.shift = function () { 1.30128 + this._checkFixed(); 1.30129 + if (this._buffer.length === 0) { 1.30130 + return undefined; 1.30131 + } 1.30132 + return this._buffer.shift(); 1.30133 + }; 1.30134 + vector.prototype._checkFixed = function () { 1.30135 + if (this._fixed) { 1.30136 + throwError('RangeError', Errors.VectorFixedError); 1.30137 + } 1.30138 + }; 1.30139 + vector.prototype.unshift = function () { 1.30140 + if (!arguments.length) { 1.30141 + return; 1.30142 + } 1.30143 + this._checkFixed(); 1.30144 + var items = []; 1.30145 + for (var i = 0; i < arguments.length; i++) { 1.30146 + items.push(this._coerce(arguments[i])); 1.30147 + } 1.30148 + this._buffer.unshift.apply(this._buffer, items); 1.30149 + }; 1.30150 + Object.defineProperty(vector.prototype, 'length', { 1.30151 + get: function () { 1.30152 + return this._buffer.length; 1.30153 + }, 1.30154 + set: function (length) { 1.30155 + length = length >>> 0; 1.30156 + if (length > this._buffer.length) { 1.30157 + for (var i = this._buffer.length; i < length; i++) { 1.30158 + this._buffer[i] = this._defaultValue; 1.30159 + } 1.30160 + } else { 1.30161 + this._buffer.length = length; 1.30162 + } 1.30163 + true; 1.30164 + } 1.30165 + }); 1.30166 + vector.prototype._spliceHelper = function (index, insertCount, deleteCount, args, offset) { 1.30167 + insertCount = clamp(insertCount, 0, args.length - offset); 1.30168 + deleteCount = clamp(deleteCount, 0, this._buffer.length - index); 1.30169 + var items = []; 1.30170 + for (var i = 0; i < insertCount; i++) { 1.30171 + items.push(this._coerce(args.asGetNumericProperty(offset + i))); 1.30172 + } 1.30173 + this._buffer.splice.apply(this._buffer, [ 1.30174 + index, 1.30175 + deleteCount 1.30176 + ].concat(items)); 1.30177 + }; 1.30178 + vector.prototype.asGetEnumerableKeys = function () { 1.30179 + if (vector.prototype === this) { 1.30180 + return Object.prototype.asGetEnumerableKeys.call(this); 1.30181 + } 1.30182 + var keys = []; 1.30183 + for (var i = 0; i < this._buffer.length; i++) { 1.30184 + keys.push(i); 1.30185 + } 1.30186 + return keys; 1.30187 + }; 1.30188 + vector.prototype.asHasProperty = function (namespaces, name, flags) { 1.30189 + if (vector.prototype === this || !isNumeric(name)) { 1.30190 + return Object.prototype.asHasProperty.call(this, namespaces, name, flags); 1.30191 + } 1.30192 + var index = toNumber(name); 1.30193 + return index >= 0 && index < this._buffer.length; 1.30194 + }; 1.30195 + return vector; 1.30196 + }(); 1.30197 +GenericVector.prototype.asGetProperty = function (namespaces, name, flags) { 1.30198 + if (typeof name === 'number') { 1.30199 + return this.asGetNumericProperty(name); 1.30200 + } 1.30201 + return asGetProperty.call(this, namespaces, name, flags); 1.30202 +}; 1.30203 +GenericVector.prototype.asSetProperty = function (namespaces, name, flags, value) { 1.30204 + if (typeof name === 'number') { 1.30205 + this.asSetNumericProperty(name, value); 1.30206 + return; 1.30207 + } 1.30208 + return asSetProperty.call(this, namespaces, name, flags, value); 1.30209 +}; 1.30210 +function arraySort(o, args) { 1.30211 + if (args.length === 0) { 1.30212 + return o.sort(); 1.30213 + } 1.30214 + var compareFunction, options = 0; 1.30215 + if (args[0] instanceof Function) { 1.30216 + compareFunction = args[0]; 1.30217 + } else if (isNumber(args[0])) { 1.30218 + options = args[0]; 1.30219 + } 1.30220 + if (isNumber(args[1])) { 1.30221 + options = args[1]; 1.30222 + } 1.30223 + o.sort(function (a, b) { 1.30224 + return asCompare(a, b, options, compareFunction); 1.30225 + }); 1.30226 + return o; 1.30227 +} 1.30228 +function ArrayClass(domain, scope, instanceConstructor, baseClass) { 1.30229 + var c = new Class('Array', Array, ApplicationDomain.passthroughCallable(Array)); 1.30230 + c.extendBuiltin(baseClass); 1.30231 + var CACHE_NUMERIC_COMPARATORS = true; 1.30232 + var numericComparatorCache = createEmptyObject(); 1.30233 + c.native = { 1.30234 + static: { 1.30235 + _pop: function _pop(o) { 1.30236 + return o.pop(); 1.30237 + }, 1.30238 + _reverse: function _reverse(o) { 1.30239 + return o.reverse(); 1.30240 + }, 1.30241 + _concat: function _concat(o, args) { 1.30242 + return o.concat.apply(o, args); 1.30243 + }, 1.30244 + _shift: function _shift(o) { 1.30245 + return o.shift(); 1.30246 + }, 1.30247 + _slice: function _slice(o, A, B) { 1.30248 + return o.slice(A, B); 1.30249 + }, 1.30250 + _unshift: function _unshift(o, args) { 1.30251 + return o.unshift.apply(o, args); 1.30252 + }, 1.30253 + _splice: function _splice(o, args) { 1.30254 + return o.splice.apply(o, args); 1.30255 + }, 1.30256 + _sort: function _sort(o, args) { 1.30257 + if (args.length === 0) { 1.30258 + return o.sort(); 1.30259 + } 1.30260 + var compareFunction, options = 0; 1.30261 + if (args[0] instanceof Function) { 1.30262 + compareFunction = args[0]; 1.30263 + } else if (isNumber(args[0])) { 1.30264 + options = args[0]; 1.30265 + } 1.30266 + if (isNumber(args[1])) { 1.30267 + options = args[1]; 1.30268 + } 1.30269 + o.sort(function (a, b) { 1.30270 + return asCompare(a, b, options, compareFunction); 1.30271 + }); 1.30272 + return o; 1.30273 + }, 1.30274 + _sortOn: function _sortOn(o, names, options) { 1.30275 + if (isString(names)) { 1.30276 + names = [ 1.30277 + names 1.30278 + ]; 1.30279 + } 1.30280 + if (isNumber(options)) { 1.30281 + options = [ 1.30282 + options 1.30283 + ]; 1.30284 + } 1.30285 + for (var i = names.length - 1; i >= 0; i--) { 1.30286 + var key = Multiname.getPublicQualifiedName(names[i]); 1.30287 + if (CACHE_NUMERIC_COMPARATORS && options[i] & SORT_NUMERIC) { 1.30288 + var str = 'var x = toNumber(a.' + key + '), y = toNumber(b.' + key + ');'; 1.30289 + if (options[i] & SORT_DESCENDING) { 1.30290 + str += 'return x < y ? 1 : (x > y ? -1 : 0);'; 1.30291 + } else { 1.30292 + str += 'return x < y ? -1 : (x > y ? 1 : 0);'; 1.30293 + } 1.30294 + var numericComparator = numericComparatorCache[str]; 1.30295 + if (!numericComparator) { 1.30296 + numericComparator = numericComparatorCache[str] = new Function('a', 'b', str); 1.30297 + } 1.30298 + o.sort(numericComparator); 1.30299 + } else { 1.30300 + o.sort(function (a, b) { 1.30301 + return asCompare(a[key], b[key], options[i] | 0); 1.30302 + }); 1.30303 + } 1.30304 + } 1.30305 + return o; 1.30306 + }, 1.30307 + _indexOf: function _indexOf(o, searchElement, fromIndex) { 1.30308 + return o.indexOf(searchElement, fromIndex); 1.30309 + }, 1.30310 + _lastIndexOf: function _lastIndexOf(o, searchElement, fromIndex) { 1.30311 + return o.lastIndexOf(searchElement, fromIndex); 1.30312 + }, 1.30313 + _every: function _every(o, callback, thisObject) { 1.30314 + for (var i = 0; i < o.length; i++) { 1.30315 + if (callback.call(thisObject, o[i], i, o) !== true) { 1.30316 + return false; 1.30317 + } 1.30318 + } 1.30319 + return false; 1.30320 + }, 1.30321 + _filter: function _filter(o, callback, thisObject) { 1.30322 + var result = []; 1.30323 + for (var i = 0; i < o.length; i++) { 1.30324 + if (callback.call(thisObject, o[i], i, o) === true) { 1.30325 + result.push(o[i]); 1.30326 + } 1.30327 + } 1.30328 + return result; 1.30329 + }, 1.30330 + _forEach: function _forEach(o, callback, thisObject) { 1.30331 + return o.forEach(callback, thisObject); 1.30332 + }, 1.30333 + _map: function _map(o, callback, thisObject) { 1.30334 + return o.map(callback, thisObject); 1.30335 + }, 1.30336 + _some: function _some(o, callback, thisObject) { 1.30337 + return o.some(callback, thisObject); 1.30338 + } 1.30339 + }, 1.30340 + instance: { 1.30341 + pop: Array.prototype.pop, 1.30342 + push: Array.prototype.push, 1.30343 + unshift: Array.prototype.unshift, 1.30344 + length: { 1.30345 + get: function length() { 1.30346 + return this.length; 1.30347 + }, 1.30348 + set: function length(newLength) { 1.30349 + this.length = newLength; 1.30350 + } 1.30351 + } 1.30352 + } 1.30353 + }; 1.30354 + c.coerce = function (value) { 1.30355 + return value; 1.30356 + }; 1.30357 + c.isInstanceOf = function (value) { 1.30358 + return true; 1.30359 + }; 1.30360 + return c; 1.30361 +} 1.30362 +var XMLClass, XMLListClass, QNameClass, ASXML, XML, ASXMLList, XMLList; 1.30363 +var isXMLType, isXMLName, XMLParser; 1.30364 +(function () { 1.30365 + function XMLEncoder(ancestorNamespaces, indentLevel, prettyPrinting) { 1.30366 + function visit(node, encode) { 1.30367 + if (node.isXML) { 1.30368 + switch (node.kind) { 1.30369 + case 'element': 1.30370 + return encode.element(node); 1.30371 + case 'attribute': 1.30372 + return encode.attribute(node); 1.30373 + case 'text': 1.30374 + return encode.text(node); 1.30375 + case 'cdata': 1.30376 + return encode.cdata(node); 1.30377 + case 'comment': 1.30378 + return encode.comment(node); 1.30379 + case 'processing-instruction': 1.30380 + return encode.pi(node); 1.30381 + } 1.30382 + } else if (node.isXMLList) { 1.30383 + return encode.list(node); 1.30384 + } else { 1.30385 + throw 'Not implemented'; 1.30386 + } 1.30387 + } 1.30388 + function encode(node, encoder) { 1.30389 + return visit(node, { 1.30390 + element: function (n) { 1.30391 + var s, a; 1.30392 + var ns = n.name.mn.namespaces[0]; 1.30393 + var prefix = ns.prefix ? ns.prefix + ':' : ''; 1.30394 + s = '<' + prefix + n.name.localName; 1.30395 + var namespaceDeclarations = []; 1.30396 + if (ns.prefix || ns.uri) { 1.30397 + namespaceDeclarations.push(ns); 1.30398 + } 1.30399 + if (prefix) { 1.30400 + namespaceDeclarations[ns.prefix] = true; 1.30401 + } 1.30402 + var t = n; 1.30403 + while (t) { 1.30404 + for (var i = 0; i < t.inScopeNamespaces.length; i++) { 1.30405 + ns = t.inScopeNamespaces[i]; 1.30406 + if (!namespaceDeclarations[ns.prefix]) { 1.30407 + namespaceDeclarations.push(ns); 1.30408 + namespaceDeclarations[ns.prefix] = true; 1.30409 + } 1.30410 + } 1.30411 + t = t.parent; 1.30412 + } 1.30413 + for (var i = 0; i < namespaceDeclarations.length; i++) { 1.30414 + a = namespaceDeclarations[i]; 1.30415 + if (a.prefix) { 1.30416 + s += ' xmlns:' + a.prefix + '="' + a.uri + '"'; 1.30417 + } else { 1.30418 + s += ' xmlns="' + a.uri + '"'; 1.30419 + } 1.30420 + } 1.30421 + for (var i = 0; i < n.attributes.length; i++) { 1.30422 + a = n.attributes[i]; 1.30423 + var ns = n.name.uri; 1.30424 + var prefix = n.prefix ? ns.prefix + ':' : ''; 1.30425 + var name = prefix + a.name.localName; 1.30426 + s += ' ' + name + '="' + a.value + '"'; 1.30427 + } 1.30428 + if (n.children.length) { 1.30429 + s += '>'; 1.30430 + for (var i = 0; i < n.children.length; i++) { 1.30431 + s += visit(n.children[i], this); 1.30432 + } 1.30433 + s += '</' + prefix + n.name.mn.name + '>'; 1.30434 + } else { 1.30435 + s += '/>'; 1.30436 + } 1.30437 + return s; 1.30438 + }, 1.30439 + text: function (text) { 1.30440 + return escapeAttributeValue(text.value); 1.30441 + }, 1.30442 + attribute: function (n) { 1.30443 + return escapeAttributeValue(n.value); 1.30444 + }, 1.30445 + cdata: function (n) { 1.30446 + }, 1.30447 + comment: function (n) { 1.30448 + }, 1.30449 + pi: function (n) { 1.30450 + }, 1.30451 + doctype: function (n) { 1.30452 + }, 1.30453 + list: function (n) { 1.30454 + var s = ''; 1.30455 + for (var i = 0; i < n.children.length; i++) { 1.30456 + if (i > 0) { 1.30457 + s += '\n'; 1.30458 + } 1.30459 + s += toXMLString(n.children[i], []); 1.30460 + } 1.30461 + return s; 1.30462 + } 1.30463 + }); 1.30464 + } 1.30465 + this.encode = encode; 1.30466 + } 1.30467 + function escapeAttributeValue(v) { 1.30468 + return v.replace('&', '&').replace('<', '<').replace('>', '>'); 1.30469 + } 1.30470 + XMLParser = function XMLParser() { 1.30471 + function parseXml(s, sink) { 1.30472 + var i = 0, scopes = [ 1.30473 + { 1.30474 + space: 'default', 1.30475 + xmlns: '', 1.30476 + namespaces: { 1.30477 + 'xmlns': 'http://www.w3.org/2000/xmlns/', 1.30478 + 'xml': 'http://www.w3.org/XML/1998/namespace' 1.30479 + } 1.30480 + } 1.30481 + ]; 1.30482 + function trim(s) { 1.30483 + return s.replace(/^\s+/, '').replace(/\s+$/, ''); 1.30484 + } 1.30485 + function resolveEntities(s) { 1.30486 + return s.replace(/&([^;]+);/g, function (all, entity) { 1.30487 + if (entity.substring(0, 2) === '#x') { 1.30488 + return String.fromCharCode(parseInt(entity.substring(2), 16)); 1.30489 + } else if (entity.substring(0, 1) === '#') { 1.30490 + return String.fromCharCode(parseInt(entity.substring(1), 10)); 1.30491 + } 1.30492 + switch (entity) { 1.30493 + case 'lt': 1.30494 + return '<'; 1.30495 + case 'gt': 1.30496 + return '>'; 1.30497 + case 'amp': 1.30498 + return '&'; 1.30499 + } 1.30500 + throw 'Unknown entity: ' + entity; 1.30501 + }); 1.30502 + } 1.30503 + function isWhitespacePreserved() { 1.30504 + for (var j = scopes.length - 1; j >= 0; --j) { 1.30505 + if (scopes[j].space === 'preserve') { 1.30506 + return true; 1.30507 + } 1.30508 + } 1.30509 + return false; 1.30510 + } 1.30511 + function lookupDefaultNs() { 1.30512 + for (var j = scopes.length - 1; j >= 0; --j) { 1.30513 + if (scopes[j].hasOwnProperty('xmlns')) { 1.30514 + return scopes[j].xmlns; 1.30515 + } 1.30516 + } 1.30517 + } 1.30518 + function lookupNs(prefix) { 1.30519 + for (var j = scopes.length - 1; j >= 0; --j) { 1.30520 + if (scopes[j].namespaces.hasOwnProperty(prefix)) { 1.30521 + return scopes[j].namespaces[prefix]; 1.30522 + } 1.30523 + } 1.30524 + throw 'Unknown namespace: ' + prefix; 1.30525 + } 1.30526 + function getName(name, resolveDefaultNs) { 1.30527 + var j = name.indexOf(':'); 1.30528 + if (j >= 0) { 1.30529 + var namespace = lookupNs(name.substring(0, j)); 1.30530 + var prefix = name.substring(0, j); 1.30531 + var localName = name.substring(j + 1); 1.30532 + return { 1.30533 + name: namespace + '::' + localName, 1.30534 + localName: localName, 1.30535 + prefix: prefix, 1.30536 + namespace: namespace 1.30537 + }; 1.30538 + } else if (resolveDefaultNs) { 1.30539 + return { 1.30540 + name: name, 1.30541 + localName: name, 1.30542 + prefix: '', 1.30543 + namespace: lookupDefaultNs() 1.30544 + }; 1.30545 + } else { 1.30546 + return { 1.30547 + name: name, 1.30548 + localName: name, 1.30549 + prefix: '', 1.30550 + namespace: '' 1.30551 + }; 1.30552 + } 1.30553 + } 1.30554 + var whitespaceMap = { 1.30555 + '10': true, 1.30556 + '13': true, 1.30557 + '9': true, 1.30558 + '32': true 1.30559 + }; 1.30560 + function isWhitespace(s, index) { 1.30561 + return s.charCodeAt(index) in whitespaceMap; 1.30562 + } 1.30563 + function parseContent(s, start) { 1.30564 + var pos = start, name, attributes = []; 1.30565 + function skipWs() { 1.30566 + while (pos < s.length && isWhitespace(s, pos)) { 1.30567 + ++pos; 1.30568 + } 1.30569 + } 1.30570 + while (pos < s.length && !isWhitespace(s, pos) && s.charAt(pos) !== '>' && s.charAt(pos) !== '/') { 1.30571 + ++pos; 1.30572 + } 1.30573 + name = s.substring(start, pos); 1.30574 + skipWs(); 1.30575 + while (pos < s.length && s.charAt(pos) !== '>' && s.charAt(pos) !== '/' && s.charAt(pos) !== '?') { 1.30576 + skipWs(); 1.30577 + var attrName = '', attrValue = ''; 1.30578 + while (pos < s.length && !isWhitespace(s, pos) && s.charAt(pos) !== '=') { 1.30579 + attrName += s.charAt(pos); 1.30580 + ++pos; 1.30581 + } 1.30582 + skipWs(); 1.30583 + if (s.charAt(pos) !== '=') 1.30584 + throw '\'=\' expected'; 1.30585 + ++pos; 1.30586 + skipWs(); 1.30587 + var attrEndChar = s.charAt(pos); 1.30588 + if (attrEndChar !== '"' && attrEndChar !== '\'') 1.30589 + throw 'Quote expected'; 1.30590 + var attrEndIndex = s.indexOf(attrEndChar, ++pos); 1.30591 + if (attrEndIndex < 0) 1.30592 + throw new 'Unexpected EOF[6]'(); 1.30593 + attrValue = s.substring(pos, attrEndIndex); 1.30594 + attributes.push({ 1.30595 + name: attrName, 1.30596 + value: resolveEntities(attrValue) 1.30597 + }); 1.30598 + pos = attrEndIndex + 1; 1.30599 + skipWs(); 1.30600 + } 1.30601 + return { 1.30602 + name: name, 1.30603 + attributes: attributes, 1.30604 + parsed: pos - start 1.30605 + }; 1.30606 + } 1.30607 + while (i < s.length) { 1.30608 + var ch = s.charAt(i); 1.30609 + var j = i; 1.30610 + if (ch === '<') { 1.30611 + ++j; 1.30612 + var ch2 = s.charAt(j), q, name; 1.30613 + switch (ch2) { 1.30614 + case '/': 1.30615 + ++j; 1.30616 + q = s.indexOf('>', j); 1.30617 + if (q < 0) { 1.30618 + throw 'Unexpected EOF[1]'; 1.30619 + } 1.30620 + name = getName(s.substring(j, q), true); 1.30621 + sink.endElement(name); 1.30622 + scopes.pop(); 1.30623 + j = q + 1; 1.30624 + break; 1.30625 + case '?': 1.30626 + ++j; 1.30627 + var content = parseContent(s, j); 1.30628 + if (s.substring(j + content.parsed, j + content.parsed + 2) != '?>') { 1.30629 + throw 'Unexpected EOF[2]'; 1.30630 + } 1.30631 + sink.pi(content.name, content.attributes); 1.30632 + j += content.parsed + 2; 1.30633 + break; 1.30634 + case '!': 1.30635 + if (s.substring(j + 1, j + 3) === '--') { 1.30636 + q = s.indexOf('-->', j + 3); 1.30637 + if (q < 0) { 1.30638 + throw 'Unexpected EOF[3]'; 1.30639 + } 1.30640 + sink.comment(s.substring(j + 3, q)); 1.30641 + j = q + 3; 1.30642 + } else if (s.substring(j + 1, j + 8) === '[CDATA[') { 1.30643 + q = s.indexOf(']]>', j + 8); 1.30644 + if (q < 0) { 1.30645 + throw 'Unexpected EOF[4]'; 1.30646 + } 1.30647 + sink.cdata(s.substring(j + 8, q)); 1.30648 + j = q + 3; 1.30649 + } else if (s.substring(j + 1, j + 8) === 'DOCTYPE') { 1.30650 + var q2 = s.indexOf('[', j + 8), complexDoctype = false; 1.30651 + q = s.indexOf('>', j + 8); 1.30652 + if (q < 0) { 1.30653 + throw 'Unexpected EOF[5]'; 1.30654 + } 1.30655 + if (q2 > 0 && q > q2) { 1.30656 + q = s.indexOf(']>', j + 8); 1.30657 + if (q < 0) { 1.30658 + throw 'Unexpected EOF[7]'; 1.30659 + } 1.30660 + complexDoctype = true; 1.30661 + } 1.30662 + var doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0)); 1.30663 + sink.doctype(doctypeContent); 1.30664 + j = q + (complexDoctype ? 2 : 1); 1.30665 + } else { 1.30666 + throw 'Unknown !tag'; 1.30667 + } 1.30668 + break; 1.30669 + default: 1.30670 + var content = parseContent(s, j); 1.30671 + var isClosed = false; 1.30672 + if (s.substring(j + content.parsed, j + content.parsed + 2) === '/>') { 1.30673 + isClosed = true; 1.30674 + } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== '>') { 1.30675 + throw 'Unexpected EOF[2]'; 1.30676 + } 1.30677 + var scope = { 1.30678 + namespaces: [] 1.30679 + }; 1.30680 + var contentAttributes = content.attributes; 1.30681 + for (q = 0; q < contentAttributes.length; ++q) { 1.30682 + var attribute = contentAttributes[q]; 1.30683 + var attributeName = attribute.name; 1.30684 + if (attributeName.substring(0, 6) === 'xmlns:') { 1.30685 + var prefix = attributeName.substring(6); 1.30686 + var uri = attribute.value; 1.30687 + scope.namespaces[prefix] = trim(uri); 1.30688 + scope.namespaces.push({ 1.30689 + uri: uri, 1.30690 + prefix: prefix 1.30691 + }); 1.30692 + delete contentAttributes[q]; 1.30693 + } else if (attributeName === 'xmlns') { 1.30694 + var uri = attribute.value; 1.30695 + scope.namespaces['xmlns'] = trim(uri); 1.30696 + scope.namespaces.push({ 1.30697 + uri: uri, 1.30698 + prefix: '' 1.30699 + }); 1.30700 + delete contentAttributes[q]; 1.30701 + } else if (attributeName.substring(0, 4) === 'xml:') { 1.30702 + scope[attributeName.substring(4)] = trim(attribute.value); 1.30703 + } else if (attributeName.substring(0, 3) === 'xml') { 1.30704 + throw 'Invalid xml attribute'; 1.30705 + } else { 1.30706 + } 1.30707 + } 1.30708 + scopes.push(scope); 1.30709 + var attributes = []; 1.30710 + for (q = 0; q < contentAttributes.length; ++q) { 1.30711 + attribute = contentAttributes[q]; 1.30712 + if (attribute) { 1.30713 + attributes.push({ 1.30714 + name: getName(attribute.name, false), 1.30715 + value: attribute.value 1.30716 + }); 1.30717 + } 1.30718 + } 1.30719 + sink.beginElement(getName(content.name, true), attributes, scope, isClosed); 1.30720 + j += content.parsed + (isClosed ? 2 : 1); 1.30721 + if (isClosed) 1.30722 + scopes.pop(); 1.30723 + break; 1.30724 + } 1.30725 + } else { 1.30726 + do { 1.30727 + if (++j >= s.length) 1.30728 + break; 1.30729 + } while (s.charAt(j) !== '<'); 1.30730 + var text = s.substring(i, j); 1.30731 + var isWs = text.replace(/^\s+/, '').length === 0; 1.30732 + if (!isWs || isWhitespacePreserved()) { 1.30733 + sink.text(resolveEntities(text), isWs); 1.30734 + } 1.30735 + } 1.30736 + i = j; 1.30737 + } 1.30738 + } 1.30739 + this.parseFromString = function (s, mimeType) { 1.30740 + var currentElement = new XML('element', '', '', ''); 1.30741 + var elementsStack = []; 1.30742 + parseXml(s, { 1.30743 + beginElement: function (name, attrs, scope, isEmpty) { 1.30744 + var parent = currentElement; 1.30745 + elementsStack.push(parent); 1.30746 + currentElement = createNode('element', name.namespace, name.localName, name.prefix); 1.30747 + for (var i = 0; i < attrs.length; ++i) { 1.30748 + var rawAttr = attrs[i]; 1.30749 + var attr = createNode('attribute', rawAttr.name.namespace, rawAttr.name.localName, rawAttr.name.prefix); 1.30750 + attr.value = rawAttr.value; 1.30751 + currentElement.attributes.push(attr); 1.30752 + } 1.30753 + var namespaces = scope.namespaces; 1.30754 + for (var i = 0; i < namespaces.length; ++i) { 1.30755 + var rawNs = namespaces[i]; 1.30756 + var ns = ASNamespace.createNamespace(rawNs.uri, rawNs.prefix); 1.30757 + currentElement.inScopeNamespaces.push(ns); 1.30758 + } 1.30759 + parent.insert(parent.length(), currentElement); 1.30760 + if (isEmpty) { 1.30761 + currentElement = elementsStack.pop(); 1.30762 + } 1.30763 + }, 1.30764 + endElement: function (name) { 1.30765 + currentElement = elementsStack.pop(); 1.30766 + }, 1.30767 + text: function (text, isWhitespace) { 1.30768 + var node = createNode('text', '', ''); 1.30769 + node.value = text; 1.30770 + currentElement.insert(currentElement.length(), node); 1.30771 + }, 1.30772 + cdata: function (text) { 1.30773 + var node = createNode('text', '', ''); 1.30774 + node.value = text; 1.30775 + currentElement.insert(currentElement.length(), node); 1.30776 + }, 1.30777 + comment: function (text) { 1.30778 + }, 1.30779 + pi: function (name, attrs) { 1.30780 + }, 1.30781 + doctype: function (text) { 1.30782 + } 1.30783 + }); 1.30784 + return currentElement; 1.30785 + }; 1.30786 + function createNode(kind, uri, name, prefix) { 1.30787 + return new XML(kind, uri, name, prefix); 1.30788 + } 1.30789 + }; 1.30790 + var xmlParser = new XMLParser(); 1.30791 + isXMLType = function isXMLType(val) { 1.30792 + return val.isXML || val.isXMLList; 1.30793 + }; 1.30794 + function toString(node) { 1.30795 + if (typeof node === 'object' && node !== null) { 1.30796 + switch (node.kind) { 1.30797 + case 'text': 1.30798 + case 'attribute': 1.30799 + return node.value; 1.30800 + default: 1.30801 + if (node.hasSimpleContent()) { 1.30802 + var str = ''; 1.30803 + node.children.forEach(function (v, i) { 1.30804 + str += toString(v); 1.30805 + }); 1.30806 + return str; 1.30807 + } 1.30808 + return toXMLString(node); 1.30809 + } 1.30810 + } else { 1.30811 + return String(node); 1.30812 + } 1.30813 + } 1.30814 + function toXMLString(node, ancestorNamespaces, indentLevel) { 1.30815 + return new XMLEncoder(ancestorNamespaces, indentLevel, true).encode(node); 1.30816 + } 1.30817 + function toXML(v) { 1.30818 + if (v === null) { 1.30819 + throw new TypeError(formatErrorMessage(Errors.ConvertNullToObjectError)); 1.30820 + } else if (v === undefined) { 1.30821 + throw new TypeError(formatErrorMessage(Errors.ConvertUndefinedToObjectError)); 1.30822 + } else if (v.isXML) { 1.30823 + return v; 1.30824 + } else if (v.isXMLList) { 1.30825 + if (v.length() === 1) { 1.30826 + return v.children[0]; 1.30827 + } 1.30828 + throw new TypeError(formatErrorMessage(Errors.XMLMarkupMustBeWellFormed)); 1.30829 + } else { 1.30830 + var x = xmlParser.parseFromString(String(v)); 1.30831 + if (x.length() === 0) { 1.30832 + var x = new XML('text'); 1.30833 + return x; 1.30834 + } else if (x.length() === 1) { 1.30835 + x.children[0].parent = null; 1.30836 + return x.children[0]; 1.30837 + } 1.30838 + throw 'SyntaxError in ToXML'; 1.30839 + } 1.30840 + } 1.30841 + var defaultNamespace = ''; 1.30842 + function toXMLList(value) { 1.30843 + if (value === null) { 1.30844 + throw new TypeError(formatErrorMessage(Errors.ConvertNullToObjectError)); 1.30845 + } else if (value === undefined) { 1.30846 + throw new TypeError(formatErrorMessage(Errors.ConvertUndefinedToObjectError)); 1.30847 + } else if (value instanceof XML) { 1.30848 + var xl = new XMLList(value.parent, value.name); 1.30849 + xl.append(value); 1.30850 + return xl; 1.30851 + } else if (value instanceof XMLList) { 1.30852 + return value; 1.30853 + } else { 1.30854 + var s = '<parent xmlns=\'' + defaultNamespace + '\'>' + String(value) + '</parent>'; 1.30855 + var x = new ASXML(s); 1.30856 + var xl = new XMLList(); 1.30857 + for (var i = 0; i < x.length(); i++) { 1.30858 + var v = x.children[i]; 1.30859 + v.parent = null; 1.30860 + xl.append(v); 1.30861 + } 1.30862 + return xl; 1.30863 + } 1.30864 + } 1.30865 + function toAttributeName(v) { 1.30866 + if (v === undefined || v === null || typeof v === 'boolean' || typeof v === 'number') { 1.30867 + throw 'TypeError: invalid operand to ToAttributeName()'; 1.30868 + } else if (isXMLType(v)) { 1.30869 + v = toString(v); 1.30870 + } else if (v instanceof Object && v !== null) { 1.30871 + if (v instanceof QName) { 1.30872 + return new QName(v.uri, v.localName, true); 1.30873 + } 1.30874 + v = toString(v); 1.30875 + } 1.30876 + if (typeof v === 'string') { 1.30877 + var ns = new ASNamespace(); 1.30878 + var qn = new QName(ns, v, true); 1.30879 + } else { 1.30880 + } 1.30881 + return qn; 1.30882 + } 1.30883 + function toXMLName(mn) { 1.30884 + return new QName(mn); 1.30885 + } 1.30886 + function getDefaultNamespace(scope) { 1.30887 + while (scope) { 1.30888 + var obj = scope.object; 1.30889 + if (obj.defaultNamepsace !== undefined) { 1.30890 + return obj.defaultNamespace; 1.30891 + } 1.30892 + scope = scope.parent; 1.30893 + } 1.30894 + var ns = ASNamespace.createNamespace('', ''); 1.30895 + return ns; 1.30896 + } 1.30897 + isXMLName = function isXMLName(v) { 1.30898 + try { 1.30899 + var qn = new QName(v); 1.30900 + } catch (e) { 1.30901 + return false; 1.30902 + } 1.30903 + return true; 1.30904 + }; 1.30905 + function asGetProperty(namespaces, name, flags, isMethod) { 1.30906 + var mn = isNumeric(name) ? toNumber(name) : name instanceof QName ? name.mn : new Multiname(namespaces ? namespaces : [ 1.30907 + ASNamespace.PUBLIC 1.30908 + ], name, flags); 1.30909 + return this.getProperty(mn, isMethod); 1.30910 + } 1.30911 + function asSetProperty(namespaces, name, flags, value) { 1.30912 + var mn = isNumeric(name) ? toNumber(name) : name instanceof QName ? name.mn : new Multiname(namespaces ? namespaces : [ 1.30913 + ASNamespace.PUBLIC 1.30914 + ], name, flags); 1.30915 + this.setProperty(mn, value); 1.30916 + } 1.30917 + function asHasProperty(namespaces, name, flags) { 1.30918 + var mn = isNumeric(name) ? toNumber(name) : name instanceof QName ? name.mn : new Multiname(namespaces ? namespaces : [ 1.30919 + ASNamespace.PUBLIC 1.30920 + ], name, flags); 1.30921 + return this.hasProperty(mn); 1.30922 + } 1.30923 + function asCallProperty(namespaces, name, flags, isLex, args) { 1.30924 + var receiver = isLex ? null : this; 1.30925 + var property = this.asGetProperty(namespaces, name, flags, true); 1.30926 + if (!property) { 1.30927 + return this.toString().asCallProperty(namespaces ? namespaces : [ 1.30928 + ASNamespace.PUBLIC 1.30929 + ], name, flags, isLex, args); 1.30930 + } 1.30931 + return property.apply(receiver, args); 1.30932 + } 1.30933 + var ATTR_NAME = 1; 1.30934 + var ELEM_NAME = 2; 1.30935 + var ANY_NAME = 4; 1.30936 + var ANY_NAMESPACE = 8; 1.30937 + function nameKind(mn) { 1.30938 + var flags = 0; 1.30939 + if (mn.isAttribute()) { 1.30940 + flags |= ATTR_NAME; 1.30941 + } else { 1.30942 + flags |= ELEM_NAME; 1.30943 + } 1.30944 + if (mn.isAnyName()) { 1.30945 + flags |= ANY_NAME; 1.30946 + } 1.30947 + if (mn.isAnyNamespace()) { 1.30948 + flags |= ANY_NAMESPACE; 1.30949 + } 1.30950 + return flags; 1.30951 + } 1.30952 + XMLClass = function XMLClass(runtime, scope, instanceConstructor, baseClass) { 1.30953 + var FLAG_IGNORE_COMMENTS = 1; 1.30954 + var FLAG_IGNORE_PROCESSING_INSTRUCTIONS = 2; 1.30955 + var FLAG_IGNORE_WHITESPACE = 4; 1.30956 + var FLAG_PRETTY_PRINTING = 8; 1.30957 + ASXML = function (value) { 1.30958 + if (!(this instanceof ASXML)) { 1.30959 + if (value instanceof ASXML) { 1.30960 + return value; 1.30961 + } 1.30962 + return new ASXML(value); 1.30963 + } 1.30964 + if (value === null || value === undefined) { 1.30965 + value = ''; 1.30966 + } 1.30967 + var x = toXML(value); 1.30968 + if (isXMLType(value)) { 1.30969 + x = x.deepCopy(); 1.30970 + } 1.30971 + return x; 1.30972 + }; 1.30973 + XML = function (kind, uri, name, prefix) { 1.30974 + if (kind === undefined) { 1.30975 + kind = 'text'; 1.30976 + } 1.30977 + if (uri === undefined) { 1.30978 + uri = ''; 1.30979 + } 1.30980 + if (name === undefined) { 1.30981 + name = ''; 1.30982 + } 1.30983 + this.init(kind, uri, name, prefix); 1.30984 + }; 1.30985 + var c = new Class('XML', ASXML, ApplicationDomain.passthroughCallable(ASXML)); 1.30986 + c.flags = FLAG_IGNORE_COMMENTS | FLAG_IGNORE_PROCESSING_INSTRUCTIONS | FLAG_IGNORE_WHITESPACE | FLAG_PRETTY_PRINTING; 1.30987 + c.prettyIndent = 2; 1.30988 + c.extend(baseClass); 1.30989 + var Xp = XML.prototype = ASXML.prototype; 1.30990 + Xp.init = function init(kind, uri, name, prefix) { 1.30991 + this.name = new QName(new Multiname([ 1.30992 + new ASNamespace(prefix, uri) 1.30993 + ], name)); 1.30994 + this.kind = kind; 1.30995 + this.parent = null; 1.30996 + this.inScopeNamespaces = []; 1.30997 + switch (kind) { 1.30998 + case 'element': 1.30999 + this.attributes = []; 1.31000 + this.children = []; 1.31001 + break; 1.31002 + case 'attribute': 1.31003 + case 'text': 1.31004 + this.value = ''; 1.31005 + break; 1.31006 + default: 1.31007 + break; 1.31008 + } 1.31009 + return this; 1.31010 + }; 1.31011 + Xp.length = function () { 1.31012 + if (!this.children) { 1.31013 + return 0; 1.31014 + } 1.31015 + return this.children.length; 1.31016 + }; 1.31017 + Xp.canHandleProperties = true; 1.31018 + Xp.deepCopy = function () { 1.31019 + return new ASXML(toXMLString(this)); 1.31020 + }; 1.31021 + Xp.resolveValue = function resolveValue() { 1.31022 + return this; 1.31023 + }; 1.31024 + Xp.hasSimpleContent = function hasSimpleContent() { 1.31025 + if (this.kind === 'comment' || this.kind === 'processing-instruction') { 1.31026 + return false; 1.31027 + } 1.31028 + var result = true; 1.31029 + if (this.children) { 1.31030 + this.children.forEach(function (v) { 1.31031 + if (v.kind === 'element') { 1.31032 + result = false; 1.31033 + } 1.31034 + }); 1.31035 + } 1.31036 + return result; 1.31037 + }; 1.31038 + Xp.asGetEnumerableKeys = function asGetEnumerableKeys() { 1.31039 + if (Xp === this) { 1.31040 + return Object.prototype.asGetEnumerableKeys.call(this); 1.31041 + } 1.31042 + var keys = []; 1.31043 + this.children.forEach(function (v, i) { 1.31044 + keys.push(v.name); 1.31045 + }); 1.31046 + return keys; 1.31047 + }; 1.31048 + function setAttribute(node, name, value) { 1.31049 + if (node.nodeType === Node.DOCUMENT_NODE) { 1.31050 + node.childNodes[0].setAttribute(name, value); 1.31051 + } else if (node.nodeType === Node.ELEMENT_NODE) { 1.31052 + node.setAttribute(name, value); 1.31053 + } else { 1.31054 + throw 'error or unhandled case in setAttribute'; 1.31055 + } 1.31056 + } 1.31057 + Xp.setProperty = function (p, v) { 1.31058 + var x, i, c, n; 1.31059 + x = this; 1.31060 + if (p === p >>> 0) { 1.31061 + throw 'TypeError in XML.prototype.setProperty(): invalid property name ' + p; 1.31062 + } 1.31063 + if (x.kind === 'text' || x.kind === 'comment' || x.kind === 'processing-instruction' || x.kind === 'attribute') { 1.31064 + return; 1.31065 + } 1.31066 + if (!v || !v.isXML && !v.isXMLList || v.kind === 'text' || v.kind === 'attribute') { 1.31067 + c = toString(v); 1.31068 + } else { 1.31069 + c = v.deepCopy(); 1.31070 + } 1.31071 + n = toXMLName(p); 1.31072 + if (n.isAttr) { 1.31073 + if (!this.attributes) { 1.31074 + return; 1.31075 + } 1.31076 + this.attributes.forEach(function (v, i, o) { 1.31077 + if (v.name === n.localName) { 1.31078 + delete o[i]; 1.31079 + } 1.31080 + }); 1.31081 + var a = new XML('attribute', n.uri, n.localName); 1.31082 + a.value = v; 1.31083 + a.parent = this; 1.31084 + this.attributes.push(a); 1.31085 + return; 1.31086 + } 1.31087 + var isValidName = isXMLName(n); 1.31088 + if (!isValidName && n.localName !== '*') { 1.31089 + return; 1.31090 + } 1.31091 + var i = undefined; 1.31092 + var primitiveAssign = !isXMLType(c) && n.localName !== '*'; 1.31093 + for (var k = x.length() - 1; k >= 0; k--) { 1.31094 + if ((n.isAny || x.children[k].kind === 'element' && x.children[k].name.localName === n.localName) && (n.uri === null || x.children[k].kind === 'element' && x.children[k].name.uri === n.uri)) { 1.31095 + if (i !== undefined) { 1.31096 + x.deleteByIndex(String(i)); 1.31097 + } 1.31098 + i = k; 1.31099 + } 1.31100 + } 1.31101 + if (i === undefined) { 1.31102 + i = x.length(); 1.31103 + if (primitiveAssign) { 1.31104 + if (n.uri === null) { 1.31105 + var name = new QName(getDefaultNamespace(scope), n); 1.31106 + } else { 1.31107 + var name = new QName(n); 1.31108 + } 1.31109 + var y = new XML('element', name.uri, name.localName, name.prefix); 1.31110 + y.parent = x; 1.31111 + var ns = name.getNamespace(); 1.31112 + x.replace(String(i), y); 1.31113 + y.addInScopeNamespace(ns); 1.31114 + } 1.31115 + } 1.31116 + if (primitiveAssign) { 1.31117 + x.children[i].children = []; 1.31118 + var s = toString(c); 1.31119 + if (s !== '') { 1.31120 + x.children[i].replace('0', s); 1.31121 + } 1.31122 + } else { 1.31123 + x.replace(String(i), c); 1.31124 + } 1.31125 + return; 1.31126 + }; 1.31127 + Xp.asGetProperty = asGetProperty; 1.31128 + Xp.asGetResolvedStringProperty = asGetResolvedStringPropertyFallback; 1.31129 + Xp.asSetProperty = asSetProperty; 1.31130 + Xp.asHasProperty = asHasProperty; 1.31131 + Xp.asCallProperty = asCallProperty; 1.31132 + Xp.getProperty = function (mn, isMethod) { 1.31133 + if (isMethod) { 1.31134 + var resolved = Multiname.isQName(mn) ? mn : this.resolveMultinameProperty(mn.namespaces, mn.name, mn.flags); 1.31135 + return this[Multiname.getQualifiedName(resolved)]; 1.31136 + } 1.31137 + if (!Multiname.isQName(mn) && isNumeric(mn)) { 1.31138 + if (Number(0) === 0) { 1.31139 + return this; 1.31140 + } 1.31141 + return null; 1.31142 + } 1.31143 + var x = this; 1.31144 + var name = toXMLName(mn); 1.31145 + var xl = new XMLList(x, name); 1.31146 + var flags = nameKind(name.mn); 1.31147 + var anyName = flags & ANY_NAME; 1.31148 + var anyNamespace = flags & ANY_NAMESPACE; 1.31149 + if (flags & ATTR_NAME) { 1.31150 + if (x.attributes) { 1.31151 + x.attributes.forEach(function (v, i) { 1.31152 + if ((anyName || v.name.localName === name.localName) && (anyNamespace || v.name.uri === name.uri)) { 1.31153 + xl.append(v); 1.31154 + } 1.31155 + }); 1.31156 + } 1.31157 + } else { 1.31158 + x.children.forEach(function (v, i) { 1.31159 + if ((anyName || v.kind === 'element' && v.name.localName === name.localName) && (anyNamespace || v.kind === 'element' && v.name.uri === name.uri)) { 1.31160 + xl.append(v); 1.31161 + } 1.31162 + }); 1.31163 + } 1.31164 + return xl; 1.31165 + }; 1.31166 + Xp.hasProperty = function (mn, isMethod) { 1.31167 + if (isMethod) { 1.31168 + var resolved = Multiname.isQName(mn) ? mn : this.resolveMultinameProperty(mn.namespaces, mn.name, mn.flags); 1.31169 + return !(!this[Multiname.getQualifiedName(resolved)]); 1.31170 + } 1.31171 + if (!Multiname.isQName(mn) && isNumeric(mn)) { 1.31172 + if (Number(0) === 0) { 1.31173 + return true; 1.31174 + } 1.31175 + return false; 1.31176 + } 1.31177 + var name = toXMLName(mn); 1.31178 + var flags = nameKind(name.mn); 1.31179 + var anyName = flags & ANY_NAME; 1.31180 + var anyNamespace = flags & ANY_NAMESPACE; 1.31181 + if (flags & ATTR_NAME) { 1.31182 + return this.attributes.some(function (v, i) { 1.31183 + if ((anyName || v.name.localName === name.localName) && (anyNamespace || v.name.uri === name.uri)) { 1.31184 + return true; 1.31185 + } 1.31186 + }); 1.31187 + if (x.attributes) { 1.31188 + x.attributes.forEach(function (v, i) { 1.31189 + if ((anyName || v.name.localName === name.localName) && (anyNamespace || v.name.uri === name.uri)) { 1.31190 + xl.append(v); 1.31191 + } 1.31192 + }); 1.31193 + } 1.31194 + } else { 1.31195 + if (this.children.some(function (v, i) { 1.31196 + if ((anyName || v.kind === 'element' && v.name.localName === name.localName) && (anyNamespace || v.kind === 'element' && v.name.uri === name.uri)) { 1.31197 + return true; 1.31198 + } 1.31199 + })) { 1.31200 + return true; 1.31201 + } 1.31202 + var resolved = Multiname.isQName(mn) ? mn : this.resolveMultinameProperty(mn.namespaces, mn.name, mn.flags); 1.31203 + return !(!this[Multiname.getQualifiedName(resolved)]); 1.31204 + } 1.31205 + }; 1.31206 + Xp.delete = function (key, isMethod) { 1.31207 + notImplemented('XML.[[Delete]]'); 1.31208 + }; 1.31209 + Xp.deleteByIndex = function (p) { 1.31210 + var x = this; 1.31211 + var i = p >>> 0; 1.31212 + if (String(i) !== String(p)) { 1.31213 + throw 'TypeError in XML.prototype.deleteByIndex(): invalid index ' + p; 1.31214 + } 1.31215 + if (p < x.length()) { 1.31216 + if (x.children[p]) { 1.31217 + x.children[p].parent = null; 1.31218 + delete x.children[p]; 1.31219 + for (q = i + 1; q < x.length(); q++) { 1.31220 + x.children[q - 1] = x.children[q]; 1.31221 + } 1.31222 + x.children.length = x.children.length - 1; 1.31223 + } 1.31224 + } 1.31225 + }; 1.31226 + Xp.isXML = true; 1.31227 + Xp.insert = function insert(p, v) { 1.31228 + var x, s, i, n; 1.31229 + x = this; 1.31230 + if (x.kind === 'text' || x.kind === 'comment' || x.kind === 'processing-instruction' || x.kind === 'attribute') { 1.31231 + return; 1.31232 + } 1.31233 + i = p >>> 0; 1.31234 + if (String(p) !== String(i)) { 1.31235 + throw 'TypeError in XML.prototype.insert(): invalid property name ' + p; 1.31236 + } 1.31237 + if (x.kind === 'element') { 1.31238 + var a = x; 1.31239 + while (a) { 1.31240 + if (a === v) { 1.31241 + throw 'Error in XML.prototype.insert()'; 1.31242 + } 1.31243 + a = a.parent; 1.31244 + } 1.31245 + } 1.31246 + if (x.isXMLList) { 1.31247 + n = x.length(); 1.31248 + if (n === 0) { 1.31249 + return; 1.31250 + } 1.31251 + } else { 1.31252 + n = 1; 1.31253 + } 1.31254 + for (var j = x.length() - 1; j >= i; j--) { 1.31255 + x[j + n] = x[j]; 1.31256 + } 1.31257 + if (x.isXMLList) { 1.31258 + n = v.length(); 1.31259 + for (var j = 0; j < n; j++) { 1.31260 + v.children[j].parent = x; 1.31261 + x[i + j] = v[j]; 1.31262 + } 1.31263 + } else { 1.31264 + v.parent = x; 1.31265 + x.children[i] = v; 1.31266 + } 1.31267 + }; 1.31268 + Xp.replace = function (p, v) { 1.31269 + var x, s; 1.31270 + x = this; 1.31271 + if (x.kind === 'text' || x.kind === 'comment' || x.kind === 'processing-instruction' || x.kind === 'attribute') { 1.31272 + return; 1.31273 + } 1.31274 + var i = p >>> 0; 1.31275 + if (String(p) !== String(i)) { 1.31276 + throw 'TypeError in XML.prototype.replace(): invalid name ' + p; 1.31277 + } 1.31278 + if (i >= x.length()) { 1.31279 + p = String(x.length()); 1.31280 + } 1.31281 + if (v.kind === 'element') { 1.31282 + var a = x; 1.31283 + while (a) { 1.31284 + if (a === v) { 1.31285 + throw 'Error in XML.prototype.replace()'; 1.31286 + } 1.31287 + a = a.parent; 1.31288 + } 1.31289 + } 1.31290 + if (v.kind === 'element' || v.kind === 'text' || v.kind === 'comment' || v.kind === 'processing-instruction') { 1.31291 + v.parent = x; 1.31292 + if (x[p]) { 1.31293 + x.children[p].parent = null; 1.31294 + } 1.31295 + x.children[p] = v; 1.31296 + } else if (x.isXMLList) { 1.31297 + x.deleteByIndex(p); 1.31298 + x.insert(p, v); 1.31299 + } else { 1.31300 + s = toString(v); 1.31301 + t = new XML(); 1.31302 + t.parent = x; 1.31303 + t.value = s; 1.31304 + if (x[p]) { 1.31305 + x.children[p].parent = null; 1.31306 + } 1.31307 + x.children[p] = t; 1.31308 + } 1.31309 + }; 1.31310 + Xp.addInScopeNamespace = function (ns) { 1.31311 + var x, s; 1.31312 + x = this; 1.31313 + if (x.kind === 'text' || x.kind === 'comment' || x.kind === 'processing-instruction' || x.kind === 'attribute') { 1.31314 + return; 1.31315 + } 1.31316 + if (ns.prefix !== undefined) { 1.31317 + if (ns.prefix === '' && x.name.uri === '') { 1.31318 + return; 1.31319 + } 1.31320 + var match = null; 1.31321 + x.inScopeNamespaces.forEach(function (v, i) { 1.31322 + if (v.prefix === ns.prefix) { 1.31323 + match = v; 1.31324 + } 1.31325 + }); 1.31326 + if (match !== null && match.uri !== ns.uri) { 1.31327 + x.inScopeNamespaces.forEach(function (v, i) { 1.31328 + if (v.prefix === match.prefix) { 1.31329 + x.inScopeNamespaces[i] = ns; 1.31330 + } 1.31331 + }); 1.31332 + } 1.31333 + if (x.name.prefix === ns.prefix) { 1.31334 + x.name.prefix = undefined; 1.31335 + } 1.31336 + x.attributes.forEach(function (v, i) { 1.31337 + if (v.name.prefix === ns.name.prefix) { 1.31338 + v.name.prefix = undefined; 1.31339 + } 1.31340 + }); 1.31341 + } 1.31342 + }; 1.31343 + Xp.descendants = function (name) { 1.31344 + name = toXMLName(name); 1.31345 + var x = this; 1.31346 + var xl = new XMLList(); 1.31347 + if (x.kind !== 'element') { 1.31348 + return xl; 1.31349 + } 1.31350 + if (name.isAttr) { 1.31351 + this.attributes.forEach(function (v, i) { 1.31352 + if (name.isAny || name.localName === v.name.localName) { 1.31353 + xl.append(v); 1.31354 + } 1.31355 + }); 1.31356 + } else { 1.31357 + this.children.forEach(function (v, i) { 1.31358 + if (name.isAny || name.localName === v.name.localName) { 1.31359 + xl.append(v); 1.31360 + } 1.31361 + }); 1.31362 + } 1.31363 + this.children.forEach(function (v, i) { 1.31364 + xl.append(v.descendants(name)); 1.31365 + }); 1.31366 + return xl; 1.31367 + }; 1.31368 + Xp.comments = function () { 1.31369 + var x = this; 1.31370 + var xl = new XMLList(x, null); 1.31371 + x.children.forEach(function (v, i) { 1.31372 + if (v.kind === 'comment') { 1.31373 + xl.append(v); 1.31374 + } 1.31375 + }); 1.31376 + return xl; 1.31377 + }; 1.31378 + Xp.text = function () { 1.31379 + var x = this; 1.31380 + var xl = new XMLList(x, null); 1.31381 + x.children.forEach(function (v, i) { 1.31382 + if (v.kind === 'text') { 1.31383 + xl.append(v); 1.31384 + } 1.31385 + }); 1.31386 + return xl; 1.31387 + }; 1.31388 + c.native = { 1.31389 + static: { 1.31390 + ignoreComments: { 1.31391 + get: function ignoreComments() { 1.31392 + return getBitFlags(c.flags, FLAG_IGNORE_COMMENTS); 1.31393 + }, 1.31394 + set: function ignoreComments(newIgnore) { 1.31395 + c.flags = setBitFlags(c.flags, FLAG_IGNORE_COMMENTS, newIgnore); 1.31396 + } 1.31397 + }, 1.31398 + ignoreProcessingInstructions: { 1.31399 + get: function ignoreProcessingInstructions() { 1.31400 + return getBitFlags(c.flags, FLAG_IGNORE_PROCESSING_INSTRUCTIONS); 1.31401 + }, 1.31402 + set: function ignoreProcessingInstructions(newIgnore) { 1.31403 + c.flags = setBitFlags(c.flags, FLAG_IGNORE_PROCESSING_INSTRUCTIONS, newIgnore); 1.31404 + } 1.31405 + }, 1.31406 + ignoreWhitespace: { 1.31407 + get: function ignoreWhitespace() { 1.31408 + return getBitFlags(c.flags, FLAG_IGNORE_WHITESPACE); 1.31409 + }, 1.31410 + set: function ignoreWhitespace(newIgnore) { 1.31411 + c.flags = setBitFlags(c.flags, FLAG_IGNORE_WHITESPACE, newIgnore); 1.31412 + } 1.31413 + }, 1.31414 + prettyPrinting: { 1.31415 + get: function prettyPrinting() { 1.31416 + return getBitFlags(c.flags, FLAG_PRETTY_PRINTING); 1.31417 + }, 1.31418 + set: function prettyPrinting(newPretty) { 1.31419 + c.flags = setBitFlags(c.flags, FLAG_PRETTY_PRINTING, newPretty); 1.31420 + } 1.31421 + }, 1.31422 + prettyIndent: { 1.31423 + get: function prettyIndent() { 1.31424 + return c.prettyIndent; 1.31425 + }, 1.31426 + set: function prettyIndent(newIndent) { 1.31427 + c.prettyIndent = newIndent; 1.31428 + } 1.31429 + } 1.31430 + }, 1.31431 + instance: { 1.31432 + toString: function () { 1.31433 + return toString(this); 1.31434 + }, 1.31435 + hasOwnProperty: function hasOwnProperty(P) { 1.31436 + somewhatImplemented('XML.hasOwnProperty'); 1.31437 + return this.hasProperty(P); 1.31438 + }, 1.31439 + propertyIsEnumerable: function propertyIsEnumerable(P) { 1.31440 + notImplemented('XML.propertyIsEnumerable'); 1.31441 + }, 1.31442 + addNamespace: function addNamespace(ns) { 1.31443 + notImplemented('XML.addNamespace'); 1.31444 + }, 1.31445 + appendChild: function appendChild(child) { 1.31446 + var children = this.getProperty('*'); 1.31447 + children.setProperty(children.length(), child); 1.31448 + return this; 1.31449 + }, 1.31450 + attribute: function attribute(name) { 1.31451 + return this.getProperty(toAttributeName(name)); 1.31452 + }, 1.31453 + attributes: function attributes() { 1.31454 + return this.getProperty(toAttributeName('*')); 1.31455 + }, 1.31456 + child: function child(name) { 1.31457 + return this.getProperty(name); 1.31458 + }, 1.31459 + childIndex: function childIndex() { 1.31460 + notImplemented('XML.childIndex'); 1.31461 + }, 1.31462 + children: function children() { 1.31463 + var list = new XMLList(); 1.31464 + Array.prototype.push.apply(list.children, this.children); 1.31465 + return list; 1.31466 + }, 1.31467 + comments: function comments() { 1.31468 + return this.comments(); 1.31469 + }, 1.31470 + contains: function contains(value) { 1.31471 + notImplemented('XML.contains'); 1.31472 + }, 1.31473 + copy: function copy() { 1.31474 + return this.deepCopy(); 1.31475 + }, 1.31476 + descendants: function descendants(name) { 1.31477 + if (name === undefined) { 1.31478 + name = '*'; 1.31479 + } 1.31480 + return this.descendants(name); 1.31481 + }, 1.31482 + elements: function elements(name) { 1.31483 + var x = this; 1.31484 + var any = false; 1.31485 + if (name === undefined) { 1.31486 + name = '*'; 1.31487 + any = true; 1.31488 + } 1.31489 + var name = toXMLName(name); 1.31490 + var xl = new XMLList(this.parent, name); 1.31491 + x.children.forEach(function (v, i) { 1.31492 + if (v.kind === 'element' && (any || v.name.localName === name.localName) && (name.uri === null || v.kind === 'element' && v.name.uri === name.uri)) { 1.31493 + xl.append(v); 1.31494 + } 1.31495 + }); 1.31496 + return xl; 1.31497 + }, 1.31498 + hasComplexContent: function hasComplexContent() { 1.31499 + notImplemented('XML.hasComplexContent'); 1.31500 + }, 1.31501 + hasSimpleContent: function hasSimpleContent() { 1.31502 + return this.hasSimpleContent(); 1.31503 + }, 1.31504 + inScopeNamespaces: function inScopeNamespaces() { 1.31505 + notImplemented('XML.inScopeNamespaces'); 1.31506 + }, 1.31507 + insertChildAfter: function insertChildAfter(child1, child2) { 1.31508 + notImplemented('XML.insertChildAfter'); 1.31509 + }, 1.31510 + insertChildBefore: function insertChildBefore(child1, child2) { 1.31511 + notImplemented('XML.insertChildBefore'); 1.31512 + }, 1.31513 + localName: function localName() { 1.31514 + return this.name.localName; 1.31515 + }, 1.31516 + name: function name() { 1.31517 + return this.name; 1.31518 + }, 1.31519 + _namespace: function _namespace(prefix, argc) { 1.31520 + somewhatImplemented('XML._namespace()'); 1.31521 + return this.name.uri; 1.31522 + }, 1.31523 + namespaceDeclarations: function namespaceDeclarations() { 1.31524 + return new XMLList(); 1.31525 + }, 1.31526 + nodeKind: function nodeKind() { 1.31527 + return this.kind; 1.31528 + }, 1.31529 + normalize: function normalize() { 1.31530 + notImplemented('XML.normalize'); 1.31531 + }, 1.31532 + parent: function parent() { 1.31533 + notImplemented('XML.parent'); 1.31534 + }, 1.31535 + processingInstructions: function processingInstructions(name) { 1.31536 + notImplemented('XML.processingInstructions'); 1.31537 + }, 1.31538 + prependChild: function prependChild(value) { 1.31539 + notImplemented('XML.prependChild'); 1.31540 + }, 1.31541 + removeNamespace: function removeNamespace(ns) { 1.31542 + notImplemented('XML.removeNamespace'); 1.31543 + }, 1.31544 + replace: function replace(propertyName, value) { 1.31545 + var c, x, s, i; 1.31546 + x = this; 1.31547 + if (x.kind === 'text' || x.kind === 'comment' || x.kind === 'processing-instruction' || x.kind === 'attribute') { 1.31548 + return x; 1.31549 + } 1.31550 + if (!isXMLType(value)) { 1.31551 + c = value.toString(); 1.31552 + } else { 1.31553 + c = value.deepCopy(); 1.31554 + } 1.31555 + var i = propertyName >>> 0; 1.31556 + if (String(propertyName) === String(i)) { 1.31557 + x.replace(propertyName, c); 1.31558 + return x; 1.31559 + } 1.31560 + n = new QName(propertyName); 1.31561 + i = undefined; 1.31562 + for (k = x.length() - 1; k >= 0; k--) { 1.31563 + var v = x.children[k]; 1.31564 + if (n.isAny || v.kind === 'element' && v.name.localName === n.localName && (n.uri === null || v.kind === 'element' && v.name.uri === n.uri)) { 1.31565 + if (i !== undefined) { 1.31566 + x.deleteByIndex(String(i)); 1.31567 + } 1.31568 + i = k; 1.31569 + } 1.31570 + } 1.31571 + if (i !== undefined) { 1.31572 + x.replace(i.toString(), c); 1.31573 + } 1.31574 + return x; 1.31575 + }, 1.31576 + setChildren: function setChildren(value) { 1.31577 + notImplemented('XML.setChildren'); 1.31578 + }, 1.31579 + setLocalName: function setLocalName(name) { 1.31580 + notImplemented('XML.setLocalName'); 1.31581 + }, 1.31582 + setName: function setName(name) { 1.31583 + notImplemented('XML.setName'); 1.31584 + }, 1.31585 + setNamespace: function setNamespace(ns) { 1.31586 + notImplemented('XML.setNamespace'); 1.31587 + }, 1.31588 + text: function text() { 1.31589 + return this.text(); 1.31590 + }, 1.31591 + toXMLString: function () { 1.31592 + return toXMLString(this); 1.31593 + }, 1.31594 + notification: function notification() { 1.31595 + notImplemented('XML.notification'); 1.31596 + }, 1.31597 + setNotification: function setNotification(f) { 1.31598 + notImplemented('XML.setNotification'); 1.31599 + } 1.31600 + } 1.31601 + }; 1.31602 + return c; 1.31603 + }; 1.31604 + XMLListClass = function XMLListClass(runtime, scope, instanceConstructor, baseClass) { 1.31605 + ASXMLList = function (value) { 1.31606 + if (!(this instanceof ASXMLList)) { 1.31607 + return callXMLList(value); 1.31608 + } 1.31609 + return constructXMLList(value); 1.31610 + }; 1.31611 + function callXMLList(v) { 1.31612 + if (v === null || v === undefined) { 1.31613 + v = ''; 1.31614 + } 1.31615 + return toXMLList(v); 1.31616 + } 1.31617 + function constructXMLList(val) { 1.31618 + if (val === null || val === undefined) { 1.31619 + val = ''; 1.31620 + } 1.31621 + if (val.isXMLList) { 1.31622 + var xl = new XMLList(); 1.31623 + xl.append(val); 1.31624 + return xl; 1.31625 + } 1.31626 + return toXMLList(val); 1.31627 + } 1.31628 + XMLList = function (targetObject, targetProperty) { 1.31629 + this.targetObject = targetObject ? targetObject : null; 1.31630 + this.targetProperty = targetProperty ? targetProperty : null; 1.31631 + this.children = []; 1.31632 + }; 1.31633 + var c = new Class('XMLList', ASXMLList, ApplicationDomain.passthroughCallable(ASXMLList)); 1.31634 + c.extend(baseClass); 1.31635 + var XLp = XMLList.prototype = ASXMLList.prototype; 1.31636 + XLp.canHandleProperties = true; 1.31637 + XLp.hasSimpleContent = function hasSimpleContent() { 1.31638 + if (this.length() === 0) { 1.31639 + return true; 1.31640 + } else if (this.length() === 1) { 1.31641 + return toXML(this).hasSimpleContent(); 1.31642 + } 1.31643 + var result = true; 1.31644 + this.children.forEach(function (v) { 1.31645 + if (v.kind === 'element') { 1.31646 + result = false; 1.31647 + } 1.31648 + }); 1.31649 + return result; 1.31650 + }; 1.31651 + XLp.asGetProperty = asGetProperty; 1.31652 + XLp.asGetResolvedStringProperty = asGetResolvedStringPropertyFallback; 1.31653 + XLp.asSetProperty = asSetProperty; 1.31654 + XLp.asHasProperty = asHasProperty; 1.31655 + XLp.asCallProperty = asCallProperty; 1.31656 + XLp.setProperty = function (mn, v, isMethod) { 1.31657 + var x, i, r; 1.31658 + x = this; 1.31659 + i = mn >>> 0; 1.31660 + if (String(mn) === String(i)) { 1.31661 + var targetObject = this.targetObject; 1.31662 + var targetProperty = this.targetProperty; 1.31663 + if (targetObject !== null) { 1.31664 + r = targetObject.resolveValue(); 1.31665 + if (r === null) { 1.31666 + return; 1.31667 + } 1.31668 + } else { 1.31669 + r = null; 1.31670 + } 1.31671 + if (i >= x.length()) { 1.31672 + if (r && r.isXMLList) { 1.31673 + if (r.length !== 1) { 1.31674 + return; 1.31675 + } else { 1.31676 + r = r.children[0]; 1.31677 + } 1.31678 + } 1.31679 + if (r && r.kind !== 'element') { 1.31680 + return; 1.31681 + } 1.31682 + var y = new XML(); 1.31683 + y.parent = r; 1.31684 + y.name = x.targetProperty; 1.31685 + if (targetProperty === null || targetProperty.localName === '*') { 1.31686 + y.name = null; 1.31687 + y.kind = 'text'; 1.31688 + } else if (targetProperty.isAttr) { 1.31689 + var attributeExists = r.getProperty(y.name); 1.31690 + if (attributeExists.length() > 0) { 1.31691 + return; 1.31692 + } 1.31693 + r.kind = 'attribute'; 1.31694 + } else { 1.31695 + y.kind = 'element'; 1.31696 + } 1.31697 + i = x.length(); 1.31698 + if (y.kind !== 'attribute') { 1.31699 + if (r !== null) { 1.31700 + if (i > 0) { 1.31701 + var j = 0; 1.31702 + while (j < r.length() - 1 && r.children[j] !== x.children[i - 1]) { 1.31703 + j++; 1.31704 + } 1.31705 + } else { 1.31706 + var j = r.length() - 1; 1.31707 + } 1.31708 + r.insert(String(j + 1), y); 1.31709 + } 1.31710 + if (v.isXML) { 1.31711 + y.name = v.name; 1.31712 + } else if (v.isXMLList) { 1.31713 + y.name = v.targetProperty; 1.31714 + } 1.31715 + } 1.31716 + x.append(y); 1.31717 + } 1.31718 + if (!v.isXML && !v.isXMLList || v.kind === 'text' || v.kind === 'attribute') { 1.31719 + v = toString(v); 1.31720 + } 1.31721 + if (x.children[i].kind === 'attribute') { 1.31722 + var z = toAttributeName(x.children[i].name); 1.31723 + x.children[i].parent.setProperty(z, v); 1.31724 + var attr = x.children[i].parent.getProperty(z); 1.31725 + x.children[i] = attr.children[0]; 1.31726 + } else if (v.isXMLList) { 1.31727 + var c = v.deepCopy(); 1.31728 + var parent = x.children[i].parent; 1.31729 + if (parent !== null) { 1.31730 + var q; 1.31731 + parent.children.some(function (v, p) { 1.31732 + if (v == x.children[i]) { 1.31733 + q = p; 1.31734 + return true; 1.31735 + } 1.31736 + }); 1.31737 + parent.replace(q, c); 1.31738 + c.children.forEach(function (v, j) { 1.31739 + c.children[j] = parent.children[q >>> 0 + j]; 1.31740 + }); 1.31741 + } 1.31742 + if (c.length() === 0) { 1.31743 + for (var j = x + 1; j < x.length() - 1; j++) { 1.31744 + x.children[String(j - 1)] = x.children[j]; 1.31745 + } 1.31746 + } else { 1.31747 + for (var j = x.length() - 1; j >= i + 1; j--) { 1.31748 + x.children[String(j + c.length() - 1)] = x.children[j]; 1.31749 + } 1.31750 + } 1.31751 + for (var j = 0; j < c.length(); j++) { 1.31752 + x.children[i + j] = c.children[j]; 1.31753 + } 1.31754 + } else if (v.isXML || (k = x.children[i].kind) === 'text' || k === 'comment' || k === 'processing-instruction') { 1.31755 + var parent = x.children[i].parent; 1.31756 + if (parent !== null) { 1.31757 + var q; 1.31758 + parent.children.some(function (v, p) { 1.31759 + if (v == x.children[i]) { 1.31760 + q = p; 1.31761 + return true; 1.31762 + } 1.31763 + }); 1.31764 + parent.replace(q, v); 1.31765 + var v = parent.children[q]; 1.31766 + } 1.31767 + if (typeof v === 'string') { 1.31768 + var t = new XML('text'); 1.31769 + t.parent = x; 1.31770 + t.value = v; 1.31771 + x.children[i] = t; 1.31772 + } else { 1.31773 + x.children[i] = v; 1.31774 + } 1.31775 + } else { 1.31776 + x.children[i].setProperty('*', v); 1.31777 + } 1.31778 + } else if (x.length() <= 1) { 1.31779 + if (x.length() === 0) { 1.31780 + r = x.resolveValue(); 1.31781 + if (r === null || r.length() !== 1) { 1.31782 + return; 1.31783 + } 1.31784 + x.append(r); 1.31785 + } 1.31786 + x.children[0].setProperty(mn, v); 1.31787 + } 1.31788 + }; 1.31789 + XLp.getProperty = function (mn, isMethod) { 1.31790 + if (isMethod) { 1.31791 + var resolved = Multiname.isQName(mn) ? mn : this.resolveMultinameProperty(mn.namespaces, mn.name, mn.flags); 1.31792 + return this[Multiname.getQualifiedName(resolved)]; 1.31793 + } 1.31794 + var x = this; 1.31795 + var i = mn >>> 0; 1.31796 + if (String(mn) === String(i)) { 1.31797 + return x.children[mn]; 1.31798 + } 1.31799 + var name = toXMLName(mn); 1.31800 + var xl = new XMLList(this, name); 1.31801 + x.children.forEach(function (v, i) { 1.31802 + var xl2; 1.31803 + if (v.kind === 'element') { 1.31804 + xl2 = v.getProperty(mn); 1.31805 + if (xl2.length() > 0) { 1.31806 + xl.append(xl2); 1.31807 + } 1.31808 + } 1.31809 + }); 1.31810 + return xl; 1.31811 + }; 1.31812 + XLp.hasProperty = function (mn, isMethod) { 1.31813 + if (isMethod) { 1.31814 + var resolved = Multiname.isQName(mn) ? mn : this.resolveMultinameProperty(mn.namespaces, mn.name, mn.flags); 1.31815 + return !(!this[Multiname.getQualifiedName(resolved)]); 1.31816 + } 1.31817 + var x = this; 1.31818 + var i = mn >>> 0; 1.31819 + if (String(mn) === String(i)) { 1.31820 + return !(!x.children[mn]); 1.31821 + } 1.31822 + var name = toXMLName(mn); 1.31823 + return this.children.some(function (v, i) { 1.31824 + var xl2 = v.getProperty(mn); 1.31825 + if (xl2.length() > 0) { 1.31826 + return true; 1.31827 + } 1.31828 + }); 1.31829 + }; 1.31830 + XLp.delete = function (key, isMethod) { 1.31831 + }; 1.31832 + XLp.append = function (val) { 1.31833 + if (val.isXMLList) { 1.31834 + this.targetObject = val.targetObject; 1.31835 + this.targetProperty = val.targetProperty; 1.31836 + if (val.length() === 0) { 1.31837 + return; 1.31838 + } 1.31839 + for (var i = 0; i < val.length(); i++) { 1.31840 + this.children.push(val.children[i]); 1.31841 + } 1.31842 + } else if (val.isXML) { 1.31843 + this.children.push(val); 1.31844 + } 1.31845 + }; 1.31846 + XLp.length = function () { 1.31847 + return this.children.length; 1.31848 + }; 1.31849 + XLp.resolve = function () { 1.31850 + var base = this.targetObject.resolveValue(); 1.31851 + if (base === null) { 1.31852 + return null; 1.31853 + } 1.31854 + var target = this.targetObject.getProperty(this.targetProperty); 1.31855 + if (base.length === 0) { 1.31856 + notImplemented('XMLList.resolve'); 1.31857 + base.setProperty(this.targetProperty, ''); 1.31858 + target = base.getProperty(this.targetProperty); 1.31859 + return target; 1.31860 + } 1.31861 + }; 1.31862 + XLp.deepCopy = function () { 1.31863 + var xl = new XMLList(); 1.31864 + this.children.forEach(function (v, i) { 1.31865 + xl.children[i] = v.deepCopy(); 1.31866 + }); 1.31867 + return xl; 1.31868 + }; 1.31869 + XLp.descendants = function (name) { 1.31870 + var xl = new XMLList(null); 1.31871 + this.children.forEach(function (v, i) { 1.31872 + if (v.kind === 'element') { 1.31873 + xl.append(v.descendants(name)); 1.31874 + } 1.31875 + }); 1.31876 + return xl; 1.31877 + }; 1.31878 + XLp.resolveValue = function resolveValue() { 1.31879 + if (this.length() > 0) { 1.31880 + return this; 1.31881 + } 1.31882 + var x = this; 1.31883 + var name = x.name; 1.31884 + var targetObject = x.targetObject; 1.31885 + var targetProperty = x.targetProperty; 1.31886 + if (targetObject === null || targetProperty === null || name.isAttr || name.isAny) { 1.31887 + return null; 1.31888 + } 1.31889 + var base = targetObject.resolveValue(); 1.31890 + if (base === null) { 1.31891 + return null; 1.31892 + } 1.31893 + var target = base.getProperty(targetProperty); 1.31894 + if (target.length() === 0) { 1.31895 + if (base.isXMLList && base.length() > 1) { 1.31896 + return null; 1.31897 + } 1.31898 + base.setProperty(targetProperty, ''); 1.31899 + target = base.getProperty(targetProperty); 1.31900 + } 1.31901 + return target; 1.31902 + }; 1.31903 + XLp.asGetEnumerableKeys = function asGetEnumerableKeys() { 1.31904 + if (XLp === this) { 1.31905 + return Object.prototype.asGetEnumerableKeys.call(this); 1.31906 + } 1.31907 + var keys = []; 1.31908 + this.children.forEach(function (v, i) { 1.31909 + keys.push(i); 1.31910 + }); 1.31911 + return keys; 1.31912 + }; 1.31913 + c.native = { 1.31914 + instance: { 1.31915 + init: function () { 1.31916 + } 1.31917 + } 1.31918 + }; 1.31919 + XLp.isXMLList = true; 1.31920 + c.native = { 1.31921 + static: {}, 1.31922 + instance: { 1.31923 + toString: function () { 1.31924 + return toString(this); 1.31925 + }, 1.31926 + hasOwnProperty: function hasOwnProperty(P) { 1.31927 + somewhatImplemented('XMLList.hasOwnProperty'); 1.31928 + return this.hasProperty(P); 1.31929 + }, 1.31930 + propertyIsEnumerable: function propertyIsEnumerable(P) { 1.31931 + notImplemented('XMLList.propertyIsEnumerable'); 1.31932 + }, 1.31933 + attribute: function attribute(name) { 1.31934 + return this.getProperty(toAttributeName(name)); 1.31935 + }, 1.31936 + attributes: function attributes() { 1.31937 + return this.getProperty(toAttributeName('*')); 1.31938 + }, 1.31939 + child: function child(propertyName) { 1.31940 + notImplemented('XMLList.child'); 1.31941 + }, 1.31942 + children: function children() { 1.31943 + var list = new XMLList(); 1.31944 + for (var i = 0; i < this.children.length; i++) { 1.31945 + var child = this.children[i]; 1.31946 + Array.prototype.push.apply(list.children, child.children); 1.31947 + } 1.31948 + return list; 1.31949 + }, 1.31950 + comments: function comments() { 1.31951 + var x = this; 1.31952 + var xl = new XMLList(x, null); 1.31953 + x.children.forEach(function (v, i) { 1.31954 + if (v.kind === 'element') { 1.31955 + xl.append(v.comments()); 1.31956 + } 1.31957 + }); 1.31958 + return xl; 1.31959 + }, 1.31960 + contains: function contains(value) { 1.31961 + for (var i = 0; i < this.children.length; i++) { 1.31962 + if (this.children[i] === value) { 1.31963 + return true; 1.31964 + } 1.31965 + } 1.31966 + return false; 1.31967 + }, 1.31968 + copy: function copy() { 1.31969 + return this.deepCopy(); 1.31970 + }, 1.31971 + descendants: function descendants(name) { 1.31972 + return this.descendants(name === undefined ? '*' : name); 1.31973 + }, 1.31974 + elements: function elements(name) { 1.31975 + var x = this; 1.31976 + var any = false; 1.31977 + if (name === undefined) { 1.31978 + name = '*'; 1.31979 + any = true; 1.31980 + } 1.31981 + var name = toXMLName(name); 1.31982 + var xl = new XMLList(x, name); 1.31983 + x.children.forEach(function (v, i) { 1.31984 + if (v.kind === 'element') { 1.31985 + xl.append(v.comments()); 1.31986 + } 1.31987 + }); 1.31988 + return xl; 1.31989 + }, 1.31990 + hasComplexContent: function hasComplexContent() { 1.31991 + notImplemented('XMLList.hasComplexContent'); 1.31992 + }, 1.31993 + hasSimpleContent: function hasSimpleContent() { 1.31994 + return this.hasSimpleContent(); 1.31995 + }, 1.31996 + length: function length() { 1.31997 + return this.children.length; 1.31998 + }, 1.31999 + name: function name() { 1.32000 + return toXML(this).name; 1.32001 + }, 1.32002 + normalize: function normalize() { 1.32003 + notImplemented('XMLList.normalize'); 1.32004 + }, 1.32005 + parent: function parent() { 1.32006 + notImplemented('XMLList.parent'); 1.32007 + }, 1.32008 + processingInstructions: function processingInstructions(name) { 1.32009 + notImplemented('XMLList.processingInstructions'); 1.32010 + }, 1.32011 + text: function text() { 1.32012 + var x = this; 1.32013 + var xl = new XMLList(x, null); 1.32014 + x.children.forEach(function (v, i) { 1.32015 + if (v.kind === 'text' || v.kind === 'element') { 1.32016 + xl.append(v.text()); 1.32017 + } 1.32018 + }); 1.32019 + return xl; 1.32020 + }, 1.32021 + toXMLString: function () { 1.32022 + return toXMLString(this); 1.32023 + }, 1.32024 + addNamespace: function addNamespace(ns) { 1.32025 + notImplemented('XMLList.addNamespace'); 1.32026 + }, 1.32027 + appendChild: function appendChild(child) { 1.32028 + toXML(this).appendChild(child); 1.32029 + return this; 1.32030 + }, 1.32031 + childIndex: function childIndex() { 1.32032 + notImplemented('XMLList.childIndex'); 1.32033 + }, 1.32034 + inScopeNamespaces: function inScopeNamespaces() { 1.32035 + notImplemented('XMLList.inScopeNamespaces'); 1.32036 + }, 1.32037 + insertChildAfter: function insertChildAfter(child1, child2) { 1.32038 + notImplemented('XMLList.insertChildAfter'); 1.32039 + }, 1.32040 + insertChildBefore: function insertChildBefore(child1, child2) { 1.32041 + notImplemented('XMLList.insertChildBefore'); 1.32042 + }, 1.32043 + nodeKind: function nodeKind() { 1.32044 + return toXML(this).kind; 1.32045 + }, 1.32046 + _namespace: function _namespace(prefix, argc) { 1.32047 + notImplemented('XMLList._namespace'); 1.32048 + }, 1.32049 + localName: function localName() { 1.32050 + notImplemented('XMLList.localName'); 1.32051 + }, 1.32052 + namespaceDeclarations: function namespaceDeclarations() { 1.32053 + somewhatImplemented('XMLList.prototype.namespaceDeclarations()'); 1.32054 + return new XMLList(); 1.32055 + }, 1.32056 + prependChild: function prependChild(value) { 1.32057 + notImplemented('XMLList.prependChild'); 1.32058 + }, 1.32059 + removeNamespace: function removeNamespace(ns) { 1.32060 + notImplemented('XMLList.removeNamespace'); 1.32061 + }, 1.32062 + replace: function replace(propertyName, value) { 1.32063 + toXML(this).replace(propertyName, value); 1.32064 + return this; 1.32065 + }, 1.32066 + setChildren: function setChildren(value) { 1.32067 + notImplemented('XMLList.setChildren'); 1.32068 + }, 1.32069 + setLocalName: function setLocalName(name) { 1.32070 + notImplemented('XMLList.setLocalName'); 1.32071 + }, 1.32072 + setName: function setName(name) { 1.32073 + notImplemented('XMLList.setName'); 1.32074 + }, 1.32075 + setNamespace: function setNamespace(ns) { 1.32076 + notImplemented('XMLList.setNamespace'); 1.32077 + } 1.32078 + } 1.32079 + }; 1.32080 + return c; 1.32081 + }; 1.32082 + QNameClass = function QNameClass(runtime, scope, instanceConstructor, baseClass) { 1.32083 + QName = function QName(ns, name, isAttr) { 1.32084 + if (!(this instanceof QName)) { 1.32085 + if (name === undefined && ns instanceof QName) { 1.32086 + return ns; 1.32087 + } else { 1.32088 + return new QName(ns, name); 1.32089 + } 1.32090 + } 1.32091 + if (name === undefined) { 1.32092 + name = ns; 1.32093 + ns = undefined; 1.32094 + } 1.32095 + if (typeof ns === 'string' || ns instanceof QName) { 1.32096 + ns = new ASNamespace(ns); 1.32097 + } 1.32098 + var mn; 1.32099 + if (name instanceof QName) { 1.32100 + if (ns === undefined) { 1.32101 + mn = name.mn; 1.32102 + } else { 1.32103 + mn = new Multiname([ 1.32104 + ns 1.32105 + ], name.mn.getName()); 1.32106 + } 1.32107 + } else if (name instanceof Multiname) { 1.32108 + if (ns === undefined) { 1.32109 + if (name.isQName() || name.isAnyName() || name.isAnyNamespace()) { 1.32110 + mn = name; 1.32111 + } else { 1.32112 + mn = new Multiname([ 1.32113 + getDefaultNamespace(scope) 1.32114 + ], name.getName(), name.flags); 1.32115 + } 1.32116 + } else { 1.32117 + mn = new Multiname([ 1.32118 + ns 1.32119 + ], name.getName(), name.flags); 1.32120 + } 1.32121 + } else if (name === '*') { 1.32122 + mn = new Multiname([], null, isAttr ? Multiname.ATTRIBUTE : 0); 1.32123 + } else if (name === '@*') { 1.32124 + mn = new Multiname([], null, Multiname.ATTRIBUTE); 1.32125 + } else { 1.32126 + ns = ns === undefined ? getDefaultNamespace(scope) : ns; 1.32127 + if (name === undefined) { 1.32128 + mn = new Multiname([ 1.32129 + ns 1.32130 + ], ''); 1.32131 + } else { 1.32132 + mn = new Multiname([ 1.32133 + ns 1.32134 + ], toString(name), isAttr ? Multiname.ATTRIBUTE : 0); 1.32135 + } 1.32136 + } 1.32137 + this.mn = mn; 1.32138 + this.isAny = mn.isAnyName(); 1.32139 + this.isAnyNamespace = mn.isAnyNamespace(); 1.32140 + this.isAttr = mn.isAttribute(); 1.32141 + }; 1.32142 + var c = new Class('QName', QName, ApplicationDomain.passthroughCallable(QName)); 1.32143 + c.extend(baseClass); 1.32144 + QNp = QName.prototype; 1.32145 + defineNonEnumerableGetter(QNp, 'localName', function () { 1.32146 + if (!this._localName) { 1.32147 + this._localName = this.isAny ? '*' : this.mn.getName(); 1.32148 + } 1.32149 + return this._localName; 1.32150 + }); 1.32151 + defineNonEnumerableGetter(QNp, 'uri', function () { 1.32152 + if (!this._uri) { 1.32153 + var ns = this.mn.namespaces[0]; 1.32154 + this._uri = ns && ns.uri ? ns.uri : this.isAny || this.isAnyNamespace ? null : ''; 1.32155 + } 1.32156 + return this._uri; 1.32157 + }); 1.32158 + defineNonEnumerableGetter(QNp, 'prefix', function () { 1.32159 + return this.mn.namespaces[0].prefix; 1.32160 + }); 1.32161 + defineNonEnumerableSetter(QNp, 'prefix', function (prefix) { 1.32162 + this.mn.namespaces[0].prefix = prefix; 1.32163 + }); 1.32164 + QNp.getNamespace = function (isns) { 1.32165 + if (this.uri === null) { 1.32166 + throw 'TypeError in QName.prototype.getNamespace()'; 1.32167 + } 1.32168 + if (!isns) { 1.32169 + isns = []; 1.32170 + } 1.32171 + var ns; 1.32172 + for (var i = 0; i < isns.length; i++) { 1.32173 + if (this.uri === isns[i].uri) { 1.32174 + ns = isns[i]; 1.32175 + } 1.32176 + } 1.32177 + if (!ns) { 1.32178 + ns = ASNamespace.createNamespace(this.uri); 1.32179 + } 1.32180 + return ns; 1.32181 + }; 1.32182 + c.native = { 1.32183 + static: {}, 1.32184 + instance: { 1.32185 + localName: { 1.32186 + get: function localName() { 1.32187 + return this.localName; 1.32188 + } 1.32189 + }, 1.32190 + uri: { 1.32191 + get: function uri() { 1.32192 + return this.uri; 1.32193 + } 1.32194 + } 1.32195 + } 1.32196 + }; 1.32197 + return c; 1.32198 + }; 1.32199 +}()); 1.32200 +var AMFUtils = function AMFUtilsClosure() { 1.32201 + var AMF0_NUMBER_MARKER = 0; 1.32202 + var AMF0_BOOLEAN_MARKER = 1; 1.32203 + var AMF0_STRING_MARKER = 2; 1.32204 + var AMF0_OBJECT_MARKER = 3; 1.32205 + var AMF0_NULL_MARKER = 5; 1.32206 + var AMF0_UNDEFINED_MARKER = 6; 1.32207 + var AMF0_REFERENCE_MARKER = 7; 1.32208 + var AMF0_ECMA_ARRAY_MARKER = 8; 1.32209 + var AMF0_OBJECT_END_MARKER = 9; 1.32210 + var AMF0_STRICT_ARRAY_MARKER = 10; 1.32211 + var AMF0_DATE_MARKER = 11; 1.32212 + var AMF0_LONG_STRING_MARKER = 12; 1.32213 + var AMF0_XML_MARKER = 15; 1.32214 + var AMF0_TYPED_OBJECT_MARKER = 16; 1.32215 + var AMF0_AVMPLUS_MARKER = 17; 1.32216 + function writeString(ba, s) { 1.32217 + if (s.length > 65535) { 1.32218 + throw 'AMF short string exceeded'; 1.32219 + } 1.32220 + if (!s.length) { 1.32221 + ba.writeByte(0); 1.32222 + ba.writeByte(0); 1.32223 + return; 1.32224 + } 1.32225 + var bytes = utf8decode(s); 1.32226 + ba.writeByte(bytes.length >> 8 & 255); 1.32227 + ba.writeByte(bytes.length & 255); 1.32228 + for (var i = 0; i < bytes.length; i++) { 1.32229 + ba.writeByte(bytes[i]); 1.32230 + } 1.32231 + } 1.32232 + function readString(ba) { 1.32233 + var byteLength = ba.readByte() << 8 | ba.readByte(); 1.32234 + if (!byteLength) { 1.32235 + return ''; 1.32236 + } 1.32237 + var buffer = new Uint8Array(byteLength); 1.32238 + for (var i = 0; i < byteLength; i++) { 1.32239 + buffer[i] = ba.readByte(); 1.32240 + } 1.32241 + return utf8encode(buffer); 1.32242 + } 1.32243 + function writeDouble(ba, value) { 1.32244 + var buffer = new ArrayBuffer(8); 1.32245 + var view = new DataView(buffer); 1.32246 + view.setFloat64(0, value, false); 1.32247 + for (var i = 0; i < buffer.byteLength; i++) { 1.32248 + ba.writeByte(view.getUint8(i)); 1.32249 + } 1.32250 + } 1.32251 + function readDouble(ba) { 1.32252 + var buffer = new ArrayBuffer(8); 1.32253 + var view = new DataView(buffer); 1.32254 + for (var i = 0; i < buffer.byteLength; i++) { 1.32255 + view.setUint8(i, ba.readByte()); 1.32256 + } 1.32257 + return view.getFloat64(0, false); 1.32258 + } 1.32259 + function setAvmProperty(obj, propertyName, value) { 1.32260 + obj.asSetPublicProperty(propertyName, value); 1.32261 + } 1.32262 + var amf0 = { 1.32263 + write: function (ba, obj) { 1.32264 + switch (typeof obj) { 1.32265 + case 'boolean': 1.32266 + ba.writeByte(AMF0_BOOLEAN_MARKER); 1.32267 + ba.writeByte(obj ? 1 : 0); 1.32268 + break; 1.32269 + case 'number': 1.32270 + ba.writeByte(AMF0_NUMBER_MARKER); 1.32271 + writeDouble(ba, obj); 1.32272 + break; 1.32273 + case 'undefined': 1.32274 + ba.writeByte(AMF0_UNDEFINED_MARKER); 1.32275 + break; 1.32276 + case 'string': 1.32277 + ba.writeByte(AMF0_STRING_MARKER); 1.32278 + writeString(ba, obj); 1.32279 + break; 1.32280 + case 'object': 1.32281 + if (obj === null) { 1.32282 + ba.writeByte(AMF0_NULL_MARKER); 1.32283 + } else if (Array.isArray(obj)) { 1.32284 + ba.writeByte(AMF0_ECMA_ARRAY_MARKER); 1.32285 + ba.writeByte(obj.length >>> 24 & 255); 1.32286 + ba.writeByte(obj.length >> 16 & 255); 1.32287 + ba.writeByte(obj.length >> 8 & 255); 1.32288 + ba.writeByte(obj.length & 255); 1.32289 + forEachPublicProperty(obj, function (key, value) { 1.32290 + writeString(ba, key); 1.32291 + this.write(ba, value); 1.32292 + }, this); 1.32293 + ba.writeByte(0); 1.32294 + ba.writeByte(0); 1.32295 + ba.writeByte(AMF0_OBJECT_END_MARKER); 1.32296 + } else { 1.32297 + ba.writeByte(AMF0_OBJECT_MARKER); 1.32298 + forEachPublicProperty(obj, function (key, value) { 1.32299 + writeString(ba, key); 1.32300 + this.write(ba, value); 1.32301 + }, this); 1.32302 + ba.writeByte(0); 1.32303 + ba.writeByte(0); 1.32304 + ba.writeByte(AMF0_OBJECT_END_MARKER); 1.32305 + } 1.32306 + return; 1.32307 + } 1.32308 + }, 1.32309 + read: function (ba) { 1.32310 + var marker = ba.readByte(); 1.32311 + switch (marker) { 1.32312 + case AMF0_NUMBER_MARKER: 1.32313 + return readDouble(ba); 1.32314 + case AMF0_BOOLEAN_MARKER: 1.32315 + return !(!ba.readByte()); 1.32316 + case AMF0_STRING_MARKER: 1.32317 + return readString(ba); 1.32318 + case AMF0_OBJECT_MARKER: 1.32319 + var obj = {}; 1.32320 + while (true) { 1.32321 + var key = readString(ba); 1.32322 + if (!key.length) 1.32323 + break; 1.32324 + setAvmProperty(obj, key, this.read(ba)); 1.32325 + } 1.32326 + if (ba.readByte() !== AMF0_OBJECT_END_MARKER) { 1.32327 + throw 'AMF0 End marker is not found'; 1.32328 + } 1.32329 + return obj; 1.32330 + case AMF0_NULL_MARKER: 1.32331 + return null; 1.32332 + case AMF0_UNDEFINED_MARKER: 1.32333 + return undefined; 1.32334 + case AMF0_ECMA_ARRAY_MARKER: 1.32335 + var obj = []; 1.32336 + obj.length = ba.readByte() << 24 | ba.readByte() << 16 | ba.readByte() << 8 | ba.readByte(); 1.32337 + while (true) { 1.32338 + var key = readString(ba); 1.32339 + if (!key.length) 1.32340 + break; 1.32341 + setAvmProperty(obj, key, this.read(ba)); 1.32342 + } 1.32343 + if (ba.readByte() !== AMF0_OBJECT_END_MARKER) { 1.32344 + throw 'AMF0 End marker is not found'; 1.32345 + } 1.32346 + return obj; 1.32347 + case AMF0_STRICT_ARRAY_MARKER: 1.32348 + var obj = []; 1.32349 + obj.length = ba.readByte() << 24 | ba.readByte() << 16 | ba.readByte() << 8 | ba.readByte(); 1.32350 + for (var i = 0; i < obj.length; i++) { 1.32351 + obj[i] = this.read(ba); 1.32352 + } 1.32353 + return obj; 1.32354 + case AMF0_AVMPLUS_MARKER: 1.32355 + return readAmf3Data(ba, {}); 1.32356 + default: 1.32357 + throw 'AMF0 Unknown marker ' + marker; 1.32358 + } 1.32359 + } 1.32360 + }; 1.32361 + var AMF3_UNDEFINED_MARKER = 0; 1.32362 + var AMF3_NULL_MARKER = 1; 1.32363 + var AMF3_FALSE_MARKER = 2; 1.32364 + var AMF3_TRUE_MARKER = 3; 1.32365 + var AMF3_INTEGER_MARKER = 4; 1.32366 + var AMF3_DOUBLE_MARKER = 5; 1.32367 + var AMF3_STRING_MARKER = 6; 1.32368 + var AMF3_XML_DOC_MARKER = 7; 1.32369 + var AMF3_DATE_MARKER = 8; 1.32370 + var AMF3_ARRAY_MARKER = 9; 1.32371 + var AMF3_OBJECT_MARKER = 10; 1.32372 + var AMF3_XML_MARKER = 11; 1.32373 + var AMF3_BYTEARRAY_MARKER = 12; 1.32374 + var AMF3_VECTOR_INT_MARKER = 13; 1.32375 + var AMF3_VECTOR_UINT_MARKER = 14; 1.32376 + var AMF3_VECTOR_DOUBLE_MARKER = 15; 1.32377 + var AMF3_VECTOR_OBJECT_MARKER = 16; 1.32378 + var AMF3_DICTIONARY_MARKER = 17; 1.32379 + function readU29(ba) { 1.32380 + var b1 = ba.readByte(); 1.32381 + if ((b1 & 128) === 0) { 1.32382 + return b1; 1.32383 + } 1.32384 + var b2 = ba.readByte(); 1.32385 + if ((b2 & 128) === 0) { 1.32386 + return (b1 & 127) << 7 | b2; 1.32387 + } 1.32388 + var b3 = ba.readByte(); 1.32389 + if ((b3 & 128) === 0) { 1.32390 + return (b1 & 127) << 14 | (b2 & 127) << 7 | b3; 1.32391 + } 1.32392 + var b4 = ba.readByte(); 1.32393 + return (b1 & 127) << 22 | (b2 & 127) << 15 | (b3 & 127) << 8 | b4; 1.32394 + } 1.32395 + function writeU29(ba, value) { 1.32396 + if ((value & 4294967168) === 0) { 1.32397 + ba.writeByte(value & 127); 1.32398 + } else if ((value & 4294950912) === 0) { 1.32399 + ba.writeByte(128 | value >> 7 & 127); 1.32400 + ba.writeByte(value & 127); 1.32401 + } else if ((value & 4292870144) === 0) { 1.32402 + ba.writeByte(128 | value >> 14 & 127); 1.32403 + ba.writeByte(128 | value >> 7 & 127); 1.32404 + ba.writeByte(value & 127); 1.32405 + } else if ((value & 3221225472) === 0) { 1.32406 + ba.writeByte(128 | value >> 22 & 127); 1.32407 + ba.writeByte(128 | value >> 15 & 127); 1.32408 + ba.writeByte(128 | value >> 8 & 127); 1.32409 + ba.writeByte(value & 255); 1.32410 + } else { 1.32411 + throw 'AMF3 U29 range'; 1.32412 + } 1.32413 + } 1.32414 + function readUTF8vr(ba, caches) { 1.32415 + var u29s = readU29(ba); 1.32416 + if (u29s === 1) { 1.32417 + return ''; 1.32418 + } 1.32419 + var stringsCache = caches.stringsCache || (caches.stringsCache = []); 1.32420 + if ((u29s & 1) === 0) { 1.32421 + return stringsCache[u29s >> 1]; 1.32422 + } 1.32423 + var byteLength = u29s >> 1; 1.32424 + var buffer = new Uint8Array(byteLength); 1.32425 + for (var i = 0; i < byteLength; i++) { 1.32426 + buffer[i] = ba.readByte(); 1.32427 + } 1.32428 + var value = utf8encode(buffer); 1.32429 + stringsCache.push(value); 1.32430 + return value; 1.32431 + } 1.32432 + function writeUTF8vr(ba, value, caches) { 1.32433 + if (value === '') { 1.32434 + ba.writeByte(1); 1.32435 + return; 1.32436 + } 1.32437 + var stringsCache = caches.stringsCache || (caches.stringsCache = []); 1.32438 + var index = stringsCache.indexOf(value); 1.32439 + if (index >= 0) { 1.32440 + writeU29(ba, index << 1); 1.32441 + return; 1.32442 + } 1.32443 + stringsCache.push(value); 1.32444 + var bytes = utf8decode(value); 1.32445 + writeU29(ba, 1 | bytes.length << 1); 1.32446 + for (var i = 0; i < bytes.length; i++) { 1.32447 + ba.writeByte(bytes[i]); 1.32448 + } 1.32449 + } 1.32450 + function readAmf3Data(ba, caches) { 1.32451 + var marker = ba.readByte(); 1.32452 + switch (marker) { 1.32453 + case AMF3_NULL_MARKER: 1.32454 + return null; 1.32455 + case AMF3_UNDEFINED_MARKER: 1.32456 + return undefined; 1.32457 + case AMF3_FALSE_MARKER: 1.32458 + return false; 1.32459 + case AMF3_TRUE_MARKER: 1.32460 + return true; 1.32461 + case AMF3_INTEGER_MARKER: 1.32462 + return readU29(ba); 1.32463 + case AMF3_DOUBLE_MARKER: 1.32464 + return readDouble(ba); 1.32465 + case AMF3_STRING_MARKER: 1.32466 + return readUTF8vr(ba, caches); 1.32467 + case AMF3_DATE_MARKER: 1.32468 + return new Date(readDouble(ba)); 1.32469 + case AMF3_OBJECT_MARKER: 1.32470 + var u29o = readU29(ba); 1.32471 + if ((u29o & 1) === 0) { 1.32472 + return caches.objectsCache[u29o >> 1]; 1.32473 + } 1.32474 + if ((u29o & 4) !== 0) { 1.32475 + throw 'AMF3 Traits-Ext is not supported'; 1.32476 + } 1.32477 + var traits, objectClass; 1.32478 + if ((u29o & 2) === 0) { 1.32479 + traits = caches.traitsCache[u29o >> 2]; 1.32480 + objectClass = traits.class; 1.32481 + } else { 1.32482 + traits = {}; 1.32483 + var aliasName = readUTF8vr(ba, caches); 1.32484 + traits.className = aliasName; 1.32485 + objectClass = aliasName && aliasesCache.names[aliasName]; 1.32486 + traits.class = objectClass; 1.32487 + traits.isDynamic = (u29o & 8) !== 0; 1.32488 + traits.members = []; 1.32489 + var slots = objectClass && objectClass.instanceBindings.slots; 1.32490 + for (var i = 0, j = u29o >> 4; i < j; i++) { 1.32491 + var traitName = readUTF8vr(ba, caches); 1.32492 + var slot = null; 1.32493 + for (var j = 1; slots && j < slots.length; j++) { 1.32494 + if (slots[j].name.name === traitName) { 1.32495 + slot = slots[j]; 1.32496 + break; 1.32497 + } 1.32498 + } 1.32499 + traits.members.push(slot ? Multiname.getQualifiedName(slot.name) : Multiname.getPublicQualifiedName(traitName)); 1.32500 + } 1.32501 + (caches.traitsCache || (caches.traitsCache = [])).push(traits); 1.32502 + } 1.32503 + var obj = objectClass ? objectClass.createInstance() : {}; 1.32504 + (caches.objectsCache || (caches.objectsCache = [])).push(obj); 1.32505 + for (var i = 0; i < traits.members.length; i++) { 1.32506 + var value = readAmf3Data(ba, caches); 1.32507 + obj[traits.members[i]] = value; 1.32508 + } 1.32509 + if (traits.isDynamic) { 1.32510 + while (true) { 1.32511 + var key = readUTF8vr(ba, caches); 1.32512 + if (!key.length) 1.32513 + break; 1.32514 + var value = readAmf3Data(ba, caches); 1.32515 + setAvmProperty(obj, key, value); 1.32516 + } 1.32517 + } 1.32518 + return obj; 1.32519 + case AMF3_ARRAY_MARKER: 1.32520 + var u29o = readU29(ba); 1.32521 + if ((u29o & 1) === 0) { 1.32522 + return caches.objectsCache[u29o >> 1]; 1.32523 + } 1.32524 + var obj = []; 1.32525 + (caches.objectsCache || (caches.objectsCache = [])).push(obj); 1.32526 + var densePortionLength = u29o >> 1; 1.32527 + while (true) { 1.32528 + var key = readUTF8vr(ba, caches); 1.32529 + if (!key.length) 1.32530 + break; 1.32531 + var value = readAmf3Data(ba, caches); 1.32532 + setAvmProperty(obj, key, value); 1.32533 + } 1.32534 + for (var i = 0; i < densePortionLength; i++) { 1.32535 + var value = readAmf3Data(ba, caches); 1.32536 + setAvmProperty(obj, i, value); 1.32537 + } 1.32538 + return obj; 1.32539 + default: 1.32540 + throw 'AMF3 Unknown marker ' + marker; 1.32541 + } 1.32542 + } 1.32543 + function writeCachedReference(ba, obj, caches) { 1.32544 + var objectsCache = caches.objectsCache || (caches.objectsCache = []); 1.32545 + var index = objectsCache.indexOf(obj); 1.32546 + if (index < 0) { 1.32547 + objectsCache.push(obj); 1.32548 + return false; 1.32549 + } 1.32550 + writeU29(ba, index << 1); 1.32551 + return true; 1.32552 + } 1.32553 + function writeAmf3Data(ba, obj, caches) { 1.32554 + switch (typeof obj) { 1.32555 + case 'boolean': 1.32556 + ba.writeByte(obj ? AMF3_TRUE_MARKER : AMF3_FALSE_MARKER); 1.32557 + break; 1.32558 + case 'number': 1.32559 + if (obj === (obj | 0)) { 1.32560 + ba.writeByte(AMF3_INTEGER_MARKER); 1.32561 + writeU29(ba, obj); 1.32562 + } else { 1.32563 + ba.writeByte(AMF3_DOUBLE_MARKER); 1.32564 + writeDouble(ba, obj); 1.32565 + } 1.32566 + break; 1.32567 + case 'undefined': 1.32568 + ba.writeByte(AMF3_UNDEFINED_MARKER); 1.32569 + break; 1.32570 + case 'string': 1.32571 + ba.writeByte(AMF3_STRING_MARKER); 1.32572 + writeUTF8vr(ba, obj, caches); 1.32573 + break; 1.32574 + case 'object': 1.32575 + if (obj === null) { 1.32576 + ba.writeByte(AMF3_NULL_MARKER); 1.32577 + } else if (Array.isArray(obj)) { 1.32578 + ba.writeByte(AMF3_ARRAY_MARKER); 1.32579 + if (writeCachedReference(ba, obj, caches)) 1.32580 + break; 1.32581 + var densePortionLength = 0; 1.32582 + while (densePortionLength in obj) { 1.32583 + ++densePortionLength; 1.32584 + } 1.32585 + writeU29(ba, densePortionLength << 1 | 1); 1.32586 + forEachPublicProperty(obj, function (i, value) { 1.32587 + if (isNumeric(i) && i >= 0 && i < densePortionLength) { 1.32588 + return; 1.32589 + } 1.32590 + writeUTF8vr(ba, i, caches); 1.32591 + writeAmf3Data(ba, value, caches); 1.32592 + }); 1.32593 + writeUTF8vr(ba, '', caches); 1.32594 + for (var j = 0; j < densePortionLength; j++) { 1.32595 + writeAmf3Data(ba, obj[j], caches); 1.32596 + } 1.32597 + } else if (obj instanceof Date) { 1.32598 + ba.writeByte(AMF3_DATE_MARKER); 1.32599 + if (writeCachedReference(ba, obj, caches)) 1.32600 + break; 1.32601 + writeU29(ba, 1); 1.32602 + writeDouble(ba, obj.valueOf()); 1.32603 + } else { 1.32604 + ba.writeByte(AMF3_OBJECT_MARKER); 1.32605 + if (writeCachedReference(ba, obj, caches)) 1.32606 + break; 1.32607 + var isDynamic = true; 1.32608 + var objectClass = obj.class; 1.32609 + if (objectClass) { 1.32610 + isDynamic = !objectClass.classInfo.instanceInfo.isSealed(); 1.32611 + var aliasName = aliasesCache.classes.get(objectClass) || ''; 1.32612 + var traits, traitsCount; 1.32613 + var traitsCache = caches.traitsCache || (caches.traitsCache = []); 1.32614 + var traitsInfos = caches.traitsInfos || (caches.traitsInfos = []); 1.32615 + var traitsRef = traitsCache.indexOf(objectClass); 1.32616 + if (traitsRef < 0) { 1.32617 + var slots = objectClass.instanceBindings.slots; 1.32618 + traits = []; 1.32619 + var traitsNames = []; 1.32620 + for (var i = 1; i < slots.length; i++) { 1.32621 + var slot = slots[i]; 1.32622 + if (!slot.name.getNamespace().isPublic()) { 1.32623 + continue; 1.32624 + } 1.32625 + traits.push(Multiname.getQualifiedName(slot.name)); 1.32626 + traitsNames.push(slot.name.name); 1.32627 + } 1.32628 + traitsCache.push(objectClass); 1.32629 + traitsInfos.push(traits); 1.32630 + traitsCount = traitsNames.length; 1.32631 + writeU29(ba, (isDynamic ? 11 : 3) + (traitsCount << 4)); 1.32632 + writeUTF8vr(ba, aliasName, caches); 1.32633 + for (var i = 0; i < traitsCount; i++) { 1.32634 + writeUTF8vr(ba, traitsNames[i], caches); 1.32635 + } 1.32636 + } else { 1.32637 + traits = traitsInfos[traitsRef]; 1.32638 + traitsCount = traits.length; 1.32639 + writeU29(ba, 1 + (traitsRef << 2)); 1.32640 + } 1.32641 + for (var i = 0; i < traitsCount; i++) { 1.32642 + writeAmf3Data(ba, obj[traits[i]], caches); 1.32643 + } 1.32644 + } else { 1.32645 + writeU29(ba, 11); 1.32646 + writeUTF8vr(ba, '', caches); 1.32647 + } 1.32648 + if (isDynamic) { 1.32649 + forEachPublicProperty(obj, function (i, value) { 1.32650 + writeUTF8vr(ba, i, caches); 1.32651 + writeAmf3Data(ba, value, caches); 1.32652 + }); 1.32653 + writeUTF8vr(ba, '', caches); 1.32654 + } 1.32655 + } 1.32656 + return; 1.32657 + } 1.32658 + } 1.32659 + var aliasesCache = { 1.32660 + classes: new WeakMap(), 1.32661 + names: Object.create(null) 1.32662 + }; 1.32663 + var amf3 = { 1.32664 + write: function (ba, obj) { 1.32665 + writeAmf3Data(ba, obj, {}); 1.32666 + }, 1.32667 + read: function (ba) { 1.32668 + return readAmf3Data(ba, {}); 1.32669 + } 1.32670 + }; 1.32671 + return { 1.32672 + encodings: [ 1.32673 + amf0, 1.32674 + null, 1.32675 + null, 1.32676 + amf3 1.32677 + ], 1.32678 + aliasesCache: aliasesCache 1.32679 + }; 1.32680 + }(); 1.32681 +function ProxyClass(runtime, scope, instanceConstructor, baseClass) { 1.32682 + function ProxyConstructor() { 1.32683 + somewhatImplemented('Proxy'); 1.32684 + } 1.32685 + var c = new Class('Proxy', ProxyConstructor, ApplicationDomain.coerceCallable(ProxyConstructor)); 1.32686 + c.extendBuiltin(baseClass); 1.32687 + return c; 1.32688 +} 1.32689 +var proxyTrapQns = { 1.32690 + 'getProperty': null, 1.32691 + 'setProperty': null, 1.32692 + 'hasProperty': null, 1.32693 + 'callProperty': null 1.32694 + }; 1.32695 +for (var name in proxyTrapQns) { 1.32696 + proxyTrapQns[name] = VM_OPEN_METHOD_PREFIX + Multiname.getQualifiedName(new Multiname([ 1.32697 + ASNamespace.PROXY 1.32698 + ], name)); 1.32699 +} 1.32700 +function isProxyObject(obj) { 1.32701 + return obj[VM_IS_PROXY]; 1.32702 +} 1.32703 +function nameFromQualifiedName(qn) { 1.32704 + if (isNumeric(qn)) { 1.32705 + return qn; 1.32706 + } 1.32707 + var mn = Multiname.fromQualifiedName(qn); 1.32708 + if (mn === undefined) { 1.32709 + return undefined; 1.32710 + } 1.32711 + return mn.name; 1.32712 +} 1.32713 +function hasNonProxyingCaller() { 1.32714 + var caller = arguments.callee; 1.32715 + var maxDepth = 5; 1.32716 + var domain; 1.32717 + for (var i = 0; i < maxDepth && caller; i++) { 1.32718 + if (caller === nonProxyingHasProperty) { 1.32719 + return true; 1.32720 + } 1.32721 + caller = caller.caller; 1.32722 + } 1.32723 + return false; 1.32724 +} 1.32725 +function installProxyClassWrapper(cls) { 1.32726 + var TRACE_PROXY = false; 1.32727 + if (TRACE_PROXY) { 1.32728 + print('proxy wrapping, class: ' + cls); 1.32729 + } 1.32730 + var instanceConstructor = cls.instanceConstructor; 1.32731 + function construct() { 1.32732 + if (TRACE_PROXY) { 1.32733 + print('proxy create, class: ' + cls); 1.32734 + } 1.32735 + var target = Object.create(instanceConstructor.prototype); 1.32736 + var proxy = Proxy.create({ 1.32737 + get: function (o, qn) { 1.32738 + if (qn === VM_IS_PROXY) { 1.32739 + TRACE_PROXY && print('proxy check'); 1.32740 + return true; 1.32741 + } 1.32742 + if (qn === VM_CALL_PROXY) { 1.32743 + TRACE_PROXY && print('proxy get caller'); 1.32744 + return function apply(mn, receiver, args) { 1.32745 + receiver = receiver ? target : null; 1.32746 + if (TRACE_PROXY) { 1.32747 + print('proxy call, class: ' + target.class + ', mn: ' + mn + 'hasNonProxyingCallerr: ' + hasNonProxyingCaller()); 1.32748 + } 1.32749 + var resolved = Multiname.isQName(mn) ? mn : target.resolveMultinameProperty(mn.namespaces, mn.name, mn.flags); 1.32750 + var qn = resolved ? Multiname.getQualifiedName(resolved) : Multiname.getPublicQualifiedName(mn.name); 1.32751 + if (!nameInTraits(target, qn)) { 1.32752 + return target[proxyTrapQns.callProperty](mn.name, args); 1.32753 + } 1.32754 + if (TRACE_PROXY) { 1.32755 + TRACE_PROXY && print('> proxy pass through ' + resolved); 1.32756 + } 1.32757 + if (target.asOpenMethods && target.asOpenMethods[qn]) { 1.32758 + return target.asOpenMethods[qn].apply(o, args); 1.32759 + } 1.32760 + return undefined; 1.32761 + }; 1.32762 + } 1.32763 + if (TRACE_PROXY) { 1.32764 + print('proxy get, class: ' + target.class + ', qn: ' + qn + 'hasNonProxyingCallerr: ' + hasNonProxyingCaller()); 1.32765 + } 1.32766 + if (!hasNonProxyingCaller()) { 1.32767 + var name = nameFromQualifiedName(qn); 1.32768 + if (name !== undefined && !nameInTraits(target, qn)) { 1.32769 + return target[proxyTrapQns.getProperty](name); 1.32770 + } 1.32771 + } 1.32772 + if (target.asOpenMethods && target.asOpenMethods[qn]) { 1.32773 + return bindSafely(target.asOpenMethods[qn], o); 1.32774 + } 1.32775 + TRACE_PROXY && print('> proxy pass through ' + qn); 1.32776 + return target[qn]; 1.32777 + }, 1.32778 + set: function (o, qn, value) { 1.32779 + if (TRACE_PROXY) { 1.32780 + print('proxy set, class: ' + target.class + ', qn: ' + qn + 'hasNonProxyingCallerr: ' + hasNonProxyingCaller()); 1.32781 + } 1.32782 + if (!hasNonProxyingCaller()) { 1.32783 + var name = nameFromQualifiedName(qn); 1.32784 + if (name !== undefined && !nameInTraits(target, qn)) { 1.32785 + target[proxyTrapQns.setProperty](name, value); 1.32786 + return; 1.32787 + } 1.32788 + } 1.32789 + TRACE_PROXY && print('> proxy pass through ' + qn); 1.32790 + target[qn] = value; 1.32791 + }, 1.32792 + has: function (qn) { 1.32793 + if (TRACE_PROXY) { 1.32794 + print('proxy has, class: ' + target.class + ', qn: ' + qn + 'hasNonProxyingCallerr: ' + hasNonProxyingCaller()); 1.32795 + } 1.32796 + if (!hasNonProxyingCaller()) { 1.32797 + var name = nameFromQualifiedName(qn); 1.32798 + if (name !== undefined && !nameInTraits(target, qn)) { 1.32799 + return target[proxyTrapQns.hasProperty](name); 1.32800 + } 1.32801 + } 1.32802 + return qn in target; 1.32803 + }, 1.32804 + hasOwn: function (qn) { 1.32805 + if (TRACE_PROXY) { 1.32806 + print('proxy hasOwn, class: ' + target.class + ', qn: ' + qn + 'hasNonProxyingCallerr: ' + hasNonProxyingCaller()); 1.32807 + } 1.32808 + if (!hasNonProxyingCaller()) { 1.32809 + var name = nameFromQualifiedName(qn); 1.32810 + if (name !== undefined && !nameInTraits(target, qn)) { 1.32811 + return target[proxyTrapQns.hasProperty](name); 1.32812 + } 1.32813 + } 1.32814 + TRACE_PROXY && print('> proxy pass through ' + qn); 1.32815 + return !(!Object.getOwnPropertyDescriptor(target, qn)); 1.32816 + }, 1.32817 + enumerate: function () { 1.32818 + notImplemented('enumerate'); 1.32819 + }, 1.32820 + keys: function () { 1.32821 + notImplemented('keys'); 1.32822 + } 1.32823 + }, instanceConstructor.prototype); 1.32824 + instanceConstructor.apply(proxy, sliceArguments(arguments, 0)); 1.32825 + return proxy; 1.32826 + } 1.32827 + cls.instanceConstructor = construct; 1.32828 +} 1.32829 +function DictionaryClass(domain, scope, instanceConstructor, baseClass) { 1.32830 + function ASDictionary(weakKeys) { 1.32831 + this.weakKeys = weakKeys; 1.32832 + this.map = new WeakMap(); 1.32833 + if (!weakKeys) { 1.32834 + this.keys = []; 1.32835 + } 1.32836 + this.primitiveMap = createEmptyObject(); 1.32837 + } 1.32838 + var c = new Class('Dictionary', ASDictionary, ApplicationDomain.passthroughCallable(ASDictionary)); 1.32839 + c.extendNative(baseClass, ASDictionary); 1.32840 + function makePrimitiveKey(key) { 1.32841 + if (typeof key === 'string' || typeof key === 'number') { 1.32842 + return key; 1.32843 + } 1.32844 + return undefined; 1.32845 + } 1.32846 + var prototype = ASDictionary.prototype; 1.32847 + defineNonEnumerableProperty(prototype, 'asGetProperty', function asGetProperty(namespaces, name, flags, isMethod) { 1.32848 + var key = makePrimitiveKey(name); 1.32849 + if (key !== undefined) { 1.32850 + return this.primitiveMap[key]; 1.32851 + } 1.32852 + return this.map.get(Object(name)); 1.32853 + }); 1.32854 + defineNonEnumerableProperty(prototype, 'asGetResolvedStringProperty', asGetResolvedStringPropertyFallback); 1.32855 + defineNonEnumerableProperty(prototype, 'asSetProperty', function asSetProperty(namespaces, name, flags, value) { 1.32856 + var key = makePrimitiveKey(name); 1.32857 + if (key !== undefined) { 1.32858 + this.primitiveMap[key] = value; 1.32859 + return; 1.32860 + } 1.32861 + this.map.set(Object(name), value); 1.32862 + if (!this.weakKeys && this.keys.indexOf(name) < 0) { 1.32863 + this.keys.push(name); 1.32864 + } 1.32865 + }); 1.32866 + defineNonEnumerableProperty(prototype, 'asCallProperty', function asCallProperty(namespaces, name, flags, isLex, args) { 1.32867 + notImplemented('asCallProperty'); 1.32868 + }); 1.32869 + defineNonEnumerableProperty(prototype, 'asHasProperty', function asHasProperty(namespaces, name, flags, nonProxy) { 1.32870 + var key = makePrimitiveKey(name); 1.32871 + if (key !== undefined) { 1.32872 + return key in this.primitiveMap; 1.32873 + } 1.32874 + return this.map.has(Object(name)); 1.32875 + }); 1.32876 + defineNonEnumerableProperty(prototype, 'asDeleteProperty', function asDeleteProperty(namespaces, name, flags) { 1.32877 + var key = makePrimitiveKey(name); 1.32878 + if (key !== undefined) { 1.32879 + delete this.primitiveMap[key]; 1.32880 + } 1.32881 + this.map.delete(Object(name)); 1.32882 + var i; 1.32883 + if (!this.weakKeys && (i = this.keys.indexOf(name)) >= 0) { 1.32884 + this.keys.splice(i, 1); 1.32885 + } 1.32886 + return true; 1.32887 + }); 1.32888 + defineNonEnumerableProperty(prototype, 'asGetEnumerableKeys', function () { 1.32889 + if (prototype === this) { 1.32890 + return Object.prototype.asGetEnumerableKeys.call(this); 1.32891 + } 1.32892 + var primitiveMapKeys = []; 1.32893 + for (var k in this.primitiveMap) { 1.32894 + primitiveMapKeys.push(k); 1.32895 + } 1.32896 + if (this.weakKeys) { 1.32897 + return primitiveMapKeys; 1.32898 + } 1.32899 + return primitiveMapKeys.concat(this.keys); 1.32900 + }); 1.32901 + c.native = { 1.32902 + instance: { 1.32903 + init: function () { 1.32904 + } 1.32905 + } 1.32906 + }; 1.32907 + return c; 1.32908 +} 1.32909 +function debugBreak(message) { 1.32910 + debugger; 1.32911 + print('\x1b[91mdebugBreak: ' + message + '\x1b[0m'); 1.32912 +} 1.32913 +var NativeASNamespace; 1.32914 +var natives = function () { 1.32915 + var C = ApplicationDomain.passthroughCallable; 1.32916 + var CC = ApplicationDomain.constructingCallable; 1.32917 + function ObjectClass(applicationDomain, scope, instanceConstructor, baseClass) { 1.32918 + var c = new Class('Object', Object, C(Object)); 1.32919 + c.native = { 1.32920 + instance: { 1.32921 + isPrototypeOf: Object.prototype.isPrototypeOf, 1.32922 + hasOwnProperty: function (name) { 1.32923 + if (name === undefined) { 1.32924 + return false; 1.32925 + } 1.32926 + name = Multiname.getPublicQualifiedName(name); 1.32927 + if (Object.prototype.hasOwnProperty.call(this, name)) { 1.32928 + return true; 1.32929 + } 1.32930 + return Object.getPrototypeOf(this).hasOwnProperty(name); 1.32931 + }, 1.32932 + propertyIsEnumerable: function (name) { 1.32933 + if (name === undefined) { 1.32934 + return false; 1.32935 + } 1.32936 + name = Multiname.getPublicQualifiedName(name); 1.32937 + return Object.prototype.propertyIsEnumerable.call(this, name); 1.32938 + } 1.32939 + }, 1.32940 + static: { 1.32941 + _setPropertyIsEnumerable: function _setPropertyIsEnumerable(obj, name, isEnum) { 1.32942 + name = Multiname.getPublicQualifiedName(name); 1.32943 + var descriptor = Object.getOwnPropertyDescriptor(obj, name); 1.32944 + descriptor.enumerable = false; 1.32945 + Object.defineProperty(obj, name, descriptor); 1.32946 + } 1.32947 + } 1.32948 + }; 1.32949 + c.dynamicPrototype = c.traitsPrototype = Object.prototype; 1.32950 + c.setDefaultProperties(); 1.32951 + c.defaultValue = null; 1.32952 + c.coerce = function (value) { 1.32953 + return asCoerceObject(value); 1.32954 + }; 1.32955 + c.isInstanceOf = function (value) { 1.32956 + if (value === null) { 1.32957 + return false; 1.32958 + } 1.32959 + return true; 1.32960 + }; 1.32961 + c.isInstance = function (value) { 1.32962 + if (value === null || value === undefined) { 1.32963 + return false; 1.32964 + } 1.32965 + return true; 1.32966 + }; 1.32967 + return c; 1.32968 + } 1.32969 + function ClassClass(runtime, scope, instanceConstructor, baseClass) { 1.32970 + var c = Class; 1.32971 + c.debugName = 'Class'; 1.32972 + c.prototype.extendBuiltin.call(c, baseClass); 1.32973 + c.coerce = function (value) { 1.32974 + return value; 1.32975 + }; 1.32976 + c.isInstanceOf = function (value) { 1.32977 + return true; 1.32978 + }; 1.32979 + c.isInstance = function (value) { 1.32980 + return value instanceof c.instanceConstructor; 1.32981 + }; 1.32982 + return c; 1.32983 + } 1.32984 + function BooleanClass(runtime, scope, instanceConstructor, baseClass) { 1.32985 + var c = new Class('Boolean', Boolean, C(Boolean)); 1.32986 + c.extendBuiltin(baseClass); 1.32987 + c.native = { 1.32988 + instance: { 1.32989 + toString: Boolean.prototype.toString, 1.32990 + valueOf: Boolean.prototype.valueOf 1.32991 + } 1.32992 + }; 1.32993 + c.coerce = Boolean; 1.32994 + c.isInstanceOf = function (value) { 1.32995 + return typeof value === 'boolean' || value instanceof Boolean; 1.32996 + }; 1.32997 + c.isInstance = function (value) { 1.32998 + if (typeof value === 'boolean' || value instanceof Boolean) { 1.32999 + return true; 1.33000 + } 1.33001 + return false; 1.33002 + }; 1.33003 + return c; 1.33004 + } 1.33005 + function FunctionClass(runtime, scope, instanceConstructor, baseClass) { 1.33006 + var c = new Class('Function', Function, C(Function)); 1.33007 + c.extendBuiltin(baseClass); 1.33008 + c.native = { 1.33009 + instance: { 1.33010 + prototype: { 1.33011 + get: function () { 1.33012 + return this.prototype; 1.33013 + }, 1.33014 + set: function (p) { 1.33015 + this.prototype = p; 1.33016 + } 1.33017 + }, 1.33018 + length: { 1.33019 + get: function () { 1.33020 + if (this.hasOwnProperty(VM_LENGTH)) { 1.33021 + return this.asLength; 1.33022 + } 1.33023 + return this.length; 1.33024 + } 1.33025 + }, 1.33026 + call: Function.prototype.call, 1.33027 + apply: Function.prototype.apply 1.33028 + } 1.33029 + }; 1.33030 + c.coerce = function (value) { 1.33031 + return value; 1.33032 + }; 1.33033 + c.isInstanceOf = function (value) { 1.33034 + return typeof value === 'function'; 1.33035 + }; 1.33036 + c.isInstance = function (value) { 1.33037 + return typeof value === 'function'; 1.33038 + }; 1.33039 + return c; 1.33040 + } 1.33041 + function MethodClosure($this, fn) { 1.33042 + var bound = bindSafely(fn, $this); 1.33043 + defineNonEnumerableProperty(this, 'call', bound.call.bind(bound)); 1.33044 + defineNonEnumerableProperty(this, 'apply', bound.apply.bind(bound)); 1.33045 + } 1.33046 + MethodClosure.prototype = { 1.33047 + toString: function () { 1.33048 + return 'function Function() {}'; 1.33049 + } 1.33050 + }; 1.33051 + function MethodClosureClass(runtime, scope, instanceConstructor, baseClass) { 1.33052 + var c = new Class('MethodClosure', MethodClosure); 1.33053 + c.extendBuiltin(baseClass); 1.33054 + return c; 1.33055 + } 1.33056 + function StringClass(runtime, scope, instanceConstructor, baseClass) { 1.33057 + var c = new Class('String', String, C(String)); 1.33058 + c.extendBuiltin(baseClass); 1.33059 + var Sp = String.prototype; 1.33060 + c.native = { 1.33061 + instance: { 1.33062 + length: { 1.33063 + get: function () { 1.33064 + return this.length; 1.33065 + } 1.33066 + }, 1.33067 + indexOf: Sp.indexOf, 1.33068 + lastIndexOf: Sp.lastIndexOf, 1.33069 + charAt: Sp.charAt, 1.33070 + charCodeAt: Sp.charCodeAt, 1.33071 + concat: Sp.concat, 1.33072 + localeCompare: Sp.localeCompare, 1.33073 + match: function (re) { 1.33074 + if (re === void 0 || re === null) { 1.33075 + return null; 1.33076 + } else { 1.33077 + if (re instanceof RegExp && re.global) { 1.33078 + var matches = [], m; 1.33079 + while (m = re.exec(this)) { 1.33080 + matches.push(m[0]); 1.33081 + } 1.33082 + return matches; 1.33083 + } 1.33084 + if (!(re instanceof RegExp) && !(typeof re === 'string')) { 1.33085 + re = String(re); 1.33086 + } 1.33087 + return this.match(re); 1.33088 + } 1.33089 + }, 1.33090 + replace: Sp.replace, 1.33091 + search: function (re) { 1.33092 + if (re === void 0) { 1.33093 + return -1; 1.33094 + } else { 1.33095 + return this.search(re); 1.33096 + } 1.33097 + }, 1.33098 + slice: Sp.slice, 1.33099 + split: Sp.split, 1.33100 + substr: Sp.substr, 1.33101 + substring: Sp.substring, 1.33102 + toLowerCase: Sp.toLowerCase, 1.33103 + toLocaleLowerCase: Sp.toLocaleLowerCase, 1.33104 + toUpperCase: function () { 1.33105 + var str = Sp.toUpperCase.apply(this); 1.33106 + var str = str.replace(/\u039C/g, String.fromCharCode(181)); 1.33107 + return str; 1.33108 + }, 1.33109 + toLocaleUpperCase: function () { 1.33110 + var str = Sp.toLocaleUpperCase.apply(this); 1.33111 + var str = str.replace(/\u039C/g, String.fromCharCode(181)); 1.33112 + return str; 1.33113 + }, 1.33114 + toString: Sp.toString, 1.33115 + valueOf: Sp.valueOf 1.33116 + }, 1.33117 + static: String 1.33118 + }; 1.33119 + c.isInstance = function (value) { 1.33120 + return value !== null && value !== undefined && typeof value.valueOf() === 'string'; 1.33121 + }; 1.33122 + c.coerce = function (value) { 1.33123 + if (value === null || value === undefined) { 1.33124 + return null; 1.33125 + } 1.33126 + return String(value); 1.33127 + }; 1.33128 + c.isInstanceOf = function (value) { 1.33129 + return Object(value) instanceof String; 1.33130 + }; 1.33131 + c.isInstance = function (value) { 1.33132 + return Object(value) instanceof String; 1.33133 + }; 1.33134 + return c; 1.33135 + } 1.33136 + function VectorClass(domain, scope, instanceConstructor, baseClass) { 1.33137 + return createVectorClass(undefined, baseClass); 1.33138 + } 1.33139 + function ObjectVectorClass(domain, scope, instanceConstructor, baseClass) { 1.33140 + return createVectorClass(domain.getClass('Object'), baseClass); 1.33141 + } 1.33142 + function IntVectorClass(domain, scope, instanceConstructor, baseClass) { 1.33143 + return createVectorClass(domain.getClass('int'), baseClass); 1.33144 + } 1.33145 + function UIntVectorClass(domain, scope, instanceConstructor, baseClass) { 1.33146 + return createVectorClass(domain.getClass('uint'), baseClass); 1.33147 + } 1.33148 + function DoubleVectorClass(domain, scope, instanceConstructor, baseClass) { 1.33149 + return createVectorClass(domain.getClass('Number'), baseClass); 1.33150 + } 1.33151 + function createVectorClass(type, baseClass) { 1.33152 + var V; 1.33153 + if (type) { 1.33154 + var className = 'Vector$' + type.classInfo.instanceInfo.name.name; 1.33155 + switch (className) { 1.33156 + case 'Vector$int': 1.33157 + V = Int32Vector; 1.33158 + break; 1.33159 + case 'Vector$uint': 1.33160 + V = Uint32Vector; 1.33161 + break; 1.33162 + case 'Vector$Number': 1.33163 + V = Float64Vector; 1.33164 + break; 1.33165 + case 'Vector$Object': 1.33166 + V = GenericVector; 1.33167 + break; 1.33168 + default: 1.33169 + unexpected(); 1.33170 + break; 1.33171 + } 1.33172 + } else { 1.33173 + V = GenericVector.applyType(null); 1.33174 + } 1.33175 + var Vp = V.prototype; 1.33176 + var cls = new Class(className, V, C(V.callable)); 1.33177 + if (V === GenericVector) { 1.33178 + cls.applyType = function (type) { 1.33179 + return cls; 1.33180 + }; 1.33181 + } 1.33182 + cls.extendWrapper(baseClass, V); 1.33183 + cls.native = { 1.33184 + instance: { 1.33185 + fixed: { 1.33186 + get: function () { 1.33187 + return this._fixed; 1.33188 + }, 1.33189 + set: function (v) { 1.33190 + this._fixed = v; 1.33191 + } 1.33192 + }, 1.33193 + length: { 1.33194 + get: function () { 1.33195 + return this.length; 1.33196 + }, 1.33197 + set: function setLength(length) { 1.33198 + this.length = length; 1.33199 + } 1.33200 + }, 1.33201 + push: Vp.push, 1.33202 + pop: Vp.pop, 1.33203 + shift: Vp.shift, 1.33204 + unshift: Vp.unshift, 1.33205 + _reverse: Vp.reverse, 1.33206 + _filter: Vp.filter, 1.33207 + _map: Vp.map, 1.33208 + newThisType: function newThisType() { 1.33209 + return new cls.instanceConstructor(); 1.33210 + }, 1.33211 + _spliceHelper: function _spliceHelper(insertPoint, insertCount, deleteCount, args, offset) { 1.33212 + return this._spliceHelper(insertPoint, insertCount, deleteCount, args, offset); 1.33213 + } 1.33214 + }, 1.33215 + static: { 1.33216 + _some: function (o, callback, thisObject) { 1.33217 + return o.some(callback, thisObject); 1.33218 + }, 1.33219 + _every: function (o, callback, thisObject) { 1.33220 + return o.every(callback, thisObject); 1.33221 + }, 1.33222 + _forEach: function (o, callback, thisObject) { 1.33223 + return o.forEach(callback, thisObject); 1.33224 + }, 1.33225 + _sort: arraySort 1.33226 + } 1.33227 + }; 1.33228 + cls.vectorType = type; 1.33229 + cls.coerce = function (value) { 1.33230 + return value; 1.33231 + }; 1.33232 + cls.isInstanceOf = function (value) { 1.33233 + return true; 1.33234 + }; 1.33235 + cls.isInstance = function (value) { 1.33236 + if (value === null || typeof value !== 'object') { 1.33237 + return false; 1.33238 + } 1.33239 + if (!this.instanceConstructor.vectorType && value.class.vectorType) { 1.33240 + return true; 1.33241 + } 1.33242 + return this.instanceConstructor.prototype.isPrototypeOf(value); 1.33243 + }; 1.33244 + return cls; 1.33245 + } 1.33246 + function NumberClass(runtime, scope, instanceConstructor, baseClass) { 1.33247 + var c = new Class('Number', Number, C(Number)); 1.33248 + c.extendBuiltin(baseClass); 1.33249 + c.native = { 1.33250 + instance: Number.prototype 1.33251 + }; 1.33252 + c.defaultValue = Number(0); 1.33253 + c.isInstance = function (value) { 1.33254 + return value !== null && value !== undefined && typeof value.valueOf() === 'number'; 1.33255 + }; 1.33256 + c.coerce = Number; 1.33257 + c.isInstanceOf = function (value) { 1.33258 + return Object(value) instanceof Number; 1.33259 + }; 1.33260 + c.isInstance = function (value) { 1.33261 + return Object(value) instanceof Number; 1.33262 + }; 1.33263 + return c; 1.33264 + } 1.33265 + function Int(x) { 1.33266 + return x | 0; 1.33267 + } 1.33268 + function boxedInt(x) { 1.33269 + return Object(x | 0); 1.33270 + } 1.33271 + function intClass(runtime, scope, instanceConstructor, baseClass) { 1.33272 + var c = new Class('int', boxedInt, C(Int)); 1.33273 + c.extendBuiltin(baseClass); 1.33274 + c.defaultValue = 0; 1.33275 + c.coerce = Int; 1.33276 + c.isInstanceOf = function (value) { 1.33277 + return false; 1.33278 + }; 1.33279 + c.isInstance = function (value) { 1.33280 + if (value instanceof Number) { 1.33281 + value = value.valueOf(); 1.33282 + } 1.33283 + return (value | 0) === value; 1.33284 + }; 1.33285 + return c; 1.33286 + } 1.33287 + function Uint(x) { 1.33288 + return x >>> 0; 1.33289 + } 1.33290 + function boxedUint(x) { 1.33291 + return Object(x >>> 0); 1.33292 + } 1.33293 + function uintClass(runtime, scope, instanceConstructor, baseClass) { 1.33294 + var c = new Class('uint', boxedUint, C(Uint)); 1.33295 + c.extend(baseClass); 1.33296 + c.defaultValue = 0; 1.33297 + c.isInstanceOf = function (value) { 1.33298 + return false; 1.33299 + }; 1.33300 + c.isInstance = function (value) { 1.33301 + if (value instanceof Number) { 1.33302 + value = value.valueOf(); 1.33303 + } 1.33304 + return value >>> 0 === value; 1.33305 + }; 1.33306 + c.coerce = Uint; 1.33307 + return c; 1.33308 + } 1.33309 + function MathClass(runtime, scope, instanceConstructor, baseClass) { 1.33310 + var c = new Class('Math'); 1.33311 + c.native = { 1.33312 + static: Math 1.33313 + }; 1.33314 + return c; 1.33315 + } 1.33316 + function DateClass(runtime, scope, instanceConstructor, baseClass) { 1.33317 + var c = new Class('Date', Date, C(Date)); 1.33318 + c.extendBuiltin(baseClass); 1.33319 + c.native = { 1.33320 + instance: Date.prototype, 1.33321 + static: Date 1.33322 + }; 1.33323 + return c; 1.33324 + } 1.33325 + function makeErrorClass(name) { 1.33326 + var ErrorDefinition = { 1.33327 + __glue__: { 1.33328 + script: { 1.33329 + instance: { 1.33330 + message: 'public message', 1.33331 + name: 'public name' 1.33332 + } 1.33333 + }, 1.33334 + native: { 1.33335 + instance: { 1.33336 + getStackTrace: function () { 1.33337 + somewhatImplemented('Error.getStackTrace()'); 1.33338 + return AVM2.getStackTrace(); 1.33339 + } 1.33340 + }, 1.33341 + static: { 1.33342 + getErrorMessage: getErrorMessage 1.33343 + } 1.33344 + } 1.33345 + } 1.33346 + }; 1.33347 + return function (runtime, scope, instanceConstructor, baseClass) { 1.33348 + var c = new Class(name, instanceConstructor); 1.33349 + c.extend(baseClass); 1.33350 + if (name === 'Error') { 1.33351 + c.link(ErrorDefinition); 1.33352 + c.linkNatives(ErrorDefinition); 1.33353 + } 1.33354 + return c; 1.33355 + }; 1.33356 + } 1.33357 + function RegExpClass(runtime, scope, instanceConstructor, baseClass) { 1.33358 + var c = new Class('RegExp', XRegExp, C(XRegExp)); 1.33359 + c.extendBuiltin(baseClass); 1.33360 + RegExpClass.exec = function exec() { 1.33361 + var result = this.exec.apply(this, arguments); 1.33362 + if (!result) { 1.33363 + return result; 1.33364 + } 1.33365 + var keys = Object.keys(result); 1.33366 + for (var i = 0; i < keys.length; i++) { 1.33367 + var k = keys[i]; 1.33368 + if (!isNumeric(k)) { 1.33369 + if (result[k] === undefined) { 1.33370 + result[k] = ''; 1.33371 + } 1.33372 + } 1.33373 + } 1.33374 + publicizeProperties(result); 1.33375 + return result; 1.33376 + }; 1.33377 + RegExpClass.test = function test() { 1.33378 + return this.exec.apply(this, arguments) !== null; 1.33379 + }; 1.33380 + c.native = { 1.33381 + instance: { 1.33382 + global: { 1.33383 + get: function () { 1.33384 + return this.global; 1.33385 + } 1.33386 + }, 1.33387 + source: { 1.33388 + get: function () { 1.33389 + return this.source; 1.33390 + } 1.33391 + }, 1.33392 + ignoreCase: { 1.33393 + get: function () { 1.33394 + return this.ignoreCase; 1.33395 + } 1.33396 + }, 1.33397 + multiline: { 1.33398 + get: function () { 1.33399 + return this.multiline; 1.33400 + } 1.33401 + }, 1.33402 + lastIndex: { 1.33403 + get: function () { 1.33404 + return this.lastIndex; 1.33405 + }, 1.33406 + set: function (i) { 1.33407 + this.lastIndex = i; 1.33408 + } 1.33409 + }, 1.33410 + dotall: { 1.33411 + get: function () { 1.33412 + return this.dotall; 1.33413 + } 1.33414 + }, 1.33415 + extended: { 1.33416 + get: function () { 1.33417 + return this.extended; 1.33418 + } 1.33419 + }, 1.33420 + exec: RegExpClass.exec, 1.33421 + test: RegExpClass.test 1.33422 + } 1.33423 + }; 1.33424 + return c; 1.33425 + } 1.33426 + function NamespaceClass(runtime, scope, instanceConstructor, baseClass) { 1.33427 + NativeASNamespace = function NativeASNamespace(prefixValue, uriValue) { 1.33428 + if (uriValue === undefined) { 1.33429 + uriValue = prefixValue; 1.33430 + prefixValue = undefined; 1.33431 + } 1.33432 + var prefix, uri; 1.33433 + if (prefixValue === undefined) { 1.33434 + if (uriValue === undefined) { 1.33435 + prefix = ''; 1.33436 + uri = ''; 1.33437 + } else if (typeof uriValue === 'object') { 1.33438 + prefix = uriValue.prefix; 1.33439 + if (uriValue instanceof ASNamespace) { 1.33440 + uri = uriValue.uri; 1.33441 + } else if (uriValue instanceof QName) { 1.33442 + uri = uriValue.uri; 1.33443 + } 1.33444 + } else { 1.33445 + uri = uriValue + ''; 1.33446 + if (uri === '') { 1.33447 + prefix = ''; 1.33448 + } else { 1.33449 + prefix = undefined; 1.33450 + } 1.33451 + } 1.33452 + } else { 1.33453 + if (typeof uriValue === 'object' && uriValue instanceof QName && uriValue.uri !== null) { 1.33454 + uri = uriValue.uri; 1.33455 + } else { 1.33456 + uri = uriValue + ''; 1.33457 + } 1.33458 + if (uri === '') { 1.33459 + if (prefixValue === undefined || prefixValue + '' === '') { 1.33460 + prefix = ''; 1.33461 + } else { 1.33462 + throw 'type error'; 1.33463 + } 1.33464 + } else if (prefixValue === undefined || prefixValue === '') { 1.33465 + prefix = undefined; 1.33466 + } else if (false && !isXMLName(prefixValue)) { 1.33467 + prefix = undefined; 1.33468 + } else { 1.33469 + prefix = prefixValue + ''; 1.33470 + } 1.33471 + } 1.33472 + return ASNamespace.createNamespace(uri, prefix); 1.33473 + }; 1.33474 + var c = new Class('Namespace', NativeASNamespace, C(NativeASNamespace)); 1.33475 + c.extendNative(baseClass, ASNamespace); 1.33476 + var Np = ASNamespace.prototype; 1.33477 + c.native = { 1.33478 + instance: { 1.33479 + prefix: { 1.33480 + get: Np.getPrefix 1.33481 + }, 1.33482 + uri: { 1.33483 + get: Np.getURI 1.33484 + } 1.33485 + } 1.33486 + }; 1.33487 + return c; 1.33488 + } 1.33489 + function JSONClass(runtime, scope, instanceConstructor, baseClass) { 1.33490 + function transformJSValueToAS(value) { 1.33491 + if (typeof value !== 'object') { 1.33492 + return value; 1.33493 + } 1.33494 + var keys = Object.keys(value); 1.33495 + var result = value instanceof Array ? [] : {}; 1.33496 + for (var i = 0; i < keys.length; i++) { 1.33497 + result.asSetPublicProperty(keys[i], transformJSValueToAS(value[keys[i]])); 1.33498 + } 1.33499 + return result; 1.33500 + } 1.33501 + function transformASValueToJS(value) { 1.33502 + if (typeof value !== 'object') { 1.33503 + return value; 1.33504 + } 1.33505 + var keys = Object.keys(value); 1.33506 + var result = value instanceof Array ? [] : {}; 1.33507 + for (var i = 0; i < keys.length; i++) { 1.33508 + var key = keys[i]; 1.33509 + var jsKey = key; 1.33510 + if (!isNumeric(key)) { 1.33511 + jsKey = Multiname.getNameFromPublicQualifiedName(key); 1.33512 + } 1.33513 + result[jsKey] = transformASValueToJS(value[key]); 1.33514 + } 1.33515 + return result; 1.33516 + } 1.33517 + function ASJSON() { 1.33518 + } 1.33519 + var c = new Class('JSON', ASJSON, C(ASJSON)); 1.33520 + c.extend(baseClass); 1.33521 + c.native = { 1.33522 + static: { 1.33523 + parseCore: function parseCore(text) { 1.33524 + return transformJSValueToAS(JSON.parse(text)); 1.33525 + }, 1.33526 + stringifySpecializedToString: function stringifySpecializedToString(value, replacerArray, replacerFunction, gap) { 1.33527 + return JSON.stringify(transformASValueToJS(value), replacerFunction, gap); 1.33528 + } 1.33529 + } 1.33530 + }; 1.33531 + return c; 1.33532 + } 1.33533 + function CapabilitiesClass(runtime, scope, instanceConstructor, baseClass) { 1.33534 + function Capabilities() { 1.33535 + } 1.33536 + var c = new Class('Capabilities', Capabilities, C(Capabilities)); 1.33537 + c.extend(baseClass); 1.33538 + c.native = { 1.33539 + static: { 1.33540 + playerType: { 1.33541 + get: function () { 1.33542 + return 'AVMPlus'; 1.33543 + } 1.33544 + } 1.33545 + } 1.33546 + }; 1.33547 + return c; 1.33548 + } 1.33549 + function FileClass(runtime, scope, instanceConstructor, baseClass) { 1.33550 + function File() { 1.33551 + } 1.33552 + var c = new Class('File', File, C(File)); 1.33553 + c.extend(baseClass); 1.33554 + c.native = { 1.33555 + static: { 1.33556 + exists: function (filename) { 1.33557 + notImplemented('File.exists'); 1.33558 + return false; 1.33559 + }, 1.33560 + read: function (filename) { 1.33561 + return snarf(filename); 1.33562 + }, 1.33563 + write: function (filename, data) { 1.33564 + notImplemented('File.write'); 1.33565 + return true; 1.33566 + }, 1.33567 + readByteArray: function (filename) { 1.33568 + var ByteArrayClass = AVM2.currentDomain().getClass('flash.utils.ByteArray'); 1.33569 + var data = ByteArrayClass.createInstance(); 1.33570 + data.writeRawBytes(snarf(filename, 'binary')); 1.33571 + return data; 1.33572 + }, 1.33573 + writeByteArray: function (filename, bytes) { 1.33574 + write('bin/' + filename, bytes.getBytes()); 1.33575 + return true; 1.33576 + } 1.33577 + } 1.33578 + }; 1.33579 + return c; 1.33580 + } 1.33581 + function ShumwayClass(runtime, scope, instanceConstructor, baseClass) { 1.33582 + function Shumway() { 1.33583 + } 1.33584 + var c = new Class('Shumway', Shumway, C(Shumway)); 1.33585 + c.extend(baseClass); 1.33586 + c.native = { 1.33587 + static: { 1.33588 + info: function (x) { 1.33589 + console.info(x); 1.33590 + }, 1.33591 + json: function (x) { 1.33592 + return JSON.stringify(x); 1.33593 + }, 1.33594 + eval: function (x) { 1.33595 + return eval(x); 1.33596 + }, 1.33597 + debugger: function (x) { 1.33598 + debugger; 1.33599 + } 1.33600 + } 1.33601 + }; 1.33602 + return c; 1.33603 + } 1.33604 + function constant(x) { 1.33605 + return function () { 1.33606 + return x; 1.33607 + }; 1.33608 + } 1.33609 + function ByteArrayClass(runtime, scope, instanceConstructor, baseClass) { 1.33610 + var BA = function () { 1.33611 + ByteArray.call(this); 1.33612 + }; 1.33613 + var BAp = BA.prototype = Object.create(ByteArray.prototype); 1.33614 + var c = new Class('ByteArray', BA, C(BA)); 1.33615 + c.extendBuiltin(baseClass); 1.33616 + BAp.asGetNumericProperty = function (i) { 1.33617 + if (i >= this.length) { 1.33618 + return undefined; 1.33619 + } 1.33620 + return this.uint8v[i]; 1.33621 + }; 1.33622 + BAp.asSetNumericProperty = function (i, v) { 1.33623 + var len = i + 1; 1.33624 + this.ensureCapacity(len); 1.33625 + this.uint8v[i] = v; 1.33626 + if (len > this.length) { 1.33627 + this.length = len; 1.33628 + } 1.33629 + }; 1.33630 + BAp.readUTF = function readUTF() { 1.33631 + return this.readUTFBytes(this.readShort()); 1.33632 + }; 1.33633 + BAp.readUTFBytes = function readUTFBytes(length) { 1.33634 + var pos = this.position; 1.33635 + if (pos + length > this.length) { 1.33636 + throwEOFError(); 1.33637 + } 1.33638 + this.position += length; 1.33639 + return utf8encode(new Int8Array(this.a, pos, length)); 1.33640 + }; 1.33641 + BAp.writeUTF = function writeUTF(str) { 1.33642 + var bytes = utf8decode(str); 1.33643 + this.writeShort(bytes.length); 1.33644 + this.writeRawBytes(bytes); 1.33645 + }; 1.33646 + BAp.writeUTFBytes = function writeUTFBytes(str) { 1.33647 + var bytes = utf8decode(str); 1.33648 + this.writeRawBytes(bytes); 1.33649 + }; 1.33650 + BAp.toString = function toString() { 1.33651 + return utf8encode(new Int8Array(this.a, 0, this.length)); 1.33652 + }; 1.33653 + c.native = { 1.33654 + instance: { 1.33655 + length: { 1.33656 + get: function () { 1.33657 + return this.length; 1.33658 + }, 1.33659 + set: function setLength(length) { 1.33660 + var cap = this.a.byteLength; 1.33661 + if (length > cap) { 1.33662 + this.ensureCapacity(length); 1.33663 + } 1.33664 + this.length = length; 1.33665 + this.position = clamp(this.position, 0, this.length); 1.33666 + } 1.33667 + }, 1.33668 + bytesAvailable: { 1.33669 + get: function () { 1.33670 + return this.length - this.position; 1.33671 + } 1.33672 + }, 1.33673 + position: { 1.33674 + get: function () { 1.33675 + return this.position; 1.33676 + }, 1.33677 + set: function (p) { 1.33678 + this.position = p; 1.33679 + } 1.33680 + }, 1.33681 + endian: { 1.33682 + get: function () { 1.33683 + return this.le ? 'littleEndian' : 'bigEndian'; 1.33684 + }, 1.33685 + set: function (e) { 1.33686 + this.le = e === 'littleEndian'; 1.33687 + } 1.33688 + }, 1.33689 + objectEncoding: { 1.33690 + get: function () { 1.33691 + return this.objectEncoding; 1.33692 + }, 1.33693 + set: function (v) { 1.33694 + this.objectEncoding = v; 1.33695 + } 1.33696 + }, 1.33697 + writeBytes: BAp.writeBytes, 1.33698 + writeBoolean: BAp.writeBoolean, 1.33699 + writeByte: BAp.writeByte, 1.33700 + writeShort: BAp.writeShort, 1.33701 + writeInt: BAp.writeInt, 1.33702 + writeUnsignedInt: BAp.writeUnsignedInt, 1.33703 + writeFloat: BAp.writeFloat, 1.33704 + writeDouble: BAp.writeDouble, 1.33705 + writeMultiByte: BAp.writeMultiByte, 1.33706 + writeObject: function writeObject(v) { 1.33707 + return AMFUtils.encodings[this.objectEncoding].write(this, v); 1.33708 + }, 1.33709 + writeUTF: BAp.writeUTF, 1.33710 + writeUTFBytes: BAp.writeUTFBytes, 1.33711 + readBoolean: BAp.readBoolean, 1.33712 + readByte: BAp.readByte, 1.33713 + readBytes: BAp.readBytes, 1.33714 + readUnsignedByte: BAp.readUnsignedByte, 1.33715 + readShort: BAp.readShort, 1.33716 + readUnsignedShort: BAp.readUnsignedShort, 1.33717 + readInt: BAp.readInt, 1.33718 + readUnsignedInt: BAp.readUnsignedInt, 1.33719 + readFloat: BAp.readFloat, 1.33720 + readDouble: BAp.readDouble, 1.33721 + readMultiByte: BAp.readMultiByte, 1.33722 + readObject: function readObject() { 1.33723 + return AMFUtils.encodings[this.objectEncoding].read(this); 1.33724 + }, 1.33725 + readUTF: BAp.readUTF, 1.33726 + readUTFBytes: BAp.readUTFBytes, 1.33727 + toString: BAp.toString, 1.33728 + clear: BAp.clear, 1.33729 + _compress: BAp.compress, 1.33730 + _uncompress: BAp.uncompress 1.33731 + }, 1.33732 + static: { 1.33733 + defaultObjectEncoding: { 1.33734 + get: function () { 1.33735 + return ByteArray.DEFAULT_OBJECT_ENCODING; 1.33736 + }, 1.33737 + set: function (e) { 1.33738 + ByteArray.DEFAULT_OBJECT_ENCODING = e; 1.33739 + } 1.33740 + } 1.33741 + } 1.33742 + }; 1.33743 + return c; 1.33744 + } 1.33745 + function DomainClass(runtime, scope, instanceConstructor, baseClass) { 1.33746 + var c = new Class('File', instanceConstructor, C(instanceConstructor)); 1.33747 + c.extend(baseClass); 1.33748 + c.native = { 1.33749 + instance: { 1.33750 + init: function (base) { 1.33751 + this.base = base; 1.33752 + this.nativeObject = new ApplicationDomain(AVM2.instance, base ? base.nativeObject : null); 1.33753 + }, 1.33754 + loadBytes: function (byteArray, swfVersion) { 1.33755 + this.nativeObject.executeAbc(new AbcFile(byteArray.readRawBytes())); 1.33756 + }, 1.33757 + getClass: function (className) { 1.33758 + return this.nativeObject.getClass(className); 1.33759 + } 1.33760 + }, 1.33761 + static: { 1.33762 + currentDomain: { 1.33763 + get: function () { 1.33764 + var domain = Object.create(instanceConstructor.prototype); 1.33765 + domain.nativeObject = AVM2.currentDomain(); 1.33766 + return domain; 1.33767 + } 1.33768 + } 1.33769 + } 1.33770 + }; 1.33771 + return c; 1.33772 + } 1.33773 + function SystemClass(runtime, scope, instanceConstructor, baseClass) { 1.33774 + var c = new Class('System', instanceConstructor, C(instanceConstructor)); 1.33775 + c.extend(baseClass); 1.33776 + c.native = { 1.33777 + static: { 1.33778 + swfVersion: { 1.33779 + get: function () { 1.33780 + return 19; 1.33781 + } 1.33782 + }, 1.33783 + apiVersion: { 1.33784 + get: function () { 1.33785 + return 26; 1.33786 + } 1.33787 + }, 1.33788 + getArgv: function () { 1.33789 + return []; 1.33790 + }, 1.33791 + getRunmode: function () { 1.33792 + return 'mixed'; 1.33793 + } 1.33794 + } 1.33795 + }; 1.33796 + return c; 1.33797 + } 1.33798 + function bugzilla(n) { 1.33799 + switch (n) { 1.33800 + case 574600: 1.33801 + return true; 1.33802 + } 1.33803 + return false; 1.33804 + } 1.33805 + return { 1.33806 + print: constant(print), 1.33807 + notImplemented: constant(notImplemented), 1.33808 + debugBreak: constant(debugBreak), 1.33809 + bugzilla: constant(bugzilla), 1.33810 + decodeURI: constant(decodeURI), 1.33811 + decodeURIComponent: constant(decodeURIComponent), 1.33812 + encodeURI: constant(encodeURI), 1.33813 + encodeURIComponent: constant(encodeURIComponent), 1.33814 + isNaN: constant(isNaN), 1.33815 + isFinite: constant(isFinite), 1.33816 + parseInt: constant(parseInt), 1.33817 + parseFloat: constant(parseFloat), 1.33818 + escape: constant(escape), 1.33819 + unescape: constant(unescape), 1.33820 + isXMLName: constant(typeof isXMLName !== 'undefined' ? isXMLName : function () { 1.33821 + notImplemented('Chrome doesn\'t support isXMLName.'); 1.33822 + }), 1.33823 + Function: Function, 1.33824 + String: String, 1.33825 + Array: Array, 1.33826 + Number: Number, 1.33827 + Boolean: Boolean, 1.33828 + Math: Math, 1.33829 + Date: Date, 1.33830 + RegExp: RegExp, 1.33831 + Object: Object, 1.33832 + ObjectClass: ObjectClass, 1.33833 + Class: ClassClass, 1.33834 + NamespaceClass: NamespaceClass, 1.33835 + FunctionClass: FunctionClass, 1.33836 + MethodClosureClass: MethodClosureClass, 1.33837 + BooleanClass: BooleanClass, 1.33838 + StringClass: StringClass, 1.33839 + NumberClass: NumberClass, 1.33840 + intClass: intClass, 1.33841 + uintClass: uintClass, 1.33842 + ArrayClass: ArrayClass, 1.33843 + VectorClass: VectorClass, 1.33844 + ObjectVectorClass: ObjectVectorClass, 1.33845 + IntVectorClass: IntVectorClass, 1.33846 + UIntVectorClass: UIntVectorClass, 1.33847 + DoubleVectorClass: DoubleVectorClass, 1.33848 + ByteArrayClass: ByteArrayClass, 1.33849 + ProxyClass: ProxyClass, 1.33850 + ErrorClass: makeErrorClass('Error'), 1.33851 + DefinitionErrorClass: makeErrorClass('DefinitionError'), 1.33852 + EvalErrorClass: makeErrorClass('EvalError'), 1.33853 + RangeErrorClass: makeErrorClass('RangeError'), 1.33854 + ReferenceErrorClass: makeErrorClass('ReferenceError'), 1.33855 + SecurityErrorClass: makeErrorClass('SecurityError'), 1.33856 + SyntaxErrorClass: makeErrorClass('SyntaxError'), 1.33857 + TypeErrorClass: makeErrorClass('TypeError'), 1.33858 + URIErrorClass: makeErrorClass('URIError'), 1.33859 + VerifyErrorClass: makeErrorClass('VerifyError'), 1.33860 + UninitializedErrorClass: makeErrorClass('UninitializedError'), 1.33861 + ArgumentErrorClass: makeErrorClass('ArgumentError'), 1.33862 + DateClass: DateClass, 1.33863 + MathClass: MathClass, 1.33864 + RegExpClass: RegExpClass, 1.33865 + DictionaryClass: DictionaryClass, 1.33866 + XMLClass: XMLClass, 1.33867 + XMLListClass: XMLListClass, 1.33868 + QNameClass: QNameClass, 1.33869 + JSONClass: JSONClass, 1.33870 + ShumwayClass: ShumwayClass, 1.33871 + CapabilitiesClass: CapabilitiesClass, 1.33872 + FileClass: FileClass, 1.33873 + DomainClass: DomainClass, 1.33874 + SystemClass: SystemClass, 1.33875 + getQualifiedClassName: constant(function (value) { 1.33876 + if (value === null) { 1.33877 + return 'null'; 1.33878 + } else if (value === undefined) { 1.33879 + return 'void'; 1.33880 + } 1.33881 + switch (typeof value) { 1.33882 + case 'number': 1.33883 + if ((value | 0) === value) { 1.33884 + return 'int'; 1.33885 + } 1.33886 + return 'Number'; 1.33887 + case 'string': 1.33888 + return 'String'; 1.33889 + case 'boolean': 1.33890 + return 'Boolean'; 1.33891 + case 'object': 1.33892 + if (value instanceof Date) { 1.33893 + return 'Date'; 1.33894 + } 1.33895 + var cls; 1.33896 + if (value instanceof Class) { 1.33897 + cls = value; 1.33898 + } else if (value.class) { 1.33899 + cls = value.class; 1.33900 + } else if (value.classInfo) { 1.33901 + cls = value; 1.33902 + } 1.33903 + if (cls) { 1.33904 + var name = cls.classInfo.instanceInfo.name; 1.33905 + var uri = name.namespaces[0].uri; 1.33906 + if (uri) { 1.33907 + return uri + '::' + name.name; 1.33908 + } 1.33909 + return name.name; 1.33910 + } 1.33911 + break; 1.33912 + } 1.33913 + return notImplemented(value + ' (' + typeof value + ')'); 1.33914 + }), 1.33915 + getQualifiedSuperclassName: constant(function (value) { 1.33916 + switch (typeof value) { 1.33917 + case 'number': 1.33918 + case 'string': 1.33919 + case 'boolean': 1.33920 + return 'Object'; 1.33921 + case 'function': 1.33922 + return 'Function'; 1.33923 + case 'object': 1.33924 + if (value instanceof Date) { 1.33925 + return 'Object'; 1.33926 + } 1.33927 + var cls; 1.33928 + if (value.class) { 1.33929 + cls = value.class; 1.33930 + } else if (value.classInfo) { 1.33931 + cls = value; 1.33932 + } 1.33933 + if (cls && cls.baseClass) { 1.33934 + var name = cls.baseClass.classInfo.instanceInfo.name; 1.33935 + var uri = name.namespaces[0].uri; 1.33936 + if (uri) { 1.33937 + return uri + '::' + name.name; 1.33938 + } 1.33939 + return name.name; 1.33940 + } 1.33941 + return 'Object'; 1.33942 + } 1.33943 + return notImplemented(value + ' (superOf ' + typeof value + ')'); 1.33944 + }), 1.33945 + getDefinitionByName: constant(function (name) { 1.33946 + var simpleName = String(name).replace('::', '.'); 1.33947 + return AVM2.currentDomain().getClass(simpleName); 1.33948 + }), 1.33949 + describeTypeJSON: constant(describeTypeJSON), 1.33950 + original: jsGlobal[VM_NATIVE_BUILTIN_ORIGINALS] 1.33951 + }; 1.33952 + function describeTypeJSON(o, flags) { 1.33953 + var Flags = { 1.33954 + HIDE_NSURI_METHODS: 1, 1.33955 + INCLUDE_BASES: 2, 1.33956 + INCLUDE_INTERFACES: 4, 1.33957 + INCLUDE_VARIABLES: 8, 1.33958 + INCLUDE_ACCESSORS: 16, 1.33959 + INCLUDE_METHODS: 32, 1.33960 + INCLUDE_METADATA: 64, 1.33961 + INCLUDE_CONSTRUCTOR: 128, 1.33962 + INCLUDE_TRAITS: 256, 1.33963 + USE_ITRAITS: 512, 1.33964 + HIDE_OBJECT: 1024 1.33965 + }; 1.33966 + var declaredByKey = publicName('declaredBy'); 1.33967 + var metadataKey = publicName('metadata'); 1.33968 + var accessKey = publicName('access'); 1.33969 + var uriKey = publicName('uri'); 1.33970 + var nameKey = publicName('name'); 1.33971 + var typeKey = publicName('type'); 1.33972 + var returnTypeKey = publicName('returnType'); 1.33973 + var valueKey = publicName('value'); 1.33974 + var keyKey = publicName('key'); 1.33975 + var parametersKey = publicName('parameters'); 1.33976 + var optionalKey = publicName('optional'); 1.33977 + var cls = o.classInfo ? o : Object.getPrototypeOf(o).class; 1.33978 + true; 1.33979 + var info = cls.classInfo; 1.33980 + var description = {}; 1.33981 + description[nameKey] = unmangledQualifiedName(info.instanceInfo.name); 1.33982 + description[publicName('isDynamic')] = cls === o ? true : !(info.instanceInfo.flags & CONSTANT_ClassSealed); 1.33983 + description[publicName('isStatic')] = cls === o; 1.33984 + description[publicName('isFinal')] = cls === o ? true : !(info.instanceInfo.flags & CONSTANT_ClassFinal); 1.33985 + if (flags & Flags.INCLUDE_TRAITS) { 1.33986 + description[publicName('traits')] = addTraits(cls, flags); 1.33987 + } 1.33988 + var metadata = null; 1.33989 + if (info.metadata) { 1.33990 + metadata = Object.keys(info.metadata).map(function (key) { 1.33991 + return describeMetadata(info.metadata[key]); 1.33992 + }); 1.33993 + } 1.33994 + description[metadataKey] = metadata; 1.33995 + return description; 1.33996 + function publicName(str) { 1.33997 + return Multiname.getPublicQualifiedName(str); 1.33998 + } 1.33999 + function unmangledQualifiedName(mn) { 1.34000 + var name = mn.name; 1.34001 + var namespace = mn.namespaces[0]; 1.34002 + if (namespace && namespace.uri) { 1.34003 + return namespace.uri + '::' + name; 1.34004 + } 1.34005 + return name; 1.34006 + } 1.34007 + function describeMetadata(metadata) { 1.34008 + var result = {}; 1.34009 + result[nameKey] = metadata.name; 1.34010 + result[valueKey] = metadata.value.map(function (value) { 1.34011 + var val = {}; 1.34012 + val[keyKey] = value.key; 1.34013 + val[valueKey] = value.value; 1.34014 + return value; 1.34015 + }); 1.34016 + return result; 1.34017 + } 1.34018 + function addTraits(cls, flags) { 1.34019 + var includedMembers = [ 1.34020 + flags & Flags.INCLUDE_VARIABLES, 1.34021 + flags & Flags.INCLUDE_METHODS, 1.34022 + flags & Flags.INCLUDE_ACCESSORS, 1.34023 + flags & Flags.INCLUDE_ACCESSORS 1.34024 + ]; 1.34025 + var includeBases = flags & Flags.INCLUDE_BASES; 1.34026 + var includeMetadata = flags & Flags.INCLUDE_METADATA; 1.34027 + var obj = {}; 1.34028 + var basesVal = obj[publicName('bases')] = includeBases ? [] : null; 1.34029 + if (flags & Flags.INCLUDE_INTERFACES) { 1.34030 + var interfacesVal = obj[publicName('interfaces')] = []; 1.34031 + if (flags & Flags.USE_ITRAITS) { 1.34032 + for (var key in cls.implementedInterfaces) { 1.34033 + var ifaceName = cls.implementedInterfaces[key].name; 1.34034 + interfacesVal.push(unmangledQualifiedName(ifaceName)); 1.34035 + } 1.34036 + } 1.34037 + } else { 1.34038 + obj[publicName('interfaces')] = null; 1.34039 + } 1.34040 + var variablesVal = obj[publicName('variables')] = flags & Flags.INCLUDE_VARIABLES ? [] : null; 1.34041 + var accessorsVal = obj[publicName('accessors')] = flags & Flags.INCLUDE_ACCESSORS ? [] : null; 1.34042 + var methodsVal = obj[publicName('methods')] = flags & Flags.INCLUDE_METHODS ? [] : null; 1.34043 + var encounteredAccessors = {}; 1.34044 + var addBase = false; 1.34045 + while (cls) { 1.34046 + var className = unmangledQualifiedName(cls.classInfo.instanceInfo.name); 1.34047 + if (includeBases && addBase) { 1.34048 + basesVal.push(className); 1.34049 + } else { 1.34050 + addBase = true; 1.34051 + } 1.34052 + if (flags & Flags.USE_ITRAITS) { 1.34053 + describeTraits(cls.classInfo.instanceInfo.traits); 1.34054 + } else { 1.34055 + describeTraits(cls.classInfo.traits); 1.34056 + } 1.34057 + cls = cls.baseClass; 1.34058 + } 1.34059 + function describeTraits(traits) { 1.34060 + true; 1.34061 + for (var i = 0; traits && i < traits.length; i++) { 1.34062 + var t = traits[i]; 1.34063 + if (!includedMembers[t.kind] || !t.name.getNamespace().isPublic() && !t.name.uri) { 1.34064 + continue; 1.34065 + } 1.34066 + var name = unmangledQualifiedName(t.name); 1.34067 + if (encounteredAccessors[name]) { 1.34068 + var val = encounteredAccessors[name]; 1.34069 + val[accessKey] = 'readwrite'; 1.34070 + if (t.kind === TRAIT_Getter) { 1.34071 + val[typeKey] = unmangledQualifiedName(t.methodInfo.returnType); 1.34072 + } 1.34073 + continue; 1.34074 + } 1.34075 + var val = {}; 1.34076 + if (includeMetadata && t.metadata) { 1.34077 + var metadataVal = val[metadataKey] = []; 1.34078 + for (var key in t.metadata) { 1.34079 + metadataVal.push(describeMetadata(t.metadata[key])); 1.34080 + } 1.34081 + } else { 1.34082 + val[metadataKey] = null; 1.34083 + } 1.34084 + val[declaredByKey] = className; 1.34085 + val[uriKey] = t.name.uri === undefined ? null : t.name.uri; 1.34086 + val[nameKey] = name; 1.34087 + if (!t.typeName && !(t.methodInfo && t.methodInfo.returnType)) { 1.34088 + continue; 1.34089 + } 1.34090 + val[t.kind === TRAIT_Method ? returnTypeKey : typeKey] = unmangledQualifiedName(t.kind === TRAIT_Slot ? t.typeName : t.methodInfo.returnType); 1.34091 + switch (t.kind) { 1.34092 + case TRAIT_Slot: 1.34093 + val[accessKey] = 'readwrite'; 1.34094 + variablesVal.push(val); 1.34095 + break; 1.34096 + case TRAIT_Method: 1.34097 + var parametersVal = val[parametersKey] = []; 1.34098 + var parameters = t.methodInfo.parameters; 1.34099 + for (var j = 0; j < parameters.length; j++) { 1.34100 + var param = parameters[j]; 1.34101 + var paramVal = {}; 1.34102 + paramVal[typeKey] = param.type ? unmangledQualifiedName(param.type) : '*'; 1.34103 + paramVal[optionalKey] = 'value' in param; 1.34104 + parametersVal.push(paramVal); 1.34105 + } 1.34106 + methodsVal.push(val); 1.34107 + break; 1.34108 + case TRAIT_Getter: 1.34109 + case TRAIT_Setter: 1.34110 + val[accessKey] = t.kind === TRAIT_Getter ? 'read' : 'write'; 1.34111 + accessorsVal.push(val); 1.34112 + encounteredAccessors[name] = val; 1.34113 + break; 1.34114 + default: 1.34115 + break; 1.34116 + } 1.34117 + } 1.34118 + } 1.34119 + return obj; 1.34120 + } 1.34121 + } 1.34122 + }(); 1.34123 +function getNative(path) { 1.34124 + var chain = path.split('.'); 1.34125 + var v = natives; 1.34126 + for (var i = 0, j = chain.length; i < j; i++) { 1.34127 + v = v && v[chain[i]]; 1.34128 + } 1.34129 + true; 1.34130 + return v; 1.34131 +} 1.34132 +var disassemblerOptions = systemOptions.register(new OptionSet('Disassembler Options')); 1.34133 +var filter = disassemblerOptions.register(new Option('f', 'filter', 'string', 'SpciMsmNtu', '[S]ource, constant[p]ool, [c]lasses, [i]nstances, [M]etadata, [s]cripts, [m]ethods, multi[N]ames, S[t]atistics, [u]tf')); 1.34134 +function traceArray(writer, name, array, abc) { 1.34135 + if (array.length === 0) { 1.34136 + return; 1.34137 + } 1.34138 + writer.enter(name + ' {'); 1.34139 + array.forEach(function (a, idx) { 1.34140 + a.trace(writer, abc); 1.34141 + }); 1.34142 + writer.leave('}'); 1.34143 +} 1.34144 +AbcFile.prototype.trace = function trace(writer) { 1.34145 + if (filter.value.indexOf('p') >= 0) { 1.34146 + this.constantPool.trace(writer); 1.34147 + } 1.34148 + if (filter.value.indexOf('N') >= 0) { 1.34149 + this.constantPool.traceMultinamesOnly(writer); 1.34150 + } 1.34151 + if (filter.value.indexOf('c') >= 0) { 1.34152 + traceArray(writer, 'classes', this.classes); 1.34153 + } 1.34154 + if (filter.value.indexOf('i') >= 0) { 1.34155 + traceArray(writer, 'instances', this.instances); 1.34156 + } 1.34157 + if (filter.value.indexOf('M') >= 0) { 1.34158 + traceArray(writer, 'metadata', this.metadata); 1.34159 + } 1.34160 + if (filter.value.indexOf('s') >= 0) { 1.34161 + traceArray(writer, 'scripts', this.scripts); 1.34162 + } 1.34163 + if (filter.value.indexOf('m') >= 0) { 1.34164 + traceArray(writer, 'methods', this.methods, this); 1.34165 + } 1.34166 + if (filter.value.indexOf('S') >= 0) { 1.34167 + traceSource(writer, this); 1.34168 + } 1.34169 + if (filter.value.indexOf('t') >= 0) { 1.34170 + traceStatistics(writer, this); 1.34171 + } 1.34172 + if (filter.value.indexOf('u') >= 0) { 1.34173 + print(JSON.stringify({ 1.34174 + strings: this.constantPool.strings, 1.34175 + positionAfterUTFStrings: this.constantPool.positionAfterUTFStrings 1.34176 + }, null, 2)); 1.34177 + } 1.34178 +}; 1.34179 +ConstantPool.prototype.trace = function (writer) { 1.34180 + writer.enter('constantPool {'); 1.34181 + for (var key in this) { 1.34182 + if (key === 'namespaces') { 1.34183 + writer.enter('namespaces {'); 1.34184 + this.namespaces.forEach(function (ns, i) { 1.34185 + writer.writeLn(('' + i).padRight(' ', 3) + (ns ? ns.toString() : '*')); 1.34186 + }); 1.34187 + writer.leave('}'); 1.34188 + } else if (this[key] instanceof Array) { 1.34189 + writer.enter(key + ' ' + this[key].length + ' {'); 1.34190 + writer.writeArray(this[key]); 1.34191 + writer.leave('}'); 1.34192 + } 1.34193 + } 1.34194 + writer.leave('}'); 1.34195 +}; 1.34196 +ConstantPool.prototype.traceMultinamesOnly = function (writer) { 1.34197 + writer.writeArray(this.multinames, null, true); 1.34198 +}; 1.34199 +ClassInfo.prototype.trace = function (writer) { 1.34200 + writer.enter('class ' + this + ' {'); 1.34201 + traceArray(writer, 'traits', this.traits); 1.34202 + writer.leave('}'); 1.34203 +}; 1.34204 +MetaDataInfo.prototype.trace = function (writer) { 1.34205 + writer.enter(this + ' {'); 1.34206 + this.value.forEach(function (item) { 1.34207 + writer.writeLn((item.key ? item.key + ': ' : '') + '"' + item.value + '"'); 1.34208 + }); 1.34209 + writer.leave('}'); 1.34210 +}; 1.34211 +InstanceInfo.prototype.trace = function (writer) { 1.34212 + writer.enter('instance ' + this + ' {'); 1.34213 + traceArray(writer, 'traits', this.traits); 1.34214 + writer.leave('}'); 1.34215 +}; 1.34216 +ScriptInfo.prototype.trace = function (writer) { 1.34217 + writer.enter('script ' + this + ' {'); 1.34218 + traceArray(writer, 'traits', this.traits); 1.34219 + writer.leave('}'); 1.34220 +}; 1.34221 +Trait.prototype.trace = function (writer) { 1.34222 + if (this.metadata) { 1.34223 + for (var key in this.metadata) { 1.34224 + if (this.metadata.hasOwnProperty(key)) { 1.34225 + this.metadata[key].trace(writer); 1.34226 + } 1.34227 + } 1.34228 + } 1.34229 + writer.writeLn(this); 1.34230 +}; 1.34231 +function traceAbc(writer, abc) { 1.34232 + abc.trace(writer); 1.34233 +} 1.34234 +function traceOperand(operand, abc, code) { 1.34235 + var value = 0; 1.34236 + switch (operand.size) { 1.34237 + case 's08': 1.34238 + value = code.readS8(); 1.34239 + break; 1.34240 + case 'u08': 1.34241 + value = code.readU8(); 1.34242 + break; 1.34243 + case 's16': 1.34244 + value = code.readS16(); 1.34245 + break; 1.34246 + case 's24': 1.34247 + value = code.readS24(); 1.34248 + break; 1.34249 + case 'u30': 1.34250 + value = code.readU30(); 1.34251 + break; 1.34252 + case 'u32': 1.34253 + value = code.readU32(); 1.34254 + break; 1.34255 + default: 1.34256 + true; 1.34257 + break; 1.34258 + } 1.34259 + var description = ''; 1.34260 + switch (operand.type) { 1.34261 + case '': 1.34262 + break; 1.34263 + case 'I': 1.34264 + description = abc.constantPool.ints[value]; 1.34265 + break; 1.34266 + case 'U': 1.34267 + description = abc.constantPool.uints[value]; 1.34268 + break; 1.34269 + case 'D': 1.34270 + description = abc.constantPool.doubles[value]; 1.34271 + break; 1.34272 + case 'S': 1.34273 + description = abc.constantPool.strings[value]; 1.34274 + break; 1.34275 + case 'N': 1.34276 + description = abc.constantPool.namespaces[value]; 1.34277 + break; 1.34278 + case 'CI': 1.34279 + description = abc.classes[value]; 1.34280 + break; 1.34281 + case 'M': 1.34282 + return abc.constantPool.multinames[value]; 1.34283 + default: 1.34284 + description = '?'; 1.34285 + break; 1.34286 + } 1.34287 + return operand.name + ':' + value + (description === '' ? '' : ' (' + description + ')'); 1.34288 +} 1.34289 +function traceOperands(opcode, abc, code, rewind) { 1.34290 + rewind = rewind || false; 1.34291 + var old = code.position; 1.34292 + var str = ''; 1.34293 + if (opcode.operands === null) { 1.34294 + str = 'null'; 1.34295 + } else { 1.34296 + opcode.operands.forEach(function (op, i) { 1.34297 + str += traceOperand(op, abc, code); 1.34298 + if (i < opcode.operands.length - 1) { 1.34299 + str += ', '; 1.34300 + } 1.34301 + }); 1.34302 + } 1.34303 + if (rewind) { 1.34304 + code.seek(old); 1.34305 + } 1.34306 + return str; 1.34307 +} 1.34308 +MethodInfo.prototype.trace = function trace(writer) { 1.34309 + var abc = this.abc; 1.34310 + writer.enter('method' + (this.name ? ' ' + this.name : '') + ' {'); 1.34311 + writer.writeLn('flags: ' + getFlags(this.flags, 'NEED_ARGUMENTS|NEED_ACTIVATION|NEED_REST|HAS_OPTIONAL||NATIVE|SET_DXN|HAS_PARAM_NAMES'.split('|'))); 1.34312 + writer.writeLn('parameters: ' + this.parameters.map(function (x) { 1.34313 + return (x.type ? Multiname.getQualifiedName(x.type) + '::' : '') + x.name; 1.34314 + })); 1.34315 + if (!this.code) { 1.34316 + writer.leave('}'); 1.34317 + return; 1.34318 + } 1.34319 + var code = new AbcStream(this.code); 1.34320 + traceArray(writer, 'traits', this.traits); 1.34321 + writer.enter('code {'); 1.34322 + while (code.remaining() > 0) { 1.34323 + var bc = code.readU8(); 1.34324 + var opcode = opcodeTable[bc]; 1.34325 + var str, defaultOffset, offset, count; 1.34326 + str = ('' + code.position).padRight(' ', 6); 1.34327 + switch (bc) { 1.34328 + case OP_lookupswitch: 1.34329 + str += opcode.name + ': defaultOffset: ' + code.readS24(); 1.34330 + var caseCount = code.readU30(); 1.34331 + str += ', caseCount: ' + caseCount; 1.34332 + for (var i = 0; i < caseCount + 1; i++) { 1.34333 + str += ' offset: ' + code.readS24(); 1.34334 + } 1.34335 + writer.writeLn(str); 1.34336 + break; 1.34337 + default: 1.34338 + if (opcode) { 1.34339 + str += opcode.name.padRight(' ', 20); 1.34340 + if (!opcode.operands) { 1.34341 + true; 1.34342 + } else { 1.34343 + if (opcode.operands.length > 0) { 1.34344 + str += traceOperands(opcode, abc, code); 1.34345 + } 1.34346 + writer.writeLn(str); 1.34347 + } 1.34348 + } else { 1.34349 + true; 1.34350 + } 1.34351 + break; 1.34352 + } 1.34353 + } 1.34354 + writer.leave('}'); 1.34355 + writer.leave('}'); 1.34356 +}; 1.34357 +var SourceTracer = function () { 1.34358 + function literal(value) { 1.34359 + if (value === undefined) { 1.34360 + return 'undefined'; 1.34361 + } else if (value === null) { 1.34362 + return 'null'; 1.34363 + } else if (typeof value === 'string') { 1.34364 + return '"' + value + '"'; 1.34365 + } else { 1.34366 + return String(value); 1.34367 + } 1.34368 + } 1.34369 + function getSignature(mi, excludeTypesAndDefaultValues) { 1.34370 + return mi.parameters.map(function (x) { 1.34371 + var str = x.name; 1.34372 + if (!excludeTypesAndDefaultValues) { 1.34373 + if (x.type) { 1.34374 + str += ':' + x.type.getName(); 1.34375 + } 1.34376 + if (x.value !== undefined) { 1.34377 + str += ' = ' + literal(x.value); 1.34378 + } 1.34379 + } 1.34380 + return str; 1.34381 + }).join(', '); 1.34382 + } 1.34383 + function SourceTracer(writer) { 1.34384 + this.writer = writer; 1.34385 + } 1.34386 + SourceTracer.prototype = { 1.34387 + traceTraits: function traceTraits(traits, isStatic, inInterfaceNamespace) { 1.34388 + var writer = this.writer; 1.34389 + var tracer = this; 1.34390 + traits.forEach(function (trait) { 1.34391 + var str; 1.34392 + var accessModifier = Multiname.getAccessModifier(trait.name); 1.34393 + var namespaceName = trait.name.namespaces[0].uri; 1.34394 + if (namespaceName) { 1.34395 + if (namespaceName === 'http://adobe.com/AS3/2006/builtin') { 1.34396 + namespaceName = 'AS3'; 1.34397 + } 1.34398 + if (accessModifier === 'public') { 1.34399 + str = inInterfaceNamespace === namespaceName ? '' : namespaceName; 1.34400 + } else { 1.34401 + str = accessModifier; 1.34402 + } 1.34403 + } else { 1.34404 + str = accessModifier; 1.34405 + } 1.34406 + if (isStatic) { 1.34407 + str += ' static'; 1.34408 + } 1.34409 + if (trait.isSlot() || trait.isConst()) { 1.34410 + tracer.traceMetadata(trait.metadata); 1.34411 + if (trait.isConst()) { 1.34412 + str += ' const'; 1.34413 + } else { 1.34414 + str += ' var'; 1.34415 + } 1.34416 + str += ' ' + trait.name.getName(); 1.34417 + if (trait.typeName) { 1.34418 + str += ':' + trait.typeName.getName(); 1.34419 + } 1.34420 + if (trait.value) { 1.34421 + str += ' = ' + literal(trait.value); 1.34422 + } 1.34423 + writer.writeLn(str + ';'); 1.34424 + } else if (trait.isMethod() || trait.isGetter() || trait.isSetter()) { 1.34425 + tracer.traceMetadata(trait.metadata); 1.34426 + var mi = trait.methodInfo; 1.34427 + if (trait.attributes & ATTR_Override) { 1.34428 + str += ' override'; 1.34429 + } 1.34430 + if (mi.isNative()) { 1.34431 + str += ' native'; 1.34432 + } 1.34433 + str += ' function'; 1.34434 + str += trait.isGetter() ? ' get' : trait.isSetter() ? ' set' : ''; 1.34435 + str += ' ' + trait.name.getName(); 1.34436 + str += '(' + getSignature(mi) + ')'; 1.34437 + str += mi.returnType ? ':' + mi.returnType.getName() : ''; 1.34438 + if (true) { 1.34439 + var className; 1.34440 + var prefix = ''; 1.34441 + if (trait.holder instanceof ClassInfo) { 1.34442 + className = trait.holder.instanceInfo.name; 1.34443 + if (className.namespaces[0].uri) { 1.34444 + prefix += className.namespaces[0].uri + '::'; 1.34445 + } 1.34446 + prefix += className.getName(); 1.34447 + prefix += '$/'; 1.34448 + } else if (trait.holder instanceof InstanceInfo) { 1.34449 + className = trait.holder.name; 1.34450 + if (className.namespaces[0].uri) { 1.34451 + prefix += className.namespaces[0].uri + '::'; 1.34452 + } 1.34453 + prefix += className.getName(); 1.34454 + prefix += '/'; 1.34455 + } else { 1.34456 + prefix = 'global/'; 1.34457 + } 1.34458 + var getSet = trait.isGetter() ? 'get ' : trait.isSetter() ? 'set ' : ''; 1.34459 + if (!mi.isNative()) { 1.34460 + } 1.34461 + } 1.34462 + if (mi.isNative()) { 1.34463 + writer.writeLn(str + ';'); 1.34464 + } else { 1.34465 + if (inInterfaceNamespace) { 1.34466 + writer.writeLn(str + ';'); 1.34467 + } else { 1.34468 + writer.writeLn(str + ' { notImplemented("' + trait.name.getName() + '"); }'); 1.34469 + } 1.34470 + } 1.34471 + } else if (trait.isClass()) { 1.34472 + var className = trait.classInfo.instanceInfo.name; 1.34473 + writer.enter('package ' + className.namespaces[0].uri + ' {\n'); 1.34474 + tracer.traceMetadata(trait.metadata); 1.34475 + tracer.traceClass(trait.classInfo); 1.34476 + writer.leave('\n}'); 1.34477 + tracer.traceClassStub(trait); 1.34478 + } else { 1.34479 + notImplemented(); 1.34480 + } 1.34481 + }); 1.34482 + }, 1.34483 + traceClassStub2: function traceClassStub(trait) { 1.34484 + var writer = this.writer; 1.34485 + var ci = trait.classInfo; 1.34486 + var ii = ci.instanceInfo; 1.34487 + var name = ii.name.getName(); 1.34488 + var native = trait.metadata ? trait.metadata.native : null; 1.34489 + if (!native) { 1.34490 + return false; 1.34491 + } 1.34492 + writer.writeLn('Cut and paste the following into `native.js\' and edit accordingly'); 1.34493 + writer.writeLn('8< --------------------------------------------------------------'); 1.34494 + writer.enter('natives.' + native.cls + ' = function ' + native.cls + '(runtime, scope, instanceConstructor, baseClass) {'); 1.34495 + writer.writeLn('var c = new Class("' + name + '", instanceConstructor, ApplicationDomain.passthroughCallable(instanceConstructor));'); 1.34496 + writer.writeLn('c.extend(baseClass);\n'); 1.34497 + function traceTraits(traits, isStatic) { 1.34498 + var nativeMethodTraits = []; 1.34499 + traits.forEach(function (trait, i) { 1.34500 + if (trait.isMethod() || trait.isGetter() || trait.isSetter()) { 1.34501 + if (trait.methodInfo.isNative()) { 1.34502 + nativeMethodTraits.push(trait); 1.34503 + } 1.34504 + } 1.34505 + }); 1.34506 + nativeMethodTraits.forEach(function (trait, i) { 1.34507 + var mi = trait.methodInfo; 1.34508 + var traitName = trait.name.getName(); 1.34509 + writer.writeLn('// ' + traitName + ' :: ' + (mi.parameters.length ? getSignature(mi) : 'void') + ' -> ' + (mi.returnType ? mi.returnType.getName() : 'any')); 1.34510 + var prop; 1.34511 + if (trait.isGetter()) { 1.34512 + prop = '"get ' + traitName + '"'; 1.34513 + } else if (trait.isSetter()) { 1.34514 + prop = '"set ' + traitName + '"'; 1.34515 + } else { 1.34516 + prop = traitName; 1.34517 + } 1.34518 + writer.enter(prop + ': function ' + traitName + '(' + getSignature(mi, true) + ') {'); 1.34519 + writer.writeLn(' notImplemented("' + name + '.' + traitName + '");'); 1.34520 + writer.leave('}' + (i === nativeMethodTraits.length - 1 ? '' : ',\n')); 1.34521 + }); 1.34522 + } 1.34523 + writer.enter('c.nativeStatics = {'); 1.34524 + traceTraits(ci.traits, true); 1.34525 + writer.leave('};\n'); 1.34526 + writer.enter('c.nativeMethods = {'); 1.34527 + traceTraits(ii.traits); 1.34528 + writer.leave('};\n'); 1.34529 + writer.writeLn('return c;'); 1.34530 + writer.leave('};'); 1.34531 + writer.writeLn('-------------------------------------------------------------- >8'); 1.34532 + return true; 1.34533 + }, 1.34534 + traceClassStub: function traceClassStub(trait) { 1.34535 + var writer = this.writer; 1.34536 + var ci = trait.classInfo; 1.34537 + var ii = ci.instanceInfo; 1.34538 + var className = ii.name.getName(); 1.34539 + var native = trait.metadata ? trait.metadata.native : null; 1.34540 + writer.writeLn('Cut and paste the following glue and edit accordingly.'); 1.34541 + writer.writeLn('Class ' + ii); 1.34542 + writer.writeLn('8< --------------------------------------------------------------'); 1.34543 + var uri = ii.name.namespaces[0].uri; 1.34544 + writer.enter('var ' + className + 'Definition = (function () {'); 1.34545 + function maxTraitNameLength(traits) { 1.34546 + var length = 0; 1.34547 + traits.forEach(function (t) { 1.34548 + length = Math.max(t.name.name.length, length); 1.34549 + }); 1.34550 + return length; 1.34551 + } 1.34552 + function quote(s) { 1.34553 + return '\'' + s + '\''; 1.34554 + } 1.34555 + function filterTraits(traits, isNative) { 1.34556 + function isMethod(x) { 1.34557 + return x.isMethod() || x.isGetter() || x.isSetter(); 1.34558 + } 1.34559 + return { 1.34560 + properties: traits.filter(function (trait) { 1.34561 + return !isNative && !isMethod(trait); 1.34562 + }), 1.34563 + methods: traits.filter(function (trait) { 1.34564 + return isMethod(trait) && isNative === trait.methodInfo.isNative(); 1.34565 + }) 1.34566 + }; 1.34567 + } 1.34568 + function writeTraits(traits, isNative, isStatic) { 1.34569 + traits = filterTraits(traits, isNative); 1.34570 + var methods = []; 1.34571 + var gettersAndSetters = createEmptyObject(); 1.34572 + traits.methods.forEach(function (trait, i) { 1.34573 + var traitName = trait.name.getName(); 1.34574 + if (trait.isGetter() || trait.isSetter()) { 1.34575 + if (!gettersAndSetters[traitName]) { 1.34576 + gettersAndSetters[traitName] = []; 1.34577 + } 1.34578 + gettersAndSetters[traitName].push(trait); 1.34579 + } else { 1.34580 + methods.push(trait); 1.34581 + } 1.34582 + }); 1.34583 + function writeTrait(trait, writeComma) { 1.34584 + var mi = trait.methodInfo; 1.34585 + var traitName = trait.name.getName(); 1.34586 + var signature = '// (' + (mi.parameters.length ? getSignature(mi) : 'void') + ') -> ' + (mi.returnType ? mi.returnType.getName() : 'any'); 1.34587 + var propertyName = traitName; 1.34588 + if (trait.isGetter()) { 1.34589 + propertyName = 'get'; 1.34590 + } else if (trait.isSetter()) { 1.34591 + propertyName = 'set'; 1.34592 + } 1.34593 + writer.enter(propertyName + ': function ' + traitName + '(' + getSignature(mi, true) + ') { ' + signature); 1.34594 + writer.writeLn('notImplemented("' + className + '.' + traitName + '");'); 1.34595 + if (!isStatic) { 1.34596 + if (trait.isGetter()) { 1.34597 + writer.writeLn('return this._' + traitName + ';'); 1.34598 + } else if (trait.isSetter()) { 1.34599 + writer.writeLn('this._' + traitName + ' = ' + mi.parameters[0].name + ';'); 1.34600 + } 1.34601 + } 1.34602 + writer.leave('}' + (writeComma ? ',' : '')); 1.34603 + } 1.34604 + for (var i = 0; i < methods.length; i++) { 1.34605 + writeTrait(methods[i], i < methods.length - 1); 1.34606 + } 1.34607 + var keyValues = toKeyValueArray(gettersAndSetters); 1.34608 + for (var j = 0; j < keyValues.length; j++) { 1.34609 + writer.enter(keyValues[j][0] + ': {'); 1.34610 + var list = keyValues[j][1]; 1.34611 + for (var i = 0; i < list.length; i++) { 1.34612 + writeTrait(list[i], i < list.length - 1); 1.34613 + } 1.34614 + writer.leave('}' + (j < keyValues.length - 1 ? ',' : '')); 1.34615 + } 1.34616 + traits.properties.forEach(function (trait, i) { 1.34617 + var traitName = trait.name.getName(); 1.34618 + var last = i === traits.properties.length - 1; 1.34619 + if (trait.name.getNamespace().isPublic()) { 1.34620 + writer.writeLn(traitName + ': ' + quote('public ' + trait.name.name) + (last ? '' : ',')); 1.34621 + } 1.34622 + }); 1.34623 + } 1.34624 + writer.enter('return {'); 1.34625 + writer.writeLn('// (' + getSignature(ii.init, false) + ')'); 1.34626 + writer.writeLn('__class__: "' + uri + '.' + className + '",'); 1.34627 + writer.enter('initialize: function () {'); 1.34628 + writer.leave('},'); 1.34629 + writer.enter('__glue__: {'); 1.34630 + writer.enter('native: {'); 1.34631 + writer.enter('static: {'); 1.34632 + writeTraits(ci.traits, true, true); 1.34633 + writer.leave('},'); 1.34634 + writer.enter('instance: {'); 1.34635 + writeTraits(ii.traits, true); 1.34636 + writer.leave('}'); 1.34637 + writer.leave('},'); 1.34638 + writer.enter('script: {'); 1.34639 + writer.writeLn('instance: Glue.ALL'); 1.34640 + writer.leave('}'); 1.34641 + writer.leave('}'); 1.34642 + writer.leave('};'); 1.34643 + writer.leave('}).call(this);'); 1.34644 + writer.writeLn('-------------------------------------------------------------- >8'); 1.34645 + return true; 1.34646 + }, 1.34647 + traceClass: function traceClass(ci) { 1.34648 + var writer = this.writer; 1.34649 + var ii = ci.instanceInfo; 1.34650 + var name = ii.name; 1.34651 + var str = Multiname.getAccessModifier(name); 1.34652 + if (ii.isFinal()) { 1.34653 + str += ' final'; 1.34654 + } 1.34655 + if (!ii.isSealed()) { 1.34656 + str += ' dynamic'; 1.34657 + } 1.34658 + str += ii.isInterface() ? ' interface ' : ' class '; 1.34659 + str += name.getName(); 1.34660 + if (ii.superName && ii.superName.getName() !== 'Object') { 1.34661 + str += ' extends ' + ii.superName.getName(); 1.34662 + } 1.34663 + if (ii.interfaces.length) { 1.34664 + str += ' implements ' + ii.interfaces.map(function (x) { 1.34665 + return x.getName(); 1.34666 + }).join(', '); 1.34667 + } 1.34668 + writer.enter(str + ' {'); 1.34669 + if (!ii.isInterface()) { 1.34670 + writer.writeLn('public function ' + name.getName() + '(' + getSignature(ii.init) + ') {}'); 1.34671 + } 1.34672 + var interfaceNamespace; 1.34673 + if (ii.isInterface()) { 1.34674 + interfaceNamespace = name.namespaces[0].uri + ':' + name.name; 1.34675 + } 1.34676 + this.traceTraits(ci.traits, true, interfaceNamespace); 1.34677 + this.traceTraits(ii.traits, false, interfaceNamespace); 1.34678 + writer.leave('}'); 1.34679 + }, 1.34680 + traceMetadata: function traceMetadata(metadata) { 1.34681 + var writer = this.writer; 1.34682 + for (var key in metadata) { 1.34683 + if (metadata.hasOwnProperty(key)) { 1.34684 + if (key.indexOf('__') === 0) { 1.34685 + continue; 1.34686 + } 1.34687 + writer.writeLn('[' + key + '(' + metadata[key].value.map(function (m) { 1.34688 + var str = m.key ? m.key + '=' : ''; 1.34689 + return str + '"' + m.value + '"'; 1.34690 + }).join(', ') + ')]'); 1.34691 + } 1.34692 + } 1.34693 + } 1.34694 + }; 1.34695 + return SourceTracer; 1.34696 + }(); 1.34697 +function traceSource(writer, abc) { 1.34698 + var tracer = new SourceTracer(writer); 1.34699 + abc.scripts.forEach(function (script) { 1.34700 + tracer.traceTraits(script.traits); 1.34701 + }); 1.34702 +} 1.34703 +function traceStatistics(writer, abc) { 1.34704 + var libraryClassCounter = new Shumway.Metrics.Counter(true); 1.34705 + var librarySuperClassCounter = new Shumway.Metrics.Counter(true); 1.34706 + var libraryMethodCounter = new Shumway.Metrics.Counter(true); 1.34707 + var libraryProperties = new Shumway.Metrics.Counter(true); 1.34708 + var definedClasses = {}; 1.34709 + var definedMethods = {}; 1.34710 + var definedProperties = {}; 1.34711 + abc.classes.forEach(function (x) { 1.34712 + var className = x.instanceInfo.name.name; 1.34713 + definedClasses[className] = true; 1.34714 + }); 1.34715 + abc.scripts.forEach(function (s) { 1.34716 + s.traits.forEach(function (t) { 1.34717 + if (t.isClass()) { 1.34718 + var superClassName = t.classInfo.instanceInfo.superName ? t.classInfo.instanceInfo.superName.name : '?'; 1.34719 + if (!(superClassName in definedClasses)) { 1.34720 + librarySuperClassCounter.count(superClassName); 1.34721 + } 1.34722 + t.classInfo.traits.forEach(function (st) { 1.34723 + if (st.isMethod()) { 1.34724 + definedMethods[st.name.name] = true; 1.34725 + } else { 1.34726 + definedProperties[st.name.name] = true; 1.34727 + } 1.34728 + }); 1.34729 + t.classInfo.instanceInfo.traits.forEach(function (it) { 1.34730 + if (it.isMethod() && !(it.attributes & ATTR_Override)) { 1.34731 + definedMethods[it.name.name] = true; 1.34732 + } else { 1.34733 + definedProperties[it.name.name] = true; 1.34734 + } 1.34735 + }); 1.34736 + } 1.34737 + }); 1.34738 + }); 1.34739 + var opCounter = new Shumway.Metrics.Counter(true); 1.34740 + abc.methods.forEach(function (m) { 1.34741 + if (!m.code) { 1.34742 + return; 1.34743 + } 1.34744 + function readOperand(operand) { 1.34745 + var value = 0; 1.34746 + switch (operand.size) { 1.34747 + case 's08': 1.34748 + value = code.readS8(); 1.34749 + break; 1.34750 + case 'u08': 1.34751 + value = code.readU8(); 1.34752 + break; 1.34753 + case 's16': 1.34754 + value = code.readS16(); 1.34755 + break; 1.34756 + case 's24': 1.34757 + value = code.readS24(); 1.34758 + break; 1.34759 + case 'u30': 1.34760 + value = code.readU30(); 1.34761 + break; 1.34762 + case 'u32': 1.34763 + value = code.readU32(); 1.34764 + break; 1.34765 + default: 1.34766 + true; 1.34767 + break; 1.34768 + } 1.34769 + var description = ''; 1.34770 + switch (operand.type) { 1.34771 + case '': 1.34772 + break; 1.34773 + case 'I': 1.34774 + description = abc.constantPool.ints[value]; 1.34775 + break; 1.34776 + case 'U': 1.34777 + description = abc.constantPool.uints[value]; 1.34778 + break; 1.34779 + case 'D': 1.34780 + description = abc.constantPool.doubles[value]; 1.34781 + break; 1.34782 + case 'S': 1.34783 + description = abc.constantPool.strings[value]; 1.34784 + break; 1.34785 + case 'N': 1.34786 + description = abc.constantPool.namespaces[value]; 1.34787 + break; 1.34788 + case 'CI': 1.34789 + description = abc.classes[value]; 1.34790 + break; 1.34791 + case 'M': 1.34792 + description = abc.constantPool.multinames[value]; 1.34793 + break; 1.34794 + default: 1.34795 + description = '?'; 1.34796 + break; 1.34797 + } 1.34798 + return description; 1.34799 + } 1.34800 + var code = new AbcStream(m.code); 1.34801 + while (code.remaining() > 0) { 1.34802 + var bc = code.readU8(); 1.34803 + var op = opcodeTable[bc]; 1.34804 + var operands = null; 1.34805 + if (op) { 1.34806 + opCounter.count(op.name); 1.34807 + if (op.operands) { 1.34808 + operands = op.operands.map(readOperand); 1.34809 + } 1.34810 + switch (bc) { 1.34811 + case OP_call: 1.34812 + case OP_callmethod: 1.34813 + continue; 1.34814 + case OP_callproperty: 1.34815 + case OP_callproplex: 1.34816 + case OP_callpropvoid: 1.34817 + case OP_callstatic: 1.34818 + case OP_callsuper: 1.34819 + case OP_callsupervoid: 1.34820 + if (operands[0] && !(operands[0].name in definedMethods)) { 1.34821 + libraryMethodCounter.count(operands[0].name); 1.34822 + } 1.34823 + break; 1.34824 + case OP_constructprop: 1.34825 + if (operands[0] && !(operands[0].name in definedClasses)) { 1.34826 + libraryClassCounter.count(operands[0].name); 1.34827 + } 1.34828 + break; 1.34829 + case OP_getproperty: 1.34830 + case OP_setproperty: 1.34831 + if (operands[0] && !(operands[0].name in definedProperties)) { 1.34832 + libraryProperties.count(operands[0].name); 1.34833 + } 1.34834 + break; 1.34835 + } 1.34836 + } 1.34837 + } 1.34838 + }); 1.34839 + writer.writeLn(JSON.stringify({ 1.34840 + definedClasses: definedClasses, 1.34841 + definedMethods: definedMethods, 1.34842 + definedProperties: definedProperties, 1.34843 + libraryClasses: libraryClassCounter.counts, 1.34844 + librarySuperClasses: librarySuperClassCounter.counts, 1.34845 + libraryMethods: libraryMethodCounter.counts, 1.34846 + libraryProperties: libraryProperties.counts, 1.34847 + operations: opCounter.counts 1.34848 + }, null, 2)); 1.34849 +} 1.34850 +var Shumway; 1.34851 +(function (Shumway) { 1.34852 + (function (AVM2) { 1.34853 + var OP = Shumway.AVM2.ABC.OP; 1.34854 + var Scope = Shumway.AVM2.Runtime.Scope; 1.34855 + var asCoerceByMultiname = Shumway.AVM2.Runtime.asCoerceByMultiname; 1.34856 + var asGetSlot = Shumway.AVM2.Runtime.asGetSlot; 1.34857 + var asSetSlot = Shumway.AVM2.Runtime.asSetSlot; 1.34858 + var asHasNext2 = Shumway.AVM2.Runtime.asHasNext2; 1.34859 + var asCoerce = Shumway.AVM2.Runtime.asCoerce; 1.34860 + var asCoerceString = Shumway.AVM2.Runtime.asCoerceString; 1.34861 + var asAsType = Shumway.AVM2.Runtime.asAsType; 1.34862 + var asTypeOf = Shumway.AVM2.Runtime.asTypeOf; 1.34863 + var asIsInstanceOf = Shumway.AVM2.Runtime.asIsInstanceOf; 1.34864 + var asIsType = Shumway.AVM2.Runtime.asIsType; 1.34865 + var applyType = Shumway.AVM2.Runtime.applyType; 1.34866 + var createFunction = Shumway.AVM2.Runtime.createFunction; 1.34867 + var createClass = Shumway.AVM2.Runtime.createClass; 1.34868 + var getDescendants = Shumway.AVM2.Runtime.getDescendants; 1.34869 + var checkFilter = Shumway.AVM2.Runtime.checkFilter; 1.34870 + var asAdd = Shumway.AVM2.Runtime.asAdd; 1.34871 + var translateError = Shumway.AVM2.Runtime.translateError; 1.34872 + var asCreateActivation = Shumway.AVM2.Runtime.asCreateActivation; 1.34873 + var sliceArguments = Shumway.AVM2.Runtime.sliceArguments; 1.34874 + var boxValue = Shumway.ObjectUtilities.boxValue; 1.34875 + var popManyInto = Shumway.ArrayUtilities.popManyInto; 1.34876 + var construct = Shumway.AVM2.Runtime.construct; 1.34877 + var Multiname = Shumway.AVM2.ABC.Multiname; 1.34878 + var ScopeStack = function () { 1.34879 + function ScopeStack(parent) { 1.34880 + this.parent = parent; 1.34881 + this.stack = []; 1.34882 + this.isWith = []; 1.34883 + } 1.34884 + ScopeStack.prototype.push = function (object, isWith) { 1.34885 + this.stack.push(object); 1.34886 + this.isWith.push(!(!isWith)); 1.34887 + }; 1.34888 + ScopeStack.prototype.get = function (index) { 1.34889 + return this.stack[index]; 1.34890 + }; 1.34891 + ScopeStack.prototype.clear = function () { 1.34892 + this.stack.length = 0; 1.34893 + this.isWith.length = 0; 1.34894 + }; 1.34895 + ScopeStack.prototype.pop = function () { 1.34896 + this.isWith.pop(); 1.34897 + this.stack.pop(); 1.34898 + }; 1.34899 + ScopeStack.prototype.topScope = function () { 1.34900 + if (!this.scopes) { 1.34901 + this.scopes = []; 1.34902 + } 1.34903 + var parent = this.parent; 1.34904 + for (var i = 0; i < this.stack.length; i++) { 1.34905 + var object = this.stack[i], isWith = this.isWith[i], scope = this.scopes[i]; 1.34906 + if (!scope || scope.parent !== parent || scope.object !== object || scope.isWith !== isWith) { 1.34907 + scope = this.scopes[i] = new Scope(parent, object, isWith); 1.34908 + } 1.34909 + parent = scope; 1.34910 + } 1.34911 + return parent; 1.34912 + }; 1.34913 + return ScopeStack; 1.34914 + }(); 1.34915 + function popNameInto(stack, mn, out) { 1.34916 + out.flags = mn.flags; 1.34917 + if (mn.isRuntimeName()) { 1.34918 + out.name = stack.pop(); 1.34919 + } else { 1.34920 + out.name = mn.name; 1.34921 + } 1.34922 + if (mn.isRuntimeNamespace()) { 1.34923 + out.namespaces = [ 1.34924 + stack.pop() 1.34925 + ]; 1.34926 + } else { 1.34927 + out.namespaces = mn.namespaces; 1.34928 + } 1.34929 + } 1.34930 + var Interpreter = function () { 1.34931 + function Interpreter() { 1.34932 + } 1.34933 + Interpreter.interpretMethod = function ($this, method, savedScope, methodArgs) { 1.34934 + true; 1.34935 + Counter.count('Interpret Method'); 1.34936 + var abc = method.abc; 1.34937 + var ints = abc.constantPool.ints; 1.34938 + var uints = abc.constantPool.uints; 1.34939 + var doubles = abc.constantPool.doubles; 1.34940 + var strings = abc.constantPool.strings; 1.34941 + var methods = abc.methods; 1.34942 + var multinames = abc.constantPool.multinames; 1.34943 + var domain = abc.applicationDomain; 1.34944 + var exceptions = method.exceptions; 1.34945 + var locals = [ 1.34946 + $this 1.34947 + ]; 1.34948 + var stack = [], scopeStack = new ScopeStack(savedScope); 1.34949 + var parameterCount = method.parameters.length; 1.34950 + var argCount = methodArgs.length; 1.34951 + var value; 1.34952 + for (var i = 0; i < parameterCount; i++) { 1.34953 + var parameter = method.parameters[i]; 1.34954 + if (i < argCount) { 1.34955 + value = methodArgs[i]; 1.34956 + } else { 1.34957 + value = parameter.value; 1.34958 + } 1.34959 + if (parameter.type && !parameter.type.isAnyName()) { 1.34960 + value = asCoerceByMultiname(domain, parameter.type, value); 1.34961 + } 1.34962 + locals.push(value); 1.34963 + } 1.34964 + if (method.needsRest()) { 1.34965 + locals.push(sliceArguments(methodArgs, parameterCount)); 1.34966 + } else if (method.needsArguments()) { 1.34967 + locals.push(sliceArguments(methodArgs, 0)); 1.34968 + } 1.34969 + var bytecodes = method.analysis.bytecodes; 1.34970 + var object, index, multiname, result, a, b, args = [], mn = Multiname.TEMPORARY; 1.34971 + interpretLabel: 1.34972 + for (var pc = 0, end = bytecodes.length; pc < end;) { 1.34973 + try { 1.34974 + var bc = bytecodes[pc]; 1.34975 + var op = bc.op; 1.34976 + switch (op | 0) { 1.34977 + case 3: 1.34978 + throw stack.pop(); 1.34979 + case 4: 1.34980 + popNameInto(stack, multinames[bc.index], mn); 1.34981 + stack.push(stack.pop().asGetSuper(savedScope, mn.namespaces, mn.name, mn.flags)); 1.34982 + break; 1.34983 + case 5: 1.34984 + value = stack.pop(); 1.34985 + popNameInto(stack, multinames[bc.index], mn); 1.34986 + stack.pop().asSetSuper(savedScope, mn.namespaces, mn.name, mn.flags, value); 1.34987 + break; 1.34988 + case 8: 1.34989 + locals[bc.index] = undefined; 1.34990 + break; 1.34991 + case 12: 1.34992 + b = stack.pop(); 1.34993 + a = stack.pop(); 1.34994 + pc = !(a < b) ? bc.offset : pc + 1; 1.34995 + continue; 1.34996 + case 24: 1.34997 + b = stack.pop(); 1.34998 + a = stack.pop(); 1.34999 + pc = a >= b ? bc.offset : pc + 1; 1.35000 + continue; 1.35001 + case 13: 1.35002 + b = stack.pop(); 1.35003 + a = stack.pop(); 1.35004 + pc = !(a <= b) ? bc.offset : pc + 1; 1.35005 + continue; 1.35006 + case 23: 1.35007 + b = stack.pop(); 1.35008 + a = stack.pop(); 1.35009 + pc = a > b ? bc.offset : pc + 1; 1.35010 + continue; 1.35011 + case 14: 1.35012 + b = stack.pop(); 1.35013 + a = stack.pop(); 1.35014 + pc = !(a > b) ? bc.offset : pc + 1; 1.35015 + continue; 1.35016 + case 22: 1.35017 + b = stack.pop(); 1.35018 + a = stack.pop(); 1.35019 + pc = a <= b ? bc.offset : pc + 1; 1.35020 + continue; 1.35021 + case 15: 1.35022 + b = stack.pop(); 1.35023 + a = stack.pop(); 1.35024 + pc = !(a >= b) ? bc.offset : pc + 1; 1.35025 + continue; 1.35026 + case 21: 1.35027 + b = stack.pop(); 1.35028 + a = stack.pop(); 1.35029 + pc = a < b ? bc.offset : pc + 1; 1.35030 + continue; 1.35031 + case 16: 1.35032 + pc = bc.offset; 1.35033 + continue; 1.35034 + case 17: 1.35035 + pc = !(!stack.pop()) ? bc.offset : pc + 1; 1.35036 + continue; 1.35037 + case 18: 1.35038 + pc = !stack.pop() ? bc.offset : pc + 1; 1.35039 + continue; 1.35040 + case 19: 1.35041 + b = stack.pop(); 1.35042 + a = stack.pop(); 1.35043 + pc = a == b ? bc.offset : pc + 1; 1.35044 + continue; 1.35045 + case 20: 1.35046 + b = stack.pop(); 1.35047 + a = stack.pop(); 1.35048 + pc = a != b ? bc.offset : pc + 1; 1.35049 + continue; 1.35050 + case 25: 1.35051 + b = stack.pop(); 1.35052 + a = stack.pop(); 1.35053 + pc = a === b ? bc.offset : pc + 1; 1.35054 + continue; 1.35055 + case 26: 1.35056 + b = stack.pop(); 1.35057 + a = stack.pop(); 1.35058 + pc = a !== b ? bc.offset : pc + 1; 1.35059 + continue; 1.35060 + case 27: 1.35061 + index = stack.pop(); 1.35062 + if (index < 0 || index >= bc.offsets.length) { 1.35063 + index = bc.offsets.length - 1; 1.35064 + } 1.35065 + pc = bc.offsets[index]; 1.35066 + continue; 1.35067 + case 28: 1.35068 + scopeStack.push(boxValue(stack.pop()), true); 1.35069 + break; 1.35070 + case 29: 1.35071 + scopeStack.pop(); 1.35072 + break; 1.35073 + case 30: 1.35074 + index = stack.pop(); 1.35075 + stack[stack.length - 1] = boxValue(stack[stack.length - 1]).asNextName(index); 1.35076 + break; 1.35077 + case 35: 1.35078 + index = stack.pop(); 1.35079 + stack[stack.length - 1] = boxValue(stack[stack.length - 1]).asNextValue(index); 1.35080 + break; 1.35081 + case 50: 1.35082 + result = asHasNext2(locals[bc.object], locals[bc.index]); 1.35083 + locals[bc.object] = result.object; 1.35084 + locals[bc.index] = result.index; 1.35085 + stack.push(!(!result.index)); 1.35086 + break; 1.35087 + case 32: 1.35088 + stack.push(null); 1.35089 + break; 1.35090 + case 33: 1.35091 + stack.push(undefined); 1.35092 + break; 1.35093 + case 36: 1.35094 + case 37: 1.35095 + stack.push(bc.value); 1.35096 + break; 1.35097 + case 44: 1.35098 + stack.push(strings[bc.index]); 1.35099 + break; 1.35100 + case 45: 1.35101 + stack.push(ints[bc.index]); 1.35102 + break; 1.35103 + case 46: 1.35104 + stack.push(uints[bc.index]); 1.35105 + break; 1.35106 + case 47: 1.35107 + stack.push(doubles[bc.index]); 1.35108 + break; 1.35109 + case 38: 1.35110 + stack.push(true); 1.35111 + break; 1.35112 + case 39: 1.35113 + stack.push(false); 1.35114 + break; 1.35115 + case 40: 1.35116 + stack.push(NaN); 1.35117 + break; 1.35118 + case 41: 1.35119 + stack.pop(); 1.35120 + break; 1.35121 + case 42: 1.35122 + stack.push(stack[stack.length - 1]); 1.35123 + break; 1.35124 + case 43: 1.35125 + object = stack[stack.length - 1]; 1.35126 + stack[stack.length - 1] = stack[stack.length - 2]; 1.35127 + stack[stack.length - 2] = object; 1.35128 + break; 1.35129 + case 48: 1.35130 + scopeStack.push(boxValue(stack.pop()), false); 1.35131 + break; 1.35132 + case 64: 1.35133 + stack.push(createFunction(methods[bc.index], scopeStack.topScope(), true)); 1.35134 + break; 1.35135 + case 65: 1.35136 + popManyInto(stack, bc.argCount, args); 1.35137 + object = stack.pop(); 1.35138 + stack[stack.length - 1] = stack[stack.length - 1].apply(object, args); 1.35139 + break; 1.35140 + case 66: 1.35141 + popManyInto(stack, bc.argCount, args); 1.35142 + stack[stack.length - 1] = construct(stack[stack.length - 1], args); 1.35143 + break; 1.35144 + case 71: 1.35145 + return; 1.35146 + case 72: 1.35147 + if (method.returnType) { 1.35148 + return asCoerceByMultiname(domain, method.returnType, stack.pop()); 1.35149 + } 1.35150 + return stack.pop(); 1.35151 + case 73: 1.35152 + popManyInto(stack, bc.argCount, args); 1.35153 + object = stack.pop(); 1.35154 + savedScope.object.baseClass.instanceConstructorNoInitialize.apply(object, args); 1.35155 + break; 1.35156 + case 74: 1.35157 + popManyInto(stack, bc.argCount, args); 1.35158 + popNameInto(stack, multinames[bc.index], mn); 1.35159 + object = boxValue(stack[stack.length - 1]); 1.35160 + object = object.asConstructProperty(mn.namespaces, mn.name, mn.flags, args); 1.35161 + stack[stack.length - 1] = object; 1.35162 + break; 1.35163 + case 75: 1.35164 + Shumway.Debug.notImplemented('OP.callsuperid'); 1.35165 + break; 1.35166 + case 76: 1.35167 + case 70: 1.35168 + case 79: 1.35169 + popManyInto(stack, bc.argCount, args); 1.35170 + popNameInto(stack, multinames[bc.index], mn); 1.35171 + result = boxValue(stack.pop()).asCallProperty(mn.namespaces, mn.name, mn.flags, op === 76, args); 1.35172 + if (op !== 79) { 1.35173 + stack.push(result); 1.35174 + } 1.35175 + break; 1.35176 + case 69: 1.35177 + case 78: 1.35178 + popManyInto(stack, bc.argCount, args); 1.35179 + popNameInto(stack, multinames[bc.index], mn); 1.35180 + result = stack.pop().asCallSuper(savedScope, mn.namespaces, mn.name, mn.flags, args); 1.35181 + if (op !== 78) { 1.35182 + stack.push(result); 1.35183 + } 1.35184 + break; 1.35185 + case 83: 1.35186 + popManyInto(stack, bc.argCount, args); 1.35187 + stack[stack.length - 1] = applyType(domain, stack[stack.length - 1], args); 1.35188 + break; 1.35189 + case 85: 1.35190 + object = {}; 1.35191 + for (var i = 0; i < bc.argCount; i++) { 1.35192 + value = stack.pop(); 1.35193 + object[Multiname.getPublicQualifiedName(stack.pop())] = value; 1.35194 + } 1.35195 + stack.push(object); 1.35196 + break; 1.35197 + case 86: 1.35198 + object = []; 1.35199 + popManyInto(stack, bc.argCount, args); 1.35200 + object.push.apply(object, args); 1.35201 + stack.push(object); 1.35202 + break; 1.35203 + case 87: 1.35204 + true; 1.35205 + stack.push(asCreateActivation(method)); 1.35206 + break; 1.35207 + case 88: 1.35208 + stack[stack.length - 1] = createClass(abc.classes[bc.index], stack[stack.length - 1], scopeStack.topScope()); 1.35209 + break; 1.35210 + case 89: 1.35211 + popNameInto(stack, multinames[bc.index], mn); 1.35212 + stack.push(getDescendants(stack.pop(), mn)); 1.35213 + break; 1.35214 + case 90: 1.35215 + true; 1.35216 + stack.push(exceptions[bc.index].scopeObject); 1.35217 + break; 1.35218 + case 94: 1.35219 + case 93: 1.35220 + popNameInto(stack, multinames[bc.index], mn); 1.35221 + stack.push(scopeStack.topScope().findScopeProperty(mn.namespaces, mn.name, mn.flags, domain, op === 93, false)); 1.35222 + break; 1.35223 + case 96: 1.35224 + multiname = multinames[bc.index]; 1.35225 + object = scopeStack.topScope().findScopeProperty(multiname.namespaces, multiname.name, multiname.flags, domain, true, false); 1.35226 + stack.push(object.asGetProperty(multiname.namespaces, multiname.name, multiname.flags)); 1.35227 + break; 1.35228 + case 104: 1.35229 + case 97: 1.35230 + value = stack.pop(); 1.35231 + popNameInto(stack, multinames[bc.index], mn); 1.35232 + boxValue(stack.pop()).asSetProperty(mn.namespaces, mn.name, mn.flags, value); 1.35233 + break; 1.35234 + case 98: 1.35235 + stack.push(locals[bc.index]); 1.35236 + break; 1.35237 + case 99: 1.35238 + locals[bc.index] = stack.pop(); 1.35239 + break; 1.35240 + case 100: 1.35241 + stack.push(savedScope.global.object); 1.35242 + break; 1.35243 + case 101: 1.35244 + stack.push(scopeStack.get(bc.index)); 1.35245 + break; 1.35246 + case 102: 1.35247 + popNameInto(stack, multinames[bc.index], mn); 1.35248 + stack[stack.length - 1] = boxValue(stack[stack.length - 1]).asGetProperty(mn.namespaces, mn.name, mn.flags); 1.35249 + break; 1.35250 + case 106: 1.35251 + popNameInto(stack, multinames[bc.index], mn); 1.35252 + stack[stack.length - 1] = boxValue(stack[stack.length - 1]).asDeleteProperty(mn.namespaces, mn.name, mn.flags); 1.35253 + break; 1.35254 + case 108: 1.35255 + stack[stack.length - 1] = asGetSlot(stack[stack.length - 1], bc.index); 1.35256 + break; 1.35257 + case 109: 1.35258 + value = stack.pop(); 1.35259 + object = stack.pop(); 1.35260 + asSetSlot(object, bc.index, value); 1.35261 + break; 1.35262 + case 112: 1.35263 + stack[stack.length - 1] = stack[stack.length - 1] + ''; 1.35264 + break; 1.35265 + case 131: 1.35266 + case 115: 1.35267 + stack[stack.length - 1] |= 0; 1.35268 + break; 1.35269 + case 136: 1.35270 + case 116: 1.35271 + stack[stack.length - 1] >>>= 0; 1.35272 + break; 1.35273 + case 132: 1.35274 + case 117: 1.35275 + stack[stack.length - 1] = +stack[stack.length - 1]; 1.35276 + break; 1.35277 + case 129: 1.35278 + case 118: 1.35279 + stack[stack.length - 1] = !(!stack[stack.length - 1]); 1.35280 + break; 1.35281 + case 120: 1.35282 + stack[stack.length - 1] = checkFilter(stack[stack.length - 1]); 1.35283 + break; 1.35284 + case 128: 1.35285 + stack[stack.length - 1] = asCoerce(domain.getType(multinames[bc.index]), stack[stack.length - 1]); 1.35286 + break; 1.35287 + case 130: 1.35288 + break; 1.35289 + case 133: 1.35290 + stack[stack.length - 1] = asCoerceString(stack[stack.length - 1]); 1.35291 + break; 1.35292 + case 135: 1.35293 + stack[stack.length - 2] = asAsType(stack.pop(), stack[stack.length - 1]); 1.35294 + break; 1.35295 + case 137: 1.35296 + object = stack[stack.length - 1]; 1.35297 + stack[stack.length - 1] = object == undefined ? null : object; 1.35298 + break; 1.35299 + case 144: 1.35300 + stack[stack.length - 1] = -stack[stack.length - 1]; 1.35301 + break; 1.35302 + case 145: 1.35303 + ++stack[stack.length - 1]; 1.35304 + break; 1.35305 + case 146: 1.35306 + ++locals[bc.index]; 1.35307 + break; 1.35308 + case 147: 1.35309 + --stack[stack.length - 1]; 1.35310 + break; 1.35311 + case 148: 1.35312 + --locals[bc.index]; 1.35313 + break; 1.35314 + case 149: 1.35315 + stack[stack.length - 1] = asTypeOf(stack[stack.length - 1]); 1.35316 + break; 1.35317 + case 150: 1.35318 + stack[stack.length - 1] = !stack[stack.length - 1]; 1.35319 + break; 1.35320 + case 151: 1.35321 + stack[stack.length - 1] = ~stack[stack.length - 1]; 1.35322 + break; 1.35323 + case 160: 1.35324 + stack[stack.length - 2] = asAdd(stack[stack.length - 2], stack.pop()); 1.35325 + break; 1.35326 + case 161: 1.35327 + stack[stack.length - 2] -= stack.pop(); 1.35328 + break; 1.35329 + case 162: 1.35330 + stack[stack.length - 2] *= stack.pop(); 1.35331 + break; 1.35332 + case 163: 1.35333 + stack[stack.length - 2] /= stack.pop(); 1.35334 + break; 1.35335 + case 164: 1.35336 + stack[stack.length - 2] %= stack.pop(); 1.35337 + break; 1.35338 + case 165: 1.35339 + stack[stack.length - 2] <<= stack.pop(); 1.35340 + break; 1.35341 + case 166: 1.35342 + stack[stack.length - 2] >>= stack.pop(); 1.35343 + break; 1.35344 + case 167: 1.35345 + stack[stack.length - 2] >>>= stack.pop(); 1.35346 + break; 1.35347 + case 168: 1.35348 + stack[stack.length - 2] &= stack.pop(); 1.35349 + break; 1.35350 + case 169: 1.35351 + stack[stack.length - 2] |= stack.pop(); 1.35352 + break; 1.35353 + case 170: 1.35354 + stack[stack.length - 2] ^= stack.pop(); 1.35355 + break; 1.35356 + case 171: 1.35357 + stack[stack.length - 2] = stack[stack.length - 2] == stack.pop(); 1.35358 + break; 1.35359 + case 172: 1.35360 + stack[stack.length - 2] = stack[stack.length - 2] === stack.pop(); 1.35361 + break; 1.35362 + case 173: 1.35363 + stack[stack.length - 2] = stack[stack.length - 2] < stack.pop(); 1.35364 + break; 1.35365 + case 174: 1.35366 + stack[stack.length - 2] = stack[stack.length - 2] <= stack.pop(); 1.35367 + break; 1.35368 + case 175: 1.35369 + stack[stack.length - 2] = stack[stack.length - 2] > stack.pop(); 1.35370 + break; 1.35371 + case 176: 1.35372 + stack[stack.length - 2] = stack[stack.length - 2] >= stack.pop(); 1.35373 + break; 1.35374 + case 177: 1.35375 + stack[stack.length - 2] = asIsInstanceOf(stack.pop(), stack[stack.length - 1]); 1.35376 + break; 1.35377 + case 178: 1.35378 + stack[stack.length - 1] = asIsType(domain.getType(multinames[bc.index]), stack[stack.length - 1]); 1.35379 + break; 1.35380 + case 179: 1.35381 + stack[stack.length - 2] = asIsType(stack.pop(), stack[stack.length - 1]); 1.35382 + break; 1.35383 + case 180: 1.35384 + stack[stack.length - 2] = boxValue(stack.pop()).asHasProperty(null, stack[stack.length - 1]); 1.35385 + break; 1.35386 + case 192: 1.35387 + stack[stack.length - 1] = (stack[stack.length - 1] | 0) + 1; 1.35388 + break; 1.35389 + case 193: 1.35390 + stack[stack.length - 1] = (stack[stack.length - 1] | 0) - 1; 1.35391 + break; 1.35392 + case 194: 1.35393 + locals[bc.index] = (locals[bc.index] | 0) + 1; 1.35394 + break; 1.35395 + case 195: 1.35396 + locals[bc.index] = (locals[bc.index] | 0) - 1; 1.35397 + break; 1.35398 + case 196: 1.35399 + stack[stack.length - 1] = ~stack[stack.length - 1]; 1.35400 + break; 1.35401 + case 197: 1.35402 + stack[stack.length - 2] = stack[stack.length - 2] + stack.pop() | 0; 1.35403 + break; 1.35404 + case 198: 1.35405 + stack[stack.length - 2] = stack[stack.length - 2] - stack.pop() | 0; 1.35406 + break; 1.35407 + case 199: 1.35408 + stack[stack.length - 2] = stack[stack.length - 2] * stack.pop() | 0; 1.35409 + break; 1.35410 + case 208: 1.35411 + case 209: 1.35412 + case 210: 1.35413 + case 211: 1.35414 + stack.push(locals[op - 208]); 1.35415 + break; 1.35416 + case 212: 1.35417 + case 213: 1.35418 + case 214: 1.35419 + case 215: 1.35420 + locals[op - 212] = stack.pop(); 1.35421 + break; 1.35422 + case 239: 1.35423 + case 240: 1.35424 + case 241: 1.35425 + break; 1.35426 + default: 1.35427 + Shumway.Debug.notImplemented(Shumway.AVM2.opcodeName(op)); 1.35428 + } 1.35429 + pc++; 1.35430 + } catch (e) { 1.35431 + if (exceptions.length < 1) { 1.35432 + throw e; 1.35433 + } 1.35434 + e = translateError(domain, e); 1.35435 + for (var i = 0, j = exceptions.length; i < j; i++) { 1.35436 + var handler = exceptions[i]; 1.35437 + if (pc >= handler.start && pc <= handler.end && (!handler.typeName || domain.getType(handler.typeName).isInstance(e))) { 1.35438 + stack.length = 0; 1.35439 + stack.push(e); 1.35440 + scopeStack.clear(); 1.35441 + pc = handler.offset; 1.35442 + continue interpretLabel; 1.35443 + } 1.35444 + } 1.35445 + throw e; 1.35446 + } 1.35447 + } 1.35448 + }; 1.35449 + return Interpreter; 1.35450 + }(); 1.35451 + AVM2.Interpreter = Interpreter; 1.35452 + }(Shumway.AVM2 || (Shumway.AVM2 = {}))); 1.35453 + var AVM2 = Shumway.AVM2; 1.35454 +}(Shumway || (Shumway = {}))); 1.35455 +Shumway.AVM2.Runtime.enableVerifier.value = true; 1.35456 +release = true; 1.35457 +var avm2Root = SHUMWAY_ROOT + 'avm2/'; 1.35458 +var builtinPath = avm2Root + 'generated/builtin/builtin.abc'; 1.35459 +var avm1Path = avm2Root + 'generated/avm1lib/avm1lib.abc'; 1.35460 +var BinaryFileReader = function binaryFileReader() { 1.35461 + function constructor(url, responseType) { 1.35462 + this.url = url; 1.35463 + this.responseType = responseType || 'arraybuffer'; 1.35464 + } 1.35465 + constructor.prototype = { 1.35466 + readAll: function (progress, complete) { 1.35467 + var url = this.url; 1.35468 + var xhr = new XMLHttpRequest(); 1.35469 + var async = true; 1.35470 + xhr.open('GET', this.url, async); 1.35471 + xhr.responseType = this.responseType; 1.35472 + if (progress) { 1.35473 + xhr.onprogress = function (event) { 1.35474 + progress(xhr.response, event.loaded, event.total); 1.35475 + }; 1.35476 + } 1.35477 + xhr.onreadystatechange = function (event) { 1.35478 + if (xhr.readyState === 4) { 1.35479 + if (xhr.status !== 200 && xhr.status !== 0) { 1.35480 + unexpected('Path: ' + url + ' not found.'); 1.35481 + complete(null, xhr.statusText); 1.35482 + return; 1.35483 + } 1.35484 + complete(xhr.response); 1.35485 + } 1.35486 + }; 1.35487 + xhr.send(null); 1.35488 + }, 1.35489 + readAsync: function (ondata, onerror, onopen, oncomplete, onhttpstatus) { 1.35490 + var xhr = new XMLHttpRequest({ 1.35491 + mozSystem: true 1.35492 + }); 1.35493 + var url = this.url; 1.35494 + xhr.open(this.method || 'GET', url, true); 1.35495 + var isNotProgressive; 1.35496 + try { 1.35497 + xhr.responseType = 'moz-chunked-arraybuffer'; 1.35498 + isNotProgressive = xhr.responseType !== 'moz-chunked-arraybuffer'; 1.35499 + } catch (e) { 1.35500 + isNotProgressive = true; 1.35501 + } 1.35502 + if (isNotProgressive) { 1.35503 + xhr.responseType = 'arraybuffer'; 1.35504 + } 1.35505 + xhr.onprogress = function (e) { 1.35506 + if (isNotProgressive) 1.35507 + return; 1.35508 + ondata(new Uint8Array(xhr.response), { 1.35509 + loaded: e.loaded, 1.35510 + total: e.total 1.35511 + }); 1.35512 + }; 1.35513 + xhr.onreadystatechange = function (event) { 1.35514 + if (xhr.readyState === 2 && onhttpstatus) { 1.35515 + onhttpstatus(url, xhr.status, xhr.getAllResponseHeaders()); 1.35516 + } 1.35517 + if (xhr.readyState === 4) { 1.35518 + if (xhr.status !== 200 && xhr.status !== 0) { 1.35519 + onerror(xhr.statusText); 1.35520 + } 1.35521 + if (isNotProgressive) { 1.35522 + var buffer = xhr.response; 1.35523 + ondata(new Uint8Array(buffer), { 1.35524 + loaded: buffer.byteLength, 1.35525 + total: buffer.byteLength 1.35526 + }); 1.35527 + } 1.35528 + if (oncomplete) { 1.35529 + oncomplete(); 1.35530 + } 1.35531 + } else if (xhr.readyState === 2 && onopen) { 1.35532 + onopen(); 1.35533 + } 1.35534 + }; 1.35535 + xhr.send(null); 1.35536 + } 1.35537 + }; 1.35538 + return constructor; 1.35539 + }(); 1.35540 +var libraryAbcs; 1.35541 +function grabAbc(abcName) { 1.35542 + var entry = libraryScripts[abcName]; 1.35543 + if (entry) { 1.35544 + var offset = entry.offset; 1.35545 + var length = entry.length; 1.35546 + return new AbcFile(new Uint8Array(libraryAbcs, offset, length), abcName); 1.35547 + } 1.35548 + return null; 1.35549 +} 1.35550 +var avm2; 1.35551 +function createAVM2(builtinPath, libraryPath, avm1Path, sysMode, appMode, next) { 1.35552 + avm2 = new AVM2(sysMode, appMode, loadAVM1); 1.35553 + var builtinAbc, avm1Abc; 1.35554 + AVM2.loadPlayerglobal(libraryPath.abcs, libraryPath.catalog).then(function () { 1.35555 + new BinaryFileReader(builtinPath).readAll(null, function (buffer) { 1.35556 + builtinAbc = new AbcFile(new Uint8Array(buffer), 'builtin.abc'); 1.35557 + executeAbc(); 1.35558 + }); 1.35559 + }); 1.35560 + function loadAVM1(next) { 1.35561 + new BinaryFileReader(avm1Path).readAll(null, function (buffer) { 1.35562 + avm1Abc = new AbcFile(new Uint8Array(buffer), 'avm1.abc'); 1.35563 + ; 1.35564 + avm2.systemDomain.executeAbc(avm1Abc); 1.35565 + next(); 1.35566 + }); 1.35567 + } 1.35568 + function executeAbc() { 1.35569 + avm2.builtinsLoaded = false; 1.35570 + avm2.systemDomain.onMessage.register('classCreated', Stubs.onClassCreated); 1.35571 + avm2.systemDomain.executeAbc(builtinAbc); 1.35572 + avm2.builtinsLoaded = true; 1.35573 + console.info(JSON.stringify(Counter.toJSON())); 1.35574 + console.timeEnd('Load AVM2'); 1.35575 + next(avm2); 1.35576 + } 1.35577 +} 1.35578 +{ 1.35579 + var MAX_SNAP_DRAW_SCALE_TO_CACHE = 8; 1.35580 + var CACHE_SNAP_DRAW_AFTER = 3; 1.35581 + var BitmapDefinition = function () { 1.35582 + function setBitmapData(value) { 1.35583 + if (this._bitmapData) { 1.35584 + this._bitmapData._changeNotificationTarget = null; 1.35585 + } 1.35586 + this._bitmapData = value; 1.35587 + if (this._bitmapData) { 1.35588 + this._bitmapData._changeNotificationTarget = this; 1.35589 + } 1.35590 + if (value) { 1.35591 + var canvas = value._drawable; 1.35592 + this._bbox = { 1.35593 + xMin: 0, 1.35594 + yMin: 0, 1.35595 + xMax: canvas.width * 20, 1.35596 + yMax: canvas.height * 20 1.35597 + }; 1.35598 + } else { 1.35599 + this._bbox = { 1.35600 + xMin: 0, 1.35601 + yMin: 0, 1.35602 + xMax: 0, 1.35603 + yMax: 0 1.35604 + }; 1.35605 + } 1.35606 + this._drawableChanged(); 1.35607 + this._invalidateBounds(); 1.35608 + this._invalidateTransform(); 1.35609 + } 1.35610 + return { 1.35611 + __class__: 'flash.display.Bitmap', 1.35612 + draw: function (ctx, ratio, colorTransform) { 1.35613 + if (!this._bitmapData) { 1.35614 + return; 1.35615 + } 1.35616 + var scaledImage; 1.35617 + ctx.save(); 1.35618 + if (this._pixelSnapping === 'auto' || this._pixelSnapping === 'always') { 1.35619 + var transform = this._getConcatenatedTransform(null, true); 1.35620 + var EPSILON = 0.001; 1.35621 + var aInt = Math.abs(Math.round(transform.a)); 1.35622 + var dInt = Math.abs(Math.round(transform.d)); 1.35623 + var snapPixels; 1.35624 + if (aInt >= 1 && aInt <= MAX_SNAP_DRAW_SCALE_TO_CACHE && dInt >= 1 && dInt <= MAX_SNAP_DRAW_SCALE_TO_CACHE && Math.abs(Math.abs(transform.a) / aInt - 1) <= EPSILON && Math.abs(Math.abs(transform.d) / dInt - 1) <= EPSILON && Math.abs(transform.b) <= EPSILON && Math.abs(transform.c) <= EPSILON) { 1.35625 + if (aInt === 1 && dInt === 1) { 1.35626 + snapPixels = true; 1.35627 + } else { 1.35628 + var sizeKey = aInt + 'x' + dInt; 1.35629 + if (this._snapImageCache.size !== sizeKey) { 1.35630 + this._snapImageCache.size = sizeKey; 1.35631 + this._snapImageCache.hits = 0; 1.35632 + this._snapImageCache.image = null; 1.35633 + } 1.35634 + if (++this._snapImageCache.hits === CACHE_SNAP_DRAW_AFTER) { 1.35635 + this._cacheSnapImage(sizeKey, aInt, dInt); 1.35636 + } 1.35637 + scaledImage = this._snapImageCache.image; 1.35638 + snapPixels = !(!scaledImage); 1.35639 + } 1.35640 + } else { 1.35641 + snapPixels = false; 1.35642 + } 1.35643 + if (snapPixels) { 1.35644 + ctx.setTransform(transform.a < 0 ? -1 : 1, 0, 0, transform.d < 0 ? -1 : 1, transform.tx / 20 | 0, transform.ty / 20 | 0); 1.35645 + } 1.35646 + } 1.35647 + colorTransform.setAlpha(ctx, true); 1.35648 + ctx.imageSmoothingEnabled = ctx.mozImageSmoothingEnabled = this._smoothing; 1.35649 + ctx.drawImage(scaledImage || this._bitmapData._getDrawable(), 0, 0); 1.35650 + ctx.imageSmoothingEnabled = ctx.mozImageSmoothingEnabled = false; 1.35651 + ctx.restore(); 1.35652 + traceRenderer.value && frameWriter.writeLn('Bitmap.draw() snapping: ' + this._pixelSnapping + ', dimensions: ' + this._bitmapData._drawable.width + ' x ' + this._bitmapData._drawable.height); 1.35653 + }, 1.35654 + _drawableChanged: function () { 1.35655 + this._invalidate(); 1.35656 + this._snapImageCache.image = null; 1.35657 + this._snapImageCache.hints = 0; 1.35658 + }, 1.35659 + _cacheSnapImage: function (sizeKey, xScale, yScale) { 1.35660 + Counter.count('Cache scaled image'); 1.35661 + var original = this._bitmapData._getDrawable(); 1.35662 + var canvas = document.createElement('canvas'); 1.35663 + canvas.width = xScale * original.width; 1.35664 + canvas.height = yScale * original.height; 1.35665 + var ctx = canvas.getContext('2d'); 1.35666 + ctx.imageSmoothingEnabled = ctx.mozImageSmoothingEnabled = this._smoothing; 1.35667 + ctx.drawImage(original, 0, 0, original.width, original.height, 0, 0, canvas.width, canvas.height); 1.35668 + var cache = this._snapImageCache; 1.35669 + var image = document.createElement('img'); 1.35670 + cache._tmp = [ 1.35671 + canvas, 1.35672 + image 1.35673 + ]; 1.35674 + if ('toBlob' in canvas) { 1.35675 + canvas.toBlob(function (blob) { 1.35676 + if (cache.size !== sizeKey) { 1.35677 + return; 1.35678 + } 1.35679 + image.onload = function () { 1.35680 + URL.revokeObjectURL(blob); 1.35681 + if (cache.size === sizeKey) { 1.35682 + cache.image = image; 1.35683 + } 1.35684 + }; 1.35685 + image.src = URL.createObjectURL(blob); 1.35686 + }); 1.35687 + } else { 1.35688 + image.onload = function () { 1.35689 + if (cache.size === sizeKey) { 1.35690 + cache.image = image; 1.35691 + } 1.35692 + }; 1.35693 + image.src = canvas.toDataURL(); 1.35694 + } 1.35695 + }, 1.35696 + initialize: function () { 1.35697 + }, 1.35698 + __glue__: { 1.35699 + native: { 1.35700 + static: {}, 1.35701 + instance: { 1.35702 + ctor: function (bitmapData, pixelSnapping, smoothing) { 1.35703 + if (pixelSnapping === 'never' || pixelSnapping === 'always') { 1.35704 + this._pixelSnapping = pixelSnapping; 1.35705 + } else { 1.35706 + this._pixelSnapping = 'auto'; 1.35707 + } 1.35708 + this._smoothing = !(!smoothing); 1.35709 + this._snapImageCache = { 1.35710 + hits: 0, 1.35711 + size: '', 1.35712 + image: null 1.35713 + }; 1.35714 + if (!bitmapData && this.symbol) { 1.35715 + var symbol = this.symbol; 1.35716 + bitmapData = new flash.display.BitmapData(symbol.width, symbol.height, true, 0); 1.35717 + bitmapData._ctx.imageSmoothingEnabled = this._smoothing; 1.35718 + bitmapData._ctx.mozImageSmoothingEnabled = this._smoothing; 1.35719 + bitmapData._ctx.drawImage(symbol.img, 0, 0); 1.35720 + bitmapData._ctx.imageSmoothingEnabled = false; 1.35721 + bitmapData._ctx.mozImageSmoothingEnabled = false; 1.35722 + } 1.35723 + setBitmapData.call(this, bitmapData || null); 1.35724 + }, 1.35725 + pixelSnapping: { 1.35726 + get: function pixelSnapping() { 1.35727 + return this._pixelSnapping; 1.35728 + }, 1.35729 + set: function pixelSnapping(value) { 1.35730 + this._pixelSnapping = value; 1.35731 + } 1.35732 + }, 1.35733 + smoothing: { 1.35734 + get: function smoothing() { 1.35735 + return this._smoothing; 1.35736 + }, 1.35737 + set: function smoothing(value) { 1.35738 + this._smoothing = value; 1.35739 + } 1.35740 + }, 1.35741 + bitmapData: { 1.35742 + get: function bitmapData() { 1.35743 + return this._bitmapData; 1.35744 + }, 1.35745 + set: setBitmapData 1.35746 + } 1.35747 + } 1.35748 + } 1.35749 + } 1.35750 + }; 1.35751 + }.call(this); 1.35752 +} 1.35753 +var CACHE_DRAWABLE_AFTER = 10; 1.35754 +var BitmapDataDefinition = function () { 1.35755 + function replaceRect(ctx, x, y, w, h, alpha) { 1.35756 + if (alpha < 255) { 1.35757 + ctx.clearRect(x, y, w, h); 1.35758 + } 1.35759 + if (alpha > 0) { 1.35760 + ctx.fillRect(x, y, w, h); 1.35761 + } 1.35762 + } 1.35763 + var def = { 1.35764 + __class__: 'flash.display.BitmapData', 1.35765 + initialize: function () { 1.35766 + this._changeNotificationTarget = null; 1.35767 + this._locked = false; 1.35768 + this._requested = 0; 1.35769 + this._cache = null; 1.35770 + if (this.symbol) { 1.35771 + this._img = this.symbol.img; 1.35772 + this._skipCopyToCanvas = this.symbol.skipCopyToCanvas; 1.35773 + } 1.35774 + }, 1.35775 + _checkCanvas: function () { 1.35776 + if (this._drawable === null) 1.35777 + throw ArgumentError(); 1.35778 + }, 1.35779 + ctor: function (width, height, transparent, backgroundColor) { 1.35780 + if (this._img) { 1.35781 + width = this._img.naturalWidth || this._img.width; 1.35782 + height = this._img.naturalHeight || this._img.height; 1.35783 + } else if (isNaN(width + height) || width <= 0 || height <= 0) { 1.35784 + throwError('ArgumentError', Errors.ArgumentError); 1.35785 + } 1.35786 + this._transparent = transparent === undefined ? true : !(!transparent); 1.35787 + this._backgroundColor = backgroundColor === undefined ? 4294967295 : backgroundColor; 1.35788 + if (!this._transparent) { 1.35789 + this._backgroundColor |= 4278190080; 1.35790 + } 1.35791 + if (this._skipCopyToCanvas) { 1.35792 + this._drawable = this._img; 1.35793 + } else { 1.35794 + var canvas = document.createElement('canvas'); 1.35795 + this._ctx = canvas.getContext('2d'); 1.35796 + canvas.width = width | 0; 1.35797 + canvas.height = height | 0; 1.35798 + this._drawable = canvas; 1.35799 + if (!this._transparent || !this._img && this._backgroundColor) { 1.35800 + this.fillRect(new flash.geom.Rectangle(0, 0, width | 0, height | 0), this._backgroundColor); 1.35801 + } 1.35802 + if (this._img) { 1.35803 + this._ctx.drawImage(this._img, 0, 0); 1.35804 + } 1.35805 + } 1.35806 + }, 1.35807 + dispose: function () { 1.35808 + this._ctx = null; 1.35809 + this._drawable.width = 0; 1.35810 + this._drawable.height = 0; 1.35811 + this._drawable = null; 1.35812 + }, 1.35813 + draw: function (source, matrix, colorTransform, blendMode, clipRect, smoothing) { 1.35814 + this._checkCanvas(); 1.35815 + var ctx = this._ctx; 1.35816 + ctx.save(); 1.35817 + ctx.beginPath(); 1.35818 + if (clipRect && clipRect.width > 0 && clipRect.height > 0) { 1.35819 + ctx.rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height); 1.35820 + ctx.clip(); 1.35821 + } 1.35822 + if (matrix) { 1.35823 + ctx.transform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty); 1.35824 + } 1.35825 + ctx.globalCompositeOperation = getBlendModeName(blendMode); 1.35826 + ctx.imageSmoothingEnabled = ctx.mozImageSmoothingEnabled = !(!smoothing); 1.35827 + if (flash.display.BitmapData.class.isInstanceOf(source)) { 1.35828 + ctx.drawImage(source._drawable, 0, 0); 1.35829 + } else { 1.35830 + new RenderVisitor(source, ctx, null, true).startFragment(matrix); 1.35831 + } 1.35832 + ctx.imageSmoothingEnabled = ctx.mozImageSmoothingEnabled = false; 1.35833 + ctx.restore(); 1.35834 + this._invalidate(); 1.35835 + }, 1.35836 + fillRect: function (rect, color) { 1.35837 + this._checkCanvas(); 1.35838 + if (!this._transparent) { 1.35839 + color |= 4278190080; 1.35840 + } 1.35841 + var ctx = this._ctx; 1.35842 + ctx.fillStyle = argbUintToStr(color); 1.35843 + replaceRect(ctx, rect.x, rect.y, rect.width, rect.height, color >>> 24 & 255); 1.35844 + this._invalidate(); 1.35845 + }, 1.35846 + getPixel: function (x, y) { 1.35847 + this._checkCanvas(); 1.35848 + var data = this._ctx.getImageData(x, y, 1, 1).data; 1.35849 + return dataToRGB(data); 1.35850 + }, 1.35851 + getPixel32: function (x, y) { 1.35852 + this._checkCanvas(); 1.35853 + var data = this._ctx.getImageData(x, y, 1, 1).data; 1.35854 + return dataToARGB(data); 1.35855 + }, 1.35856 + _invalidate: function (changeRect) { 1.35857 + if (changeRect) { 1.35858 + somewhatImplemented('BitmapData._invalidate(changeRect)'); 1.35859 + } 1.35860 + if (this._locked) { 1.35861 + return; 1.35862 + } 1.35863 + if (this._changeNotificationTarget) { 1.35864 + this._changeNotificationTarget._drawableChanged(); 1.35865 + } 1.35866 + this._requested = 0; 1.35867 + this._cache = null; 1.35868 + }, 1.35869 + _getDrawable: function () { 1.35870 + if (this._img === this._drawable) { 1.35871 + return this._drawable; 1.35872 + } 1.35873 + this._requested++; 1.35874 + if (this._requested >= CACHE_DRAWABLE_AFTER) { 1.35875 + if (!this._cache) { 1.35876 + Counter.count('Cache drawable'); 1.35877 + var img = document.createElement('img'); 1.35878 + if ('toBlob' in this._drawable) { 1.35879 + this._drawable.toBlob(function (blob) { 1.35880 + img.src = URL.createObjectURL(blob); 1.35881 + img.onload = function () { 1.35882 + URL.revokeObjectURL(blob); 1.35883 + }; 1.35884 + }); 1.35885 + } else { 1.35886 + img.src = this._drawable.toDataURL(); 1.35887 + } 1.35888 + this._cache = img; 1.35889 + } 1.35890 + if (this._cache.width > 0) { 1.35891 + return this._cache; 1.35892 + } 1.35893 + } 1.35894 + return this._drawable; 1.35895 + }, 1.35896 + setPixel: function (x, y, color) { 1.35897 + this.fillRect({ 1.35898 + x: x, 1.35899 + y: y, 1.35900 + width: 1, 1.35901 + height: 1 1.35902 + }, color | 4278190080); 1.35903 + this._invalidate(); 1.35904 + }, 1.35905 + setPixel32: function (x, y, color) { 1.35906 + this.fillRect({ 1.35907 + x: x, 1.35908 + y: y, 1.35909 + width: 1, 1.35910 + height: 1 1.35911 + }, color); 1.35912 + this._invalidate(); 1.35913 + }, 1.35914 + copyPixels: function copyPixels(sourceBitmapData, sourceRect, destPoint, alphaBitmapData, alphaPoint, mergeAlpha) { 1.35915 + if (alphaBitmapData) { 1.35916 + notImplemented('BitmapData.copyPixels w/ alpha'); 1.35917 + } 1.35918 + var w = sourceRect.width; 1.35919 + var h = sourceRect.height; 1.35920 + var sx = sourceRect.x; 1.35921 + var sy = sourceRect.y; 1.35922 + var dx = destPoint.x; 1.35923 + var dy = destPoint.y; 1.35924 + var offsetx = -Math.min(0, sx, dx); 1.35925 + var offsety = -Math.min(0, sy, dy); 1.35926 + var correctionw = Math.min(0, this._ctx.canvas.width - dx - w, sourceBitmapData._drawable.width - sx - w) - offsetx; 1.35927 + var correctionh = Math.min(0, this._ctx.canvas.height - dy - h, sourceBitmapData._drawable.height - sy - h) - offsety; 1.35928 + if (!mergeAlpha) { 1.35929 + this._ctx.clearRect(dx, dy, w, h); 1.35930 + } 1.35931 + if (w + correctionw > 0 && h + correctionh > 0) { 1.35932 + this._ctx.drawImage(sourceBitmapData._drawable, sx + offsetx, sy + offsety, w + correctionw, h + correctionh, dx + offsetx, dy + offsety, w + correctionw, h + correctionh); 1.35933 + } 1.35934 + this._invalidate(); 1.35935 + }, 1.35936 + lock: function lock() { 1.35937 + this._locked = true; 1.35938 + }, 1.35939 + unlock: function unlock(changeRect) { 1.35940 + this._locked = false; 1.35941 + this._invalidate(changeRect); 1.35942 + }, 1.35943 + clone: function () { 1.35944 + this._checkCanvas(); 1.35945 + var bd = new flash.display.BitmapData(this._drawable.width, this._drawable.height, true, 0); 1.35946 + bd._ctx.drawImage(this._drawable, 0, 0); 1.35947 + return bd; 1.35948 + }, 1.35949 + scroll: function (x, y) { 1.35950 + this._checkCanvas(); 1.35951 + this._ctx.draw(this._drawable, x, y); 1.35952 + this._ctx.save(); 1.35953 + var color = this._img ? 0 : this._backgroundColor; 1.35954 + if (!this._transparent) { 1.35955 + color |= 4278190080; 1.35956 + } 1.35957 + var alpha = color >>> 24 & 255; 1.35958 + this._ctx.fillStyle = argbUintToStr(color); 1.35959 + var w = this._drawable.width; 1.35960 + var h = this._drawable.height; 1.35961 + if (x > 0) { 1.35962 + replaceRect(this._ctx, 0, 0, x, h, alpha); 1.35963 + } else if (x < 0) { 1.35964 + replaceRect(this._ctx, w + x, 0, -x, h, alpha); 1.35965 + } 1.35966 + if (y > 0) { 1.35967 + replaceRect(this._ctx, 0, 0, w, y, alpha); 1.35968 + } else if (y < 0) { 1.35969 + replaceRect(this._ctx, h + y, w, -y, alpha); 1.35970 + } 1.35971 + this._ctx.restore(); 1.35972 + this._invalidate(); 1.35973 + }, 1.35974 + get width() { 1.35975 + return this._drawable.width; 1.35976 + }, 1.35977 + get height() { 1.35978 + return this._drawable.height; 1.35979 + } 1.35980 + }; 1.35981 + var desc = Object.getOwnPropertyDescriptor; 1.35982 + def.__glue__ = { 1.35983 + native: { 1.35984 + instance: { 1.35985 + ctor: def.ctor, 1.35986 + fillRect: def.fillRect, 1.35987 + dispose: def.dispose, 1.35988 + getPixel: def.getPixel, 1.35989 + getPixel32: def.getPixel32, 1.35990 + setPixel: def.setPixel, 1.35991 + setPixel32: def.setPixel32, 1.35992 + copyPixels: def.copyPixels, 1.35993 + lock: def.lock, 1.35994 + unlock: def.unlock, 1.35995 + draw: def.draw, 1.35996 + clone: def.clone, 1.35997 + scroll: def.scroll, 1.35998 + width: desc(def, 'width'), 1.35999 + height: desc(def, 'height') 1.36000 + } 1.36001 + } 1.36002 + }; 1.36003 + return def; 1.36004 + }.call(this); 1.36005 +function dataToRGB(data) { 1.36006 + return data[0] << 16 | data[1] << 8 | data[2]; 1.36007 +} 1.36008 +function dataToARGB(data) { 1.36009 + return data[3] << 24 | dataToRGB(data); 1.36010 +} 1.36011 +var DisplayObjectDefinition = function () { 1.36012 + var blendModes; 1.36013 + var nextInstanceId = 1; 1.36014 + function generateName() { 1.36015 + return 'instance' + nextInstanceId++; 1.36016 + } 1.36017 + var broadcastedEvents = { 1.36018 + advanceFrame: false, 1.36019 + enterFrame: true, 1.36020 + constructChildren: false, 1.36021 + frameConstructed: true, 1.36022 + executeFrame: false, 1.36023 + exitFrame: true, 1.36024 + render: true 1.36025 + }; 1.36026 + var point = { 1.36027 + x: 0, 1.36028 + y: 0 1.36029 + }; 1.36030 + var def = { 1.36031 + __class__: 'flash.display.DisplayObject', 1.36032 + initialize: function () { 1.36033 + var blendModeClass = flash.display.BlendMode.class; 1.36034 + this._alpha = 1; 1.36035 + this._animated = false; 1.36036 + this._bbox = null; 1.36037 + this._bitmap = null; 1.36038 + this._blendMode = blendModeClass.NORMAL; 1.36039 + this._bounds = { 1.36040 + xMin: 0, 1.36041 + xMax: 0, 1.36042 + yMin: 0, 1.36043 + yMax: 0, 1.36044 + invalid: true 1.36045 + }; 1.36046 + this._cacheAsBitmap = false; 1.36047 + this._children = []; 1.36048 + this._clipDepth = null; 1.36049 + this._currentTransform = { 1.36050 + a: 1, 1.36051 + b: 0, 1.36052 + c: 0, 1.36053 + d: 1, 1.36054 + tx: 0, 1.36055 + ty: 0 1.36056 + }; 1.36057 + this._concatenatedTransform = { 1.36058 + a: 1, 1.36059 + b: 0, 1.36060 + c: 0, 1.36061 + d: 1, 1.36062 + tx: 0, 1.36063 + ty: 0, 1.36064 + invalid: true 1.36065 + }; 1.36066 + this._current3DTransform = null; 1.36067 + this._cxform = null; 1.36068 + this._graphics = null; 1.36069 + this._filters = []; 1.36070 + this._loader = null; 1.36071 + this._mouseChildren = true; 1.36072 + this._mouseOver = false; 1.36073 + this._mouseX = 0; 1.36074 + this._mouseY = 0; 1.36075 + this._name = null; 1.36076 + this._opaqueBackground = null; 1.36077 + this._owned = false; 1.36078 + this._parent = null; 1.36079 + this._rotation = 0; 1.36080 + this._rotationCos = 1; 1.36081 + this._rotationSin = 0; 1.36082 + this._scale9Grid = null; 1.36083 + this._scaleX = 1; 1.36084 + this._scaleY = 1; 1.36085 + this._stage = null; 1.36086 + this._visible = true; 1.36087 + this._hidden = false; 1.36088 + this._wasCachedAsBitmap = false; 1.36089 + this._destroyed = false; 1.36090 + this._maskedObject = null; 1.36091 + this._scrollRect = null; 1.36092 + this._invalid = false; 1.36093 + this._region = null; 1.36094 + this._level = -1; 1.36095 + this._index = -1; 1.36096 + this._depth = -1; 1.36097 + this._isContainer = false; 1.36098 + this._invisible = false; 1.36099 + this._zindex = 0; 1.36100 + blendModes = [ 1.36101 + blendModeClass.NORMAL, 1.36102 + blendModeClass.NORMAL, 1.36103 + blendModeClass.LAYER, 1.36104 + blendModeClass.MULTIPLY, 1.36105 + blendModeClass.SCREEN, 1.36106 + blendModeClass.LIGHTEN, 1.36107 + blendModeClass.DARKEN, 1.36108 + blendModeClass.DIFFERENCE, 1.36109 + blendModeClass.ADD, 1.36110 + blendModeClass.SUBTRACT, 1.36111 + blendModeClass.INVERT, 1.36112 + blendModeClass.ALPHA, 1.36113 + blendModeClass.ERASE, 1.36114 + blendModeClass.OVERLAY, 1.36115 + blendModeClass.HARDLIGHT, 1.36116 + blendModeClass.SHADER 1.36117 + ]; 1.36118 + var s = this.symbol; 1.36119 + if (s) { 1.36120 + this._animated = s.animated || false; 1.36121 + this._bbox = s.bbox || null; 1.36122 + this._blendMode = this._resolveBlendMode(s.blendMode); 1.36123 + this._children = s.children || []; 1.36124 + this._clipDepth = s.clipDepth || null; 1.36125 + this._cxform = s.cxform || null; 1.36126 + this._loader = s.loader || null; 1.36127 + this._name = s.name || null; 1.36128 + this._owned = s.owned || false; 1.36129 + this._parent = s.parent || null; 1.36130 + this._level = isNaN(s.level) ? -1 : s.level; 1.36131 + this._index = isNaN(s.index) ? -1 : s.index; 1.36132 + this._depth = isNaN(s.depth) ? -1 : s.depth; 1.36133 + this._root = s.root || null; 1.36134 + this._stage = s.stage || null; 1.36135 + var scale9Grid = s.scale9Grid; 1.36136 + if (scale9Grid) { 1.36137 + this._scale9Grid = new flash.geom.Rectangle(scale9Grid.left, scale9Grid.top, scale9Grid.right - scale9Grid.left, scale9Grid.bottom - scale9Grid.top); 1.36138 + } 1.36139 + var matrix = s.currentTransform; 1.36140 + if (matrix) { 1.36141 + this._setTransformMatrix(matrix, false); 1.36142 + } 1.36143 + } 1.36144 + this._accessibilityProperties = null; 1.36145 + var self = this; 1.36146 + this._onBroadcastMessage = function (type) { 1.36147 + var listeners = self._listeners; 1.36148 + if (listeners[type]) { 1.36149 + self._dispatchEvent(type); 1.36150 + } 1.36151 + }; 1.36152 + }, 1.36153 + _addEventListener: function addEventListener(type, listener, useCapture, priority) { 1.36154 + if (broadcastedEvents[type] === false) { 1.36155 + avm2.systemDomain.onMessage.register(type, listener); 1.36156 + return; 1.36157 + } 1.36158 + if (type in broadcastedEvents && !this._listeners[type]) { 1.36159 + avm2.systemDomain.onMessage.register(type, this._onBroadcastMessage); 1.36160 + } 1.36161 + this._addEventListenerImpl(type, listener, useCapture, priority); 1.36162 + }, 1.36163 + _removeEventListener: function addEventListener(type, listener, useCapture) { 1.36164 + if (broadcastedEvents[type] === false) { 1.36165 + avm2.systemDomain.onMessage.unregister(type, listener); 1.36166 + return; 1.36167 + } 1.36168 + this._removeEventListenerImpl(type, listener, useCapture); 1.36169 + if (type in broadcastedEvents && !this._listeners[type]) { 1.36170 + avm2.systemDomain.onMessage.unregister(type, this._onBroadcastMessage); 1.36171 + } 1.36172 + }, 1.36173 + _resolveBlendMode: function (blendModeNumeric) { 1.36174 + return blendModes[blendModeNumeric] || flash.display.BlendMode.class.NORMAL; 1.36175 + }, 1.36176 + _getConcatenatedTransform: function (targetCoordSpace, toDeviceSpace) { 1.36177 + var stage = this._stage; 1.36178 + if (this === this._stage) { 1.36179 + return toDeviceSpace ? this._concatenatedTransform : this._currentTransform; 1.36180 + } 1.36181 + if (targetCoordSpace === this._parent) { 1.36182 + return this._currentTransform; 1.36183 + } 1.36184 + var invalidNode = null; 1.36185 + var m, m2, targetCoordMatrix; 1.36186 + var currentNode = this; 1.36187 + while (currentNode !== stage) { 1.36188 + if (currentNode._concatenatedTransform.invalid) { 1.36189 + invalidNode = currentNode; 1.36190 + } 1.36191 + if (currentNode === targetCoordSpace) { 1.36192 + targetCoordMatrix = currentNode._concatenatedTransform; 1.36193 + } 1.36194 + currentNode = currentNode._parent; 1.36195 + } 1.36196 + if (invalidNode) { 1.36197 + if (this._parent === stage) { 1.36198 + m = this._concatenatedTransform; 1.36199 + m2 = this._currentTransform; 1.36200 + m.a = m2.a; 1.36201 + m.b = m2.b; 1.36202 + m.c = m2.c; 1.36203 + m.d = m2.d; 1.36204 + m.tx = m2.tx; 1.36205 + m.ty = m2.ty; 1.36206 + } else { 1.36207 + var stack = []; 1.36208 + var currentNode = this; 1.36209 + while (currentNode !== invalidNode) { 1.36210 + stack.push(currentNode); 1.36211 + currentNode = currentNode._parent; 1.36212 + } 1.36213 + var node = invalidNode; 1.36214 + do { 1.36215 + var parent = node._parent; 1.36216 + m = node._concatenatedTransform; 1.36217 + m2 = node._currentTransform; 1.36218 + if (parent) { 1.36219 + if (parent !== stage) { 1.36220 + var m3 = parent._concatenatedTransform; 1.36221 + m.a = m2.a * m3.a + m2.b * m3.c; 1.36222 + m.b = m2.a * m3.b + m2.b * m3.d; 1.36223 + m.c = m2.c * m3.a + m2.d * m3.c; 1.36224 + m.d = m2.d * m3.d + m2.c * m3.b; 1.36225 + m.tx = m2.tx * m3.a + m3.tx + m2.ty * m3.c; 1.36226 + m.ty = m2.ty * m3.d + m3.ty + m2.tx * m3.b; 1.36227 + } 1.36228 + } else { 1.36229 + m.a = m2.a; 1.36230 + m.b = m2.b; 1.36231 + m.c = m2.c; 1.36232 + m.d = m2.d; 1.36233 + m.tx = m2.tx; 1.36234 + m.ty = m2.ty; 1.36235 + } 1.36236 + m.invalid = false; 1.36237 + var nextNode = stack.pop(); 1.36238 + var children = node._children; 1.36239 + for (var i = 0; i < children.length; i++) { 1.36240 + var child = children[i]; 1.36241 + if (child !== nextNode) { 1.36242 + child._concatenatedTransform.invalid = true; 1.36243 + } 1.36244 + } 1.36245 + node = nextNode; 1.36246 + } while (node); 1.36247 + } 1.36248 + } else { 1.36249 + m = this._concatenatedTransform; 1.36250 + } 1.36251 + if (targetCoordSpace && targetCoordSpace !== this._stage) { 1.36252 + m2 = targetCoordMatrix || targetCoordSpace._getConcatenatedTransform(null, false); 1.36253 + var a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0; 1.36254 + if (m2.b || m2.c) { 1.36255 + var det = 1 / (m2.a * m2.d - m2.b * m2.c); 1.36256 + a = m2.d * det; 1.36257 + b = -m2.b * det; 1.36258 + c = -m2.c * det; 1.36259 + d = m2.a * det; 1.36260 + tx = -(a * m2.tx + c * m2.ty); 1.36261 + ty = -(b * m2.tx + d * m2.ty); 1.36262 + } else { 1.36263 + a = 1 / m2.a; 1.36264 + d = 1 / m2.d; 1.36265 + tx = m2.tx * -a; 1.36266 + ty = m2.ty * -d; 1.36267 + } 1.36268 + return { 1.36269 + a: a * m.a + c * m.b, 1.36270 + b: b * m.a + d * m.b, 1.36271 + c: a * m.c + c * m.d, 1.36272 + d: b * m.c + d * m.d, 1.36273 + tx: a * m.tx + c * m.ty + tx, 1.36274 + ty: b * m.tx + d * m.ty + ty 1.36275 + }; 1.36276 + } 1.36277 + if (toDeviceSpace && stage) { 1.36278 + m2 = stage._concatenatedTransform; 1.36279 + return { 1.36280 + a: m.a * m2.a, 1.36281 + b: m.b * m2.d, 1.36282 + c: m.c * m2.a, 1.36283 + d: m.d * m2.d, 1.36284 + tx: m.tx * m2.a + m2.tx, 1.36285 + ty: m.ty * m2.d + m2.ty 1.36286 + }; 1.36287 + } 1.36288 + return m; 1.36289 + }, 1.36290 + _applyCurrentTransform: function (pt) { 1.36291 + var m = this._getConcatenatedTransform(null, false); 1.36292 + var x = pt.x; 1.36293 + var y = pt.y; 1.36294 + pt.x = m.a * x + m.c * y + m.tx | 0; 1.36295 + pt.y = m.d * y + m.b * x + m.ty | 0; 1.36296 + }, 1.36297 + _applyConcatenatedInverseTransform: function (pt) { 1.36298 + var m = this._getConcatenatedTransform(null, false); 1.36299 + var det = 1 / (m.a * m.d - m.b * m.c); 1.36300 + var x = pt.x - m.tx; 1.36301 + var y = pt.y - m.ty; 1.36302 + pt.x = (m.d * x - m.c * y) * det | 0; 1.36303 + pt.y = (m.a * y - m.b * x) * det | 0; 1.36304 + }, 1.36305 + _hitTest: function (use_xy, x, y, useShape, hitTestObject) { 1.36306 + if (use_xy) { 1.36307 + point.x = x; 1.36308 + point.y = y; 1.36309 + this._applyConcatenatedInverseTransform(point); 1.36310 + var b = this._getContentBounds(); 1.36311 + if (!(point.x >= b.xMin && point.x < b.xMax && point.y >= b.yMin && point.y < b.yMax)) { 1.36312 + return false; 1.36313 + } 1.36314 + if (!useShape || !this._graphics) { 1.36315 + return true; 1.36316 + } 1.36317 + if (this._graphics) { 1.36318 + var subpaths = this._graphics._paths; 1.36319 + for (var i = 0, n = subpaths.length; i < n; i++) { 1.36320 + var path = subpaths[i]; 1.36321 + if (path.isPointInPath(point.x, point.y)) { 1.36322 + return true; 1.36323 + } 1.36324 + if (path.strokeStyle) { 1.36325 + var strokePath = path._strokePath; 1.36326 + if (!strokePath) { 1.36327 + strokePath = path.strokePath(path.drawingStyles); 1.36328 + path._strokePath = strokePath; 1.36329 + } 1.36330 + if (strokePath.isPointInPath(point.x, point.y)) { 1.36331 + return true; 1.36332 + } 1.36333 + } 1.36334 + } 1.36335 + } 1.36336 + var children = this._children; 1.36337 + for (var i = 0, n = children.length; i < n; i++) { 1.36338 + var child = children[i]; 1.36339 + if (child._hitTest && child._hitTest(true, x, y, true, null)) { 1.36340 + return true; 1.36341 + } 1.36342 + } 1.36343 + return false; 1.36344 + } 1.36345 + var b1 = this.getBounds(this._stage); 1.36346 + var b2 = hitTestObject.getBounds(hitTestObject._stage); 1.36347 + x = Math.max(b1.xMin, b2.xMin); 1.36348 + y = Math.max(b1.yMin, b2.yMin); 1.36349 + var width = Math.min(b1.xMax, b2.xMax) - x; 1.36350 + var height = Math.min(b1.yMax, b2.yMax) - y; 1.36351 + return width > 0 && height > 0; 1.36352 + }, 1.36353 + _invalidate: function () { 1.36354 + this._invalid = true; 1.36355 + }, 1.36356 + _invalidateBounds: function () { 1.36357 + var currentNode = this; 1.36358 + while (currentNode && !currentNode._bounds.invalid) { 1.36359 + currentNode._bounds.invalid = true; 1.36360 + currentNode = currentNode._parent; 1.36361 + } 1.36362 + }, 1.36363 + _invalidateTransform: function () { 1.36364 + this._concatenatedTransform.invalid = true; 1.36365 + if (this._parent) { 1.36366 + this._parent._invalidateBounds(); 1.36367 + } 1.36368 + }, 1.36369 + _setTransformMatrix: function (matrix, convertToTwips) { 1.36370 + var a = matrix.a; 1.36371 + var b = matrix.b; 1.36372 + var c = matrix.c; 1.36373 + var d = matrix.d; 1.36374 + var tx, ty; 1.36375 + if (convertToTwips) { 1.36376 + tx = matrix.tx * 20 | 0; 1.36377 + ty = matrix.ty * 20 | 0; 1.36378 + } else { 1.36379 + tx = matrix.tx; 1.36380 + ty = matrix.ty; 1.36381 + } 1.36382 + var angle = a !== 0 ? Math.atan(b / a) : b > 0 ? Math.PI / 2 : -Math.PI / 2; 1.36383 + this._rotation = angle * 180 / Math.PI; 1.36384 + this._rotationCos = Math.cos(angle); 1.36385 + this._rotationSin = Math.sin(angle); 1.36386 + var sx = Math.sqrt(a * a + b * b); 1.36387 + this._scaleX = a > 0 ? sx : -sx; 1.36388 + var sy = Math.sqrt(d * d + c * c); 1.36389 + this._scaleY = d > 0 ? sy : -sy; 1.36390 + var transform = this._currentTransform; 1.36391 + transform.a = a; 1.36392 + transform.b = b; 1.36393 + transform.c = c; 1.36394 + transform.d = d; 1.36395 + transform.tx = tx; 1.36396 + transform.ty = ty; 1.36397 + this._invalidateTransform(); 1.36398 + }, 1.36399 + get accessibilityProperties() { 1.36400 + return this._accessibilityProperties; 1.36401 + }, 1.36402 + set accessibilityProperties(val) { 1.36403 + this._accessibilityProperties = val; 1.36404 + }, 1.36405 + get alpha() { 1.36406 + return this._alpha; 1.36407 + }, 1.36408 + set alpha(val) { 1.36409 + if (val === this._alpha) { 1.36410 + return; 1.36411 + } 1.36412 + this._invalidate(); 1.36413 + this._alpha = val; 1.36414 + this._animated = false; 1.36415 + }, 1.36416 + get blendMode() { 1.36417 + return this._blendMode; 1.36418 + }, 1.36419 + set blendMode(val) { 1.36420 + if (blendModes.indexOf(val) >= 0) { 1.36421 + this._blendMode = val; 1.36422 + } else { 1.36423 + throwError('ArgumentError', Errors.InvalidEnumError, 'blendMode'); 1.36424 + } 1.36425 + this._animated = false; 1.36426 + }, 1.36427 + get cacheAsBitmap() { 1.36428 + return this._cacheAsBitmap; 1.36429 + }, 1.36430 + set cacheAsBitmap(val) { 1.36431 + this._cacheAsBitmap = this._filters.length ? true : val; 1.36432 + this._animated = false; 1.36433 + }, 1.36434 + get filters() { 1.36435 + return this._filters; 1.36436 + }, 1.36437 + set filters(val) { 1.36438 + if (val.length) { 1.36439 + if (!this._filters.length) 1.36440 + this._wasCachedAsBitmap = this._cacheAsBitmap; 1.36441 + this._cacheAsBitmap = true; 1.36442 + } else { 1.36443 + this._cacheAsBitmap = this._wasCachedAsBitmap; 1.36444 + } 1.36445 + this._filters = val; 1.36446 + this._animated = false; 1.36447 + }, 1.36448 + get height() { 1.36449 + var bounds = this._getContentBounds(); 1.36450 + var t = this._currentTransform; 1.36451 + return Math.abs(t.b) * (bounds.xMax - bounds.xMin) + Math.abs(t.d) * (bounds.yMax - bounds.yMin) | 0; 1.36452 + }, 1.36453 + set height(val) { 1.36454 + if (val < 0) { 1.36455 + return; 1.36456 + } 1.36457 + var u = Math.abs(this._rotationCos); 1.36458 + var v = Math.abs(this._rotationSin); 1.36459 + var bounds = this._getContentBounds(); 1.36460 + var baseHeight = v * (bounds.xMax - bounds.xMin) + u * (bounds.yMax - bounds.yMin); 1.36461 + if (!baseHeight) { 1.36462 + return; 1.36463 + } 1.36464 + var baseWidth = u * (bounds.xMax - bounds.xMin) + v * (bounds.yMax - bounds.yMin); 1.36465 + this.scaleX = this.width / baseWidth; 1.36466 + this.scaleY = val / baseHeight; 1.36467 + }, 1.36468 + get loaderInfo() { 1.36469 + return this._loader && this._loader._contentLoaderInfo || this._parent.loaderInfo; 1.36470 + }, 1.36471 + get mask() { 1.36472 + return this._mask; 1.36473 + }, 1.36474 + set mask(val) { 1.36475 + if (this._mask === val) { 1.36476 + return; 1.36477 + } 1.36478 + this._invalidate(); 1.36479 + if (val && val._maskedObject) { 1.36480 + val._maskedObject.mask = null; 1.36481 + } 1.36482 + this._mask = val; 1.36483 + if (val) { 1.36484 + val._maskedObject = this; 1.36485 + } 1.36486 + this._animated = false; 1.36487 + }, 1.36488 + get name() { 1.36489 + return this._name || (this._name = generateName()); 1.36490 + }, 1.36491 + set name(val) { 1.36492 + this._name = val; 1.36493 + }, 1.36494 + get mouseX() { 1.36495 + if (!this._stage) { 1.36496 + return 0; 1.36497 + } 1.36498 + point.x = this._stage._mouseX; 1.36499 + point.y = this._stage._mouseY; 1.36500 + this._applyConcatenatedInverseTransform(point); 1.36501 + return point.x; 1.36502 + }, 1.36503 + get mouseY() { 1.36504 + if (!this._stage) { 1.36505 + return 0; 1.36506 + } 1.36507 + point.x = this._stage._mouseX; 1.36508 + point.y = this._stage._mouseY; 1.36509 + this._applyConcatenatedInverseTransform(point); 1.36510 + return point.y; 1.36511 + }, 1.36512 + get opaqueBackground() { 1.36513 + return this._opaqueBackground; 1.36514 + }, 1.36515 + set opaqueBackground(val) { 1.36516 + this._opaqueBackground = val; 1.36517 + this._animated = false; 1.36518 + }, 1.36519 + get parent() { 1.36520 + return this._index > -1 ? this._parent : null; 1.36521 + }, 1.36522 + get root() { 1.36523 + return this._stage && this._stage._root; 1.36524 + }, 1.36525 + get rotation() { 1.36526 + return this._rotation; 1.36527 + }, 1.36528 + set rotation(val) { 1.36529 + val %= 360; 1.36530 + if (val > 180) { 1.36531 + val -= 360; 1.36532 + } 1.36533 + if (val === this._rotation) 1.36534 + return; 1.36535 + this._invalidate(); 1.36536 + this._invalidateTransform(); 1.36537 + this._rotation = val; 1.36538 + var u, v; 1.36539 + switch (val) { 1.36540 + case 0: 1.36541 + case 360: 1.36542 + u = 1, v = 0; 1.36543 + break; 1.36544 + case 90: 1.36545 + case -270: 1.36546 + u = 0, v = 1; 1.36547 + break; 1.36548 + case 180: 1.36549 + case -180: 1.36550 + u = -1, v = 0; 1.36551 + break; 1.36552 + case 270: 1.36553 + case -90: 1.36554 + u = 0, v = -1; 1.36555 + break; 1.36556 + default: 1.36557 + var angle = this._rotation / 180 * Math.PI; 1.36558 + u = Math.cos(angle); 1.36559 + v = Math.sin(angle); 1.36560 + break; 1.36561 + } 1.36562 + this._rotationCos = u; 1.36563 + this._rotationSin = v; 1.36564 + var m = this._currentTransform; 1.36565 + m.a = u * this._scaleX; 1.36566 + m.b = v * this._scaleX; 1.36567 + m.c = -v * this._scaleY; 1.36568 + m.d = u * this._scaleY; 1.36569 + this._animated = false; 1.36570 + }, 1.36571 + get rotationX() { 1.36572 + return 0; 1.36573 + }, 1.36574 + set rotationX(val) { 1.36575 + somewhatImplemented('DisplayObject.rotationX'); 1.36576 + }, 1.36577 + get rotationY() { 1.36578 + return 0; 1.36579 + }, 1.36580 + set rotationY(val) { 1.36581 + somewhatImplemented('DisplayObject.rotationY'); 1.36582 + }, 1.36583 + get rotationZ() { 1.36584 + return this.rotation; 1.36585 + }, 1.36586 + set rotationZ(val) { 1.36587 + this.rotation = val; 1.36588 + somewhatImplemented('DisplayObject.rotationZ'); 1.36589 + }, 1.36590 + get stage() { 1.36591 + return this._stage; 1.36592 + }, 1.36593 + get scaleX() { 1.36594 + return this._scaleX; 1.36595 + }, 1.36596 + set scaleX(val) { 1.36597 + if (val === this._scaleX) 1.36598 + return; 1.36599 + this._invalidate(); 1.36600 + this._invalidateTransform(); 1.36601 + this._scaleX = val; 1.36602 + var m = this._currentTransform; 1.36603 + m.a = this._rotationCos * val; 1.36604 + m.b = this._rotationSin * val; 1.36605 + this._animated = false; 1.36606 + }, 1.36607 + get scaleY() { 1.36608 + return this._scaleY; 1.36609 + }, 1.36610 + set scaleY(val) { 1.36611 + if (val === this._scaleY) 1.36612 + return; 1.36613 + this._invalidate(); 1.36614 + this._invalidateTransform(); 1.36615 + this._scaleY = val; 1.36616 + var m = this._currentTransform; 1.36617 + m.c = -this._rotationSin * val; 1.36618 + m.d = this._rotationCos * val; 1.36619 + this._animated = false; 1.36620 + }, 1.36621 + get scaleZ() { 1.36622 + return 1; 1.36623 + }, 1.36624 + set scaleZ(val) { 1.36625 + somewhatImplemented('DisplayObject.scaleZ'); 1.36626 + }, 1.36627 + get scale9Grid() { 1.36628 + return this._scale9Grid; 1.36629 + }, 1.36630 + set scale9Grid(val) { 1.36631 + somewhatImplemented('DisplayObject.scale9Grid'); 1.36632 + this._scale9Grid = val; 1.36633 + this._animated = false; 1.36634 + }, 1.36635 + get scrollRect() { 1.36636 + return this._scrollRect; 1.36637 + }, 1.36638 + set scrollRect(val) { 1.36639 + somewhatImplemented('DisplayObject.scrollRect'); 1.36640 + this._scrollRect = val; 1.36641 + }, 1.36642 + get transform() { 1.36643 + return new flash.geom.Transform(this); 1.36644 + }, 1.36645 + set transform(val) { 1.36646 + var transform = this.transform; 1.36647 + transform.colorTransform = val.colorTransform; 1.36648 + if (val.matrix3D) { 1.36649 + transform.matrix3D = val.matrix3D; 1.36650 + } else { 1.36651 + transform.matrix = val.matrix; 1.36652 + } 1.36653 + }, 1.36654 + get visible() { 1.36655 + return this._visible; 1.36656 + }, 1.36657 + set visible(val) { 1.36658 + if (val === this._visible) 1.36659 + return; 1.36660 + this._invalidate(); 1.36661 + this._visible = val; 1.36662 + this._animated = false; 1.36663 + }, 1.36664 + get width() { 1.36665 + var bounds = this._getContentBounds(); 1.36666 + var t = this._currentTransform; 1.36667 + return Math.abs(t.a) * (bounds.xMax - bounds.xMin) + Math.abs(t.c) * (bounds.yMax - bounds.yMin) | 0; 1.36668 + }, 1.36669 + set width(val) { 1.36670 + if (val < 0) { 1.36671 + return; 1.36672 + } 1.36673 + var u = Math.abs(this._rotationCos); 1.36674 + var v = Math.abs(this._rotationSin); 1.36675 + var bounds = this._getContentBounds(); 1.36676 + var baseWidth = u * (bounds.xMax - bounds.xMin) + v * (bounds.yMax - bounds.yMin); 1.36677 + if (!baseWidth) { 1.36678 + return; 1.36679 + } 1.36680 + var baseHeight = v * (bounds.xMax - bounds.xMin) + u * (bounds.yMax - bounds.yMin); 1.36681 + this.scaleY = this.height / baseHeight; 1.36682 + this.scaleX = val / baseWidth; 1.36683 + }, 1.36684 + get x() { 1.36685 + return this._currentTransform.tx; 1.36686 + }, 1.36687 + set x(val) { 1.36688 + if (val === this._currentTransform.tx) { 1.36689 + return; 1.36690 + } 1.36691 + this._invalidate(); 1.36692 + this._invalidateTransform(); 1.36693 + this._currentTransform.tx = val; 1.36694 + this._animated = false; 1.36695 + }, 1.36696 + get y() { 1.36697 + return this._currentTransform.ty; 1.36698 + }, 1.36699 + set y(val) { 1.36700 + if (val === this._currentTransform.ty) { 1.36701 + return; 1.36702 + } 1.36703 + this._invalidate(); 1.36704 + this._invalidateTransform(); 1.36705 + this._currentTransform.ty = val; 1.36706 + this._animated = false; 1.36707 + }, 1.36708 + get z() { 1.36709 + return 0; 1.36710 + }, 1.36711 + set z(val) { 1.36712 + somewhatImplemented('DisplayObject.z'); 1.36713 + }, 1.36714 + _getContentBounds: function () { 1.36715 + var bounds = this._bounds; 1.36716 + if (bounds.invalid) { 1.36717 + var bbox = this._bbox; 1.36718 + var xMin = Number.MAX_VALUE; 1.36719 + var xMax = Number.MIN_VALUE; 1.36720 + var yMin = Number.MAX_VALUE; 1.36721 + var yMax = Number.MIN_VALUE; 1.36722 + if (bbox) { 1.36723 + xMin = bbox.xMin; 1.36724 + xMax = bbox.xMax; 1.36725 + yMin = bbox.yMin; 1.36726 + yMax = bbox.yMax; 1.36727 + } else { 1.36728 + var children = this._children; 1.36729 + var numChildren = children.length; 1.36730 + for (var i = 0; i < numChildren; i++) { 1.36731 + var child = children[i]; 1.36732 + if (!flash.display.DisplayObject.class.isInstanceOf(child)) { 1.36733 + continue; 1.36734 + } 1.36735 + var b = child.getBounds(this); 1.36736 + var x1 = b.xMin; 1.36737 + var y1 = b.yMin; 1.36738 + var x2 = b.xMax; 1.36739 + var y2 = b.yMax; 1.36740 + xMin = Math.min(xMin, x1, x2); 1.36741 + xMax = Math.max(xMax, x1, x2); 1.36742 + yMin = Math.min(yMin, y1, y2); 1.36743 + yMax = Math.max(yMax, y1, y2); 1.36744 + } 1.36745 + if (this._graphics) { 1.36746 + var b = this._graphics._getBounds(true); 1.36747 + if (b.xMin !== b.xMax && b.yMin !== b.yMax) { 1.36748 + var x1 = b.xMin; 1.36749 + var y1 = b.yMin; 1.36750 + var x2 = b.xMax; 1.36751 + var y2 = b.yMax; 1.36752 + xMin = Math.min(xMin, x1, x2); 1.36753 + xMax = Math.max(xMax, x1, x2); 1.36754 + yMin = Math.min(yMin, y1, y2); 1.36755 + yMax = Math.max(yMax, y1, y2); 1.36756 + } 1.36757 + } 1.36758 + } 1.36759 + if (xMin === Number.MAX_VALUE) { 1.36760 + xMin = xMax = yMin = yMax = 0; 1.36761 + } 1.36762 + bounds.xMin = xMin; 1.36763 + bounds.xMax = xMax; 1.36764 + bounds.yMin = yMin; 1.36765 + bounds.yMax = yMax; 1.36766 + bounds.invalid = false; 1.36767 + } 1.36768 + return bounds; 1.36769 + }, 1.36770 + _getRegion: function getRegion(targetCoordSpace) { 1.36771 + var b; 1.36772 + var filters = this._filters; 1.36773 + if (filters.length) { 1.36774 + var xMin = Number.MAX_VALUE; 1.36775 + var xMax = Number.MIN_VALUE; 1.36776 + var yMin = Number.MAX_VALUE; 1.36777 + var yMax = Number.MIN_VALUE; 1.36778 + if (this._graphics) { 1.36779 + b = this._graphics._getBounds(true); 1.36780 + if (b) { 1.36781 + xMin = b.xMin; 1.36782 + xMax = b.xMax; 1.36783 + yMin = b.yMin; 1.36784 + yMax = b.yMax; 1.36785 + } 1.36786 + } 1.36787 + var children = this._children; 1.36788 + for (var i = 0; i < children.length; i++) { 1.36789 + var child = children[i]; 1.36790 + b = children[i]._getRegion(this); 1.36791 + if (b.xMin < xMin) { 1.36792 + xMin = b.xMin; 1.36793 + } 1.36794 + if (b.xMax > xMax) { 1.36795 + xMax = b.xMax; 1.36796 + } 1.36797 + if (b.yMin < yMin) { 1.36798 + yMin = b.yMin; 1.36799 + } 1.36800 + if (b.yMax > yMax) { 1.36801 + yMax = b.yMax; 1.36802 + } 1.36803 + } 1.36804 + if (xMin === Number.MAX_VALUE) { 1.36805 + return { 1.36806 + xMin: 0, 1.36807 + xMax: 0, 1.36808 + yMin: 0, 1.36809 + yMax: 0 1.36810 + }; 1.36811 + } 1.36812 + b = { 1.36813 + xMin: xMin, 1.36814 + xMax: xMax, 1.36815 + yMin: yMin, 1.36816 + yMax: yMax 1.36817 + }; 1.36818 + for (var i = 0; i < filters.length; i++) { 1.36819 + filters[i]._updateFilterBounds(b); 1.36820 + } 1.36821 + } else { 1.36822 + b = this._graphics ? this._graphics._getBounds(true) : this._getContentBounds(); 1.36823 + } 1.36824 + return this._getTransformedRect(b, targetCoordSpace); 1.36825 + }, 1.36826 + getBounds: function (targetCoordSpace) { 1.36827 + return this._getTransformedRect(this._getContentBounds(), targetCoordSpace); 1.36828 + }, 1.36829 + _getTransformedRect: function (rect, targetCoordSpace) { 1.36830 + if (!targetCoordSpace || targetCoordSpace === this) { 1.36831 + return rect; 1.36832 + } 1.36833 + var xMin = rect.xMin; 1.36834 + var xMax = rect.xMax; 1.36835 + var yMin = rect.yMin; 1.36836 + var yMax = rect.yMax; 1.36837 + if (xMax - xMin === 0 || yMax - yMin === 0) { 1.36838 + return { 1.36839 + xMin: 0, 1.36840 + yMin: 0, 1.36841 + xMax: 0, 1.36842 + yMax: 0 1.36843 + }; 1.36844 + } 1.36845 + var m = targetCoordSpace && !flash.display.DisplayObject.class.isInstanceOf(targetCoordSpace) ? targetCoordSpace : this._getConcatenatedTransform(targetCoordSpace, false); 1.36846 + var x0 = m.a * xMin + m.c * yMin + m.tx | 0; 1.36847 + var y0 = m.b * xMin + m.d * yMin + m.ty | 0; 1.36848 + var x1 = m.a * xMax + m.c * yMin + m.tx | 0; 1.36849 + var y1 = m.b * xMax + m.d * yMin + m.ty | 0; 1.36850 + var x2 = m.a * xMax + m.c * yMax + m.tx | 0; 1.36851 + var y2 = m.b * xMax + m.d * yMax + m.ty | 0; 1.36852 + var x3 = m.a * xMin + m.c * yMax + m.tx | 0; 1.36853 + var y3 = m.b * xMin + m.d * yMax + m.ty | 0; 1.36854 + var tmp = 0; 1.36855 + if (x0 > x1) { 1.36856 + tmp = x0; 1.36857 + x0 = x1; 1.36858 + x1 = tmp; 1.36859 + } 1.36860 + if (x2 > x3) { 1.36861 + tmp = x2; 1.36862 + x2 = x3; 1.36863 + x3 = tmp; 1.36864 + } 1.36865 + xMin = x0 < x2 ? x0 : x2; 1.36866 + xMax = x1 > x3 ? x1 : x3; 1.36867 + if (y0 > y1) { 1.36868 + tmp = y0; 1.36869 + y0 = y1; 1.36870 + y1 = tmp; 1.36871 + } 1.36872 + if (y2 > y3) { 1.36873 + tmp = y2; 1.36874 + y2 = y3; 1.36875 + y3 = tmp; 1.36876 + } 1.36877 + yMin = y0 < y2 ? y0 : y2; 1.36878 + yMax = y1 > y3 ? y1 : y3; 1.36879 + return { 1.36880 + xMin: xMin, 1.36881 + yMin: yMin, 1.36882 + xMax: xMax, 1.36883 + yMax: yMax 1.36884 + }; 1.36885 + }, 1.36886 + hitTestObject: function (obj) { 1.36887 + return this._hitTest(false, 0, 0, false, obj); 1.36888 + }, 1.36889 + hitTestPoint: function (x, y, shapeFlag) { 1.36890 + return this._hitTest(true, x, y, shapeFlag, null); 1.36891 + }, 1.36892 + destroy: function () { 1.36893 + if (this._destroyed) { 1.36894 + return; 1.36895 + } 1.36896 + this._destroyed = true; 1.36897 + this.cleanupBroadcastListeners(); 1.36898 + }, 1.36899 + cleanupBroadcastListeners: function () { 1.36900 + var listenerLists = this._listeners; 1.36901 + for (var type in listenerLists) { 1.36902 + avm2.systemDomain.onMessage.unregister(type, this._onBroadcastMessage); 1.36903 + } 1.36904 + } 1.36905 + }; 1.36906 + var desc = Object.getOwnPropertyDescriptor; 1.36907 + def.__glue__ = { 1.36908 + native: { 1.36909 + instance: { 1.36910 + root: desc(def, 'root'), 1.36911 + stage: desc(def, 'stage'), 1.36912 + name: desc(def, 'name'), 1.36913 + parent: desc(def, 'parent'), 1.36914 + mask: desc(def, 'mask'), 1.36915 + visible: desc(def, 'visible'), 1.36916 + x: { 1.36917 + get: function x() { 1.36918 + return this.x / 20; 1.36919 + }, 1.36920 + set: function x(value) { 1.36921 + this.x = value * 20 | 0; 1.36922 + } 1.36923 + }, 1.36924 + y: { 1.36925 + get: function y() { 1.36926 + return this.y / 20; 1.36927 + }, 1.36928 + set: function y(value) { 1.36929 + this.y = value * 20 | 0; 1.36930 + } 1.36931 + }, 1.36932 + z: { 1.36933 + get: function z() { 1.36934 + return this.z / 20; 1.36935 + }, 1.36936 + set: function z(value) { 1.36937 + this.z = value * 20 | 0; 1.36938 + } 1.36939 + }, 1.36940 + scaleX: desc(def, 'scaleX'), 1.36941 + scaleY: desc(def, 'scaleY'), 1.36942 + scaleZ: desc(def, 'scaleZ'), 1.36943 + mouseX: { 1.36944 + get: function mouseX() { 1.36945 + return this.mouseX / 20; 1.36946 + }, 1.36947 + set: function mouseX(value) { 1.36948 + this.mouseX = value * 20 | 0; 1.36949 + } 1.36950 + }, 1.36951 + mouseY: { 1.36952 + get: function mouseY() { 1.36953 + return this.mouseY / 20; 1.36954 + }, 1.36955 + set: function mouseY(value) { 1.36956 + this.mouseY = value * 20 | 0; 1.36957 + } 1.36958 + }, 1.36959 + rotation: desc(def, 'rotation'), 1.36960 + rotationX: desc(def, 'rotationX'), 1.36961 + rotationY: desc(def, 'rotationY'), 1.36962 + rotationZ: desc(def, 'rotationZ'), 1.36963 + alpha: desc(def, 'alpha'), 1.36964 + width: { 1.36965 + get: function width() { 1.36966 + return this.width / 20; 1.36967 + }, 1.36968 + set: function width(value) { 1.36969 + this.width = value * 20 | 0; 1.36970 + } 1.36971 + }, 1.36972 + height: { 1.36973 + get: function height() { 1.36974 + return this.height / 20; 1.36975 + }, 1.36976 + set: function height(value) { 1.36977 + this.height = value * 20 | 0; 1.36978 + } 1.36979 + }, 1.36980 + _hitTest: function (use_xy, x, y, useShape, hitTestObject) { 1.36981 + x = x * 20 | 0; 1.36982 + y = y * 20 | 0; 1.36983 + return this._hitTest(use_xy, x, y, useShape, hitTestObject); 1.36984 + }, 1.36985 + cacheAsBitmap: desc(def, 'cacheAsBitmap'), 1.36986 + opaqueBackground: desc(def, 'opaqueBackground'), 1.36987 + scrollRect: desc(def, 'scrollRect'), 1.36988 + filters: desc(def, 'filters'), 1.36989 + blendMode: desc(def, 'blendMode'), 1.36990 + transform: desc(def, 'transform'), 1.36991 + scale9Grid: desc(def, 'scale9Grid'), 1.36992 + loaderInfo: desc(def, 'loaderInfo'), 1.36993 + accessibilityProperties: desc(def, 'accessibilityProperties'), 1.36994 + globalToLocal: function (pt) { 1.36995 + point.x = pt.x * 20 | 0; 1.36996 + point.y = pt.y * 20 | 0; 1.36997 + this._applyConcatenatedInverseTransform(point); 1.36998 + return new flash.geom.Point(point.x / 20, point.y / 20); 1.36999 + }, 1.37000 + localToGlobal: function (pt) { 1.37001 + point.x = pt.x * 20 | 0; 1.37002 + point.y = pt.y * 20 | 0; 1.37003 + this._applyCurrentTransform(point); 1.37004 + return new flash.geom.Point(point.x / 20, point.y / 20); 1.37005 + }, 1.37006 + getBounds: function (targetCoordSpace) { 1.37007 + var bounds = this.getBounds(targetCoordSpace); 1.37008 + return new flash.geom.Rectangle(bounds.xMin / 20, bounds.yMin / 20, (bounds.xMax - bounds.xMin) / 20, (bounds.yMax - bounds.yMin) / 20); 1.37009 + }, 1.37010 + getRect: function (targetCoordSpace) { 1.37011 + somewhatImplemented('DisplayObject.getRect'); 1.37012 + var bounds = this.getBounds(targetCoordSpace); 1.37013 + return new flash.geom.Rectangle(bounds.xMin / 20, bounds.yMin / 20, (bounds.xMax - bounds.xMin) / 20, (bounds.yMax - bounds.yMin) / 20); 1.37014 + } 1.37015 + } 1.37016 + } 1.37017 + }; 1.37018 + return def; 1.37019 + }.call(this); 1.37020 +var DisplayObjectContainerDefinition = function () { 1.37021 + var def = { 1.37022 + get mouseChildren() { 1.37023 + return this._mouseChildren; 1.37024 + }, 1.37025 + set mouseChildren(val) { 1.37026 + this._mouseChildren = val; 1.37027 + }, 1.37028 + get numChildren() { 1.37029 + return this._children.length; 1.37030 + }, 1.37031 + get tabChildren() { 1.37032 + return this._tabChildren; 1.37033 + }, 1.37034 + set tabChildren(val) { 1.37035 + this._tabChildren = val; 1.37036 + }, 1.37037 + get textSnapshot() { 1.37038 + notImplemented(); 1.37039 + }, 1.37040 + addChild: function (child) { 1.37041 + return this.addChildAt(child, this._children.length); 1.37042 + }, 1.37043 + addChildAt: function (child, index) { 1.37044 + if (child === this) { 1.37045 + throwError('ArgumentError', Errors.CantAddSelfError); 1.37046 + } 1.37047 + if (child._parent === this) { 1.37048 + return this.setChildIndex(child, index); 1.37049 + } 1.37050 + var children = this._children; 1.37051 + if (index < 0 || index > children.length) { 1.37052 + throwError('RangeError', Errors.ParamRangeError); 1.37053 + } 1.37054 + if (child._index > -1) { 1.37055 + var LoaderClass = avm2.systemDomain.getClass('flash.display.Loader'); 1.37056 + if (LoaderClass.isInstanceOf(child._parent)) { 1.37057 + def.removeChild.call(child._parent, child); 1.37058 + } else { 1.37059 + child._parent.removeChild(child); 1.37060 + } 1.37061 + } 1.37062 + if (!this._sparse) { 1.37063 + for (var i = children.length; i && i > index; i--) { 1.37064 + children[i - 1]._index++; 1.37065 + } 1.37066 + } 1.37067 + children.splice(index, 0, child); 1.37068 + child._invalidateTransform(); 1.37069 + child._owned = false; 1.37070 + child._parent = this; 1.37071 + child._stage = this._stage; 1.37072 + child._index = index; 1.37073 + child._dispatchEvent('added', undefined, true); 1.37074 + if (this._stage) { 1.37075 + this._stage._addToStage(child); 1.37076 + } 1.37077 + return child; 1.37078 + }, 1.37079 + areInaccessibleObjectsUnderPoint: function (pt) { 1.37080 + notImplemented(); 1.37081 + }, 1.37082 + contains: function (child) { 1.37083 + return child._parent === this; 1.37084 + }, 1.37085 + getChildAt: function (index) { 1.37086 + var children = this._children; 1.37087 + if (index < 0 || index > children.length) { 1.37088 + throwError('RangeError', Errors.ParamRangeError); 1.37089 + } 1.37090 + var child = children[index]; 1.37091 + if (!flash.display.DisplayObject.class.isInstanceOf(child)) { 1.37092 + return null; 1.37093 + } 1.37094 + return child; 1.37095 + }, 1.37096 + getChildByName: function (name) { 1.37097 + var children = this._children; 1.37098 + for (var i = 0, n = children.length; i < n; i++) { 1.37099 + var child = children[i]; 1.37100 + if (child.name === name) { 1.37101 + return this.getChildAt(i); 1.37102 + } 1.37103 + } 1.37104 + return null; 1.37105 + }, 1.37106 + getChildIndex: function (child) { 1.37107 + if (child._parent !== this) { 1.37108 + throwError('ArgumentError', Errors.NotAChildError); 1.37109 + } 1.37110 + return this._sparse ? this._children.indexOf(child) : child._index; 1.37111 + }, 1.37112 + getObjectsUnderPoint: function (pt) { 1.37113 + notImplemented(); 1.37114 + }, 1.37115 + removeChild: function (child) { 1.37116 + if (child._parent !== this) { 1.37117 + throwError('ArgumentError', Errors.NotAChildError); 1.37118 + } 1.37119 + return this.removeChildAt(this.getChildIndex(child)); 1.37120 + }, 1.37121 + removeChildAt: function (index) { 1.37122 + var children = this._children; 1.37123 + if (index < 0 || index >= children.length) { 1.37124 + throwError('RangeError', Errors.ParamRangeError); 1.37125 + } 1.37126 + var child = children[index]; 1.37127 + child._dispatchEvent('removed', undefined, true); 1.37128 + if (this._stage) { 1.37129 + this._stage._removeFromStage(child); 1.37130 + } 1.37131 + if (!this._sparse) { 1.37132 + for (var i = children.length; i && i > index; i--) { 1.37133 + children[i - 1]._index--; 1.37134 + } 1.37135 + } 1.37136 + children.splice(index, 1); 1.37137 + child._invalidateTransform(); 1.37138 + child._owned = false; 1.37139 + child._parent = null; 1.37140 + child._index = -1; 1.37141 + return child; 1.37142 + }, 1.37143 + setChildIndex: function (child, index) { 1.37144 + if (child._parent !== this) { 1.37145 + throwError('ArgumentError', Errors.NotAChildError); 1.37146 + } 1.37147 + var currentIndex = this.getChildIndex(child); 1.37148 + if (currentIndex === index) { 1.37149 + return; 1.37150 + } 1.37151 + var children = this._children; 1.37152 + if (index < 0 || index > children.length) { 1.37153 + throwError('RangeError', Errors.ParamRangeError); 1.37154 + } 1.37155 + children.splice(currentIndex, 1); 1.37156 + children.splice(index, 0, child); 1.37157 + if (!this._sparse) { 1.37158 + var i = currentIndex < index ? currentIndex : index; 1.37159 + while (i < children.length) { 1.37160 + children[i]._index = i++; 1.37161 + } 1.37162 + } 1.37163 + child._owned = false; 1.37164 + child._invalidate(); 1.37165 + return child; 1.37166 + }, 1.37167 + removeChildren: function (beginIndex, endIndex) { 1.37168 + beginIndex = arguments.length < 1 ? 0 : beginIndex | 0; 1.37169 + endIndex = arguments.length < 2 ? 2147483647 : endIndex | 0; 1.37170 + var numChildren = this._children.length; 1.37171 + if (beginIndex < 0 || endIndex < 0 || endIndex < beginIndex) { 1.37172 + throwError('RangeError', Errors.ParamRangeError); 1.37173 + } 1.37174 + if (numChildren === 0) { 1.37175 + return; 1.37176 + } 1.37177 + if (endIndex > numChildren - 1) { 1.37178 + endIndex = numChildren - 1; 1.37179 + } 1.37180 + var count = endIndex - beginIndex + 1; 1.37181 + while (count--) { 1.37182 + this.removeChildAt(beginIndex); 1.37183 + } 1.37184 + }, 1.37185 + swapChildren: function (child1, child2) { 1.37186 + if (child1._parent !== this || child2._parent !== this) { 1.37187 + throwError('ArgumentError', Errors.NotAChildError); 1.37188 + } 1.37189 + this.swapChildrenAt(this.getChildIndex(child1), this.getChildIndex(child2)); 1.37190 + }, 1.37191 + swapChildrenAt: function (index1, index2) { 1.37192 + var children = this._children; 1.37193 + var numChildren = children.length; 1.37194 + if (index1 < 0 || index1 > numChildren || index2 < 0 || index2 > numChildren) { 1.37195 + throwError('RangeError', Errors.ParamRangeError); 1.37196 + } 1.37197 + var child1 = children[index1]; 1.37198 + var child2 = children[index2]; 1.37199 + children[index1] = child2; 1.37200 + children[index2] = child1; 1.37201 + child1._index = index2; 1.37202 + child2._index = index1; 1.37203 + child1._owned = false; 1.37204 + child2._owned = false; 1.37205 + child1._invalidate(); 1.37206 + child2._invalidate(); 1.37207 + }, 1.37208 + destroy: function () { 1.37209 + if (this._destroyed) { 1.37210 + return; 1.37211 + } 1.37212 + this._destroyed = true; 1.37213 + this._children.forEach(function (child) { 1.37214 + if (child.destroy) { 1.37215 + child.destroy(); 1.37216 + } 1.37217 + }); 1.37218 + this.cleanupBroadcastListeners(); 1.37219 + } 1.37220 + }; 1.37221 + var desc = Object.getOwnPropertyDescriptor; 1.37222 + def.initialize = function () { 1.37223 + this._mouseChildren = true; 1.37224 + this._tabChildren = true; 1.37225 + this._sparse = false; 1.37226 + this._isContainer = true; 1.37227 + }; 1.37228 + def.__glue__ = { 1.37229 + native: { 1.37230 + instance: { 1.37231 + numChildren: desc(def, 'numChildren'), 1.37232 + tabChildren: desc(def, 'tabChildren'), 1.37233 + mouseChildren: desc(def, 'mouseChildren'), 1.37234 + textSnapshot: desc(def, 'textSnapshot'), 1.37235 + addChild: def.addChild, 1.37236 + addChildAt: def.addChildAt, 1.37237 + removeChild: def.removeChild, 1.37238 + removeChildAt: def.removeChildAt, 1.37239 + getChildIndex: def.getChildIndex, 1.37240 + setChildIndex: def.setChildIndex, 1.37241 + getChildAt: def.getChildAt, 1.37242 + getChildByName: def.getChildByName, 1.37243 + contains: def.contains, 1.37244 + swapChildrenAt: def.swapChildrenAt, 1.37245 + swapChildren: def.swapChildren, 1.37246 + removeChildren: def.removeChildren 1.37247 + } 1.37248 + } 1.37249 + }; 1.37250 + return def; 1.37251 + }.call(this); 1.37252 +var FrameLabelDefinition = function () { 1.37253 + return { 1.37254 + __class__: 'flash.display.FrameLabel', 1.37255 + initialize: function () { 1.37256 + }, 1.37257 + __glue__: { 1.37258 + native: { 1.37259 + static: {}, 1.37260 + instance: { 1.37261 + ctor: function ctor(name, frame) { 1.37262 + this._name = name; 1.37263 + this._frame = frame; 1.37264 + }, 1.37265 + name: { 1.37266 + get: function name() { 1.37267 + return this._name; 1.37268 + } 1.37269 + }, 1.37270 + frame: { 1.37271 + get: function frame() { 1.37272 + return this._frame; 1.37273 + } 1.37274 + } 1.37275 + } 1.37276 + } 1.37277 + } 1.37278 + }; 1.37279 + }.call(this); 1.37280 +var GraphicsDefinition = function () { 1.37281 + var GRAPHICS_PATH_WINDING_EVEN_ODD = 'evenOdd'; 1.37282 + var GRAPHICS_PATH_WINDING_NON_ZERO = 'nonZero'; 1.37283 + var def = { 1.37284 + __class__: 'flash.display.Graphics', 1.37285 + initialize: function () { 1.37286 + this._paths = []; 1.37287 + this.beginPath(); 1.37288 + this._bitmap = null; 1.37289 + this._parent = 0; 1.37290 + this.bbox = null; 1.37291 + this.strokeBbox = null; 1.37292 + }, 1.37293 + _invalidate: function () { 1.37294 + this.bbox = null; 1.37295 + this.strokeBbox = null; 1.37296 + this._parent._invalidate(); 1.37297 + this._parent._invalidateBounds(); 1.37298 + }, 1.37299 + beginPath: function () { 1.37300 + var oldPath = this._currentPath; 1.37301 + if (oldPath && (oldPath.commands.length === 0 || oldPath.commands.length === 1 && oldPath.commands[0] === SHAPE_MOVE_TO)) { 1.37302 + return; 1.37303 + } 1.37304 + var path = this._currentPath = new ShapePath(null, null); 1.37305 + this._paths.push(path); 1.37306 + if (oldPath) { 1.37307 + path.fillStyle = oldPath.fillStyle; 1.37308 + path.lineStyle = oldPath.lineStyle; 1.37309 + path.fillRule = oldPath.fillRule; 1.37310 + } 1.37311 + }, 1.37312 + _drawPathObject: function (path) { 1.37313 + if (path.__class__ === 'flash.display.GraphicsPath') 1.37314 + this.drawPath(path.commands, path.data, path.winding); 1.37315 + else if (path.__class__ === 'flash.display.GraphicsTrianglePath') 1.37316 + this.drawTriangles(path.vertices, path.indices, path.uvtData, path.culling); 1.37317 + }, 1.37318 + draw: function (ctx, clip, ratio, colorTransform) { 1.37319 + var paths = this._paths; 1.37320 + for (var i = 0; i < paths.length; i++) { 1.37321 + paths[i].draw(ctx, clip, ratio, colorTransform); 1.37322 + } 1.37323 + }, 1.37324 + beginFill: function (color, alpha) { 1.37325 + if (alpha === undefined) 1.37326 + alpha = 1; 1.37327 + this.beginPath(); 1.37328 + this._currentPath.fillStyle = alpha ? { 1.37329 + style: rgbIntAlphaToStr(color, alpha) 1.37330 + } : null; 1.37331 + }, 1.37332 + beginGradientFill: function (type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPos) { 1.37333 + var style = createGradientStyle(type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPos); 1.37334 + this.beginPath(); 1.37335 + this._currentPath.fillStyle = style; 1.37336 + }, 1.37337 + beginBitmapFill: function (bitmap, matrix, repeat, smooth) { 1.37338 + this.beginPath(); 1.37339 + repeat = repeat !== false; 1.37340 + this._currentPath.fillStyle = createPatternStyle(bitmap, matrix, repeat, !(!smooth)); 1.37341 + }, 1.37342 + clear: function () { 1.37343 + this._invalidate(); 1.37344 + this._paths = []; 1.37345 + this._currentPath = null; 1.37346 + this.beginPath(); 1.37347 + }, 1.37348 + copyFrom: function (sourceGraphics) { 1.37349 + notImplemented('Graphics#copyFrom'); 1.37350 + }, 1.37351 + cubicCurveTo: function (cp1x, cp1y, cp2x, cp2y, x, y) { 1.37352 + this._invalidate(); 1.37353 + this._currentPath.cubicCurveTo(cp1x * 20 | 0, cp1y * 20 | 0, cp2x * 20 | 0, cp2y * 20 | 0, x * 20 | 0, y * 20 | 0); 1.37354 + }, 1.37355 + curveTo: function (cpx, cpy, x, y) { 1.37356 + this._invalidate(); 1.37357 + this._currentPath.curveTo(cpx * 20 | 0, cpy * 20 | 0, x * 20 | 0, y * 20 | 0); 1.37358 + }, 1.37359 + drawCircle: function (x, y, radius) { 1.37360 + var radius2 = radius * 2; 1.37361 + this.drawRoundRect(x - radius, y - radius, radius2, radius2, radius2, radius2); 1.37362 + }, 1.37363 + drawEllipse: function (x, y, width, height) { 1.37364 + this.drawRoundRect(x, y, width, height, width, height); 1.37365 + }, 1.37366 + drawPath: function (commands, data, winding) { 1.37367 + this._invalidate(); 1.37368 + this.beginPath(); 1.37369 + this._currentPath.fillRule = winding || GRAPHICS_PATH_WINDING_EVEN_ODD; 1.37370 + this._currentPath.commands = commands; 1.37371 + this._currentPath.data = data; 1.37372 + }, 1.37373 + drawRect: function (x, y, w, h) { 1.37374 + if (isNaN(w + h)) 1.37375 + throwError('ArgumentError', Errors.InvalidParamError); 1.37376 + this._invalidate(); 1.37377 + this._currentPath.rect(x * 20 | 0, y * 20 | 0, w * 20 | 0, h * 20 | 0); 1.37378 + }, 1.37379 + drawRoundRect: function (x, y, w, h, ellipseWidth, ellipseHeight) { 1.37380 + if (isNaN(w + h + ellipseWidth) || ellipseHeight !== undefined && isNaN(ellipseHeight)) { 1.37381 + throwError('ArgumentError', Errors.InvalidParamError); 1.37382 + } 1.37383 + this._invalidate(); 1.37384 + if (ellipseHeight === undefined) { 1.37385 + ellipseHeight = ellipseWidth; 1.37386 + } 1.37387 + x = x * 20 | 0; 1.37388 + y = y * 20 | 0; 1.37389 + w = w * 20 | 0; 1.37390 + h = h * 20 | 0; 1.37391 + if (!ellipseHeight || !ellipseWidth) { 1.37392 + this._currentPath.rect(x, y, w, h); 1.37393 + return; 1.37394 + } 1.37395 + var radiusX = ellipseWidth / 2 * 20 | 0; 1.37396 + var radiusY = ellipseHeight / 2 * 20 | 0; 1.37397 + var hw = w / 2 | 0; 1.37398 + var hh = h / 2 | 0; 1.37399 + if (radiusX > hw) { 1.37400 + radiusX = hw; 1.37401 + } 1.37402 + if (radiusY > hh) { 1.37403 + radiusY = hh; 1.37404 + } 1.37405 + if (hw === radiusX && hh === radiusY) { 1.37406 + if (radiusX === radiusY) 1.37407 + this._currentPath.circle(x + radiusX, y + radiusY, radiusX); 1.37408 + else 1.37409 + this._currentPath.ellipse(x + radiusX, y + radiusY, radiusX, radiusY); 1.37410 + return; 1.37411 + } 1.37412 + var right = x + w; 1.37413 + var bottom = y + h; 1.37414 + var xlw = x + radiusX; 1.37415 + var xrw = right - radiusX; 1.37416 + var ytw = y + radiusY; 1.37417 + var ybw = bottom - radiusY; 1.37418 + this._currentPath.moveTo(right, ybw); 1.37419 + this._currentPath.curveTo(right, bottom, xrw, bottom); 1.37420 + this._currentPath.lineTo(xlw, bottom); 1.37421 + this._currentPath.curveTo(x, bottom, x, ybw); 1.37422 + this._currentPath.lineTo(x, ytw); 1.37423 + this._currentPath.curveTo(x, y, xlw, y); 1.37424 + this._currentPath.lineTo(xrw, y); 1.37425 + this._currentPath.curveTo(right, y, right, ytw); 1.37426 + this._currentPath.lineTo(right, ybw); 1.37427 + }, 1.37428 + drawRoundRectComplex: function (x, y, w, h, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius) { 1.37429 + if (isNaN(w + h + topLeftRadius + topRightRadius + bottomLeftRadius + bottomRightRadius)) { 1.37430 + throwError('ArgumentError', Errors.InvalidParamError); 1.37431 + } 1.37432 + this._invalidate(); 1.37433 + x = x * 20 | 0; 1.37434 + y = y * 20 | 0; 1.37435 + w = w * 20 | 0; 1.37436 + h = h * 20 | 0; 1.37437 + if (!topLeftRadius && !topRightRadius && !bottomLeftRadius && !bottomRightRadius) { 1.37438 + this._currentPath.rect(x, y, w, h); 1.37439 + return; 1.37440 + } 1.37441 + topLeftRadius = topLeftRadius * 20 | 0; 1.37442 + topRightRadius = topRightRadius * 20 | 0; 1.37443 + bottomLeftRadius = bottomLeftRadius * 20 | 0; 1.37444 + bottomRightRadius = bottomRightRadius * 20 | 0; 1.37445 + var right = x + w; 1.37446 + var bottom = y + h; 1.37447 + var xtl = x + topLeftRadius; 1.37448 + this._currentPath.moveTo(right, bottom - bottomRightRadius); 1.37449 + this._currentPath.curveTo(right, bottom, right - bottomRightRadius, bottom); 1.37450 + this._currentPath.lineTo(x + bottomLeftRadius, bottom); 1.37451 + this._currentPath.curveTo(x, bottom, x, bottom - bottomLeftRadius); 1.37452 + this._currentPath.lineTo(x, y + topLeftRadius); 1.37453 + this._currentPath.curveTo(x, y, xtl, y); 1.37454 + this._currentPath.lineTo(right - topRightRadius, y); 1.37455 + this._currentPath.curveTo(right, y, right, y + topRightRadius); 1.37456 + this._currentPath.lineTo(right, bottom - bottomRightRadius); 1.37457 + }, 1.37458 + drawTriangles: function (vertices, indices, uvtData, cullingStr) { 1.37459 + if (vertices === null || vertices.length === 0) { 1.37460 + return; 1.37461 + } 1.37462 + var numVertices = vertices.length / 2; 1.37463 + var numTriangles = 0; 1.37464 + if (indices) { 1.37465 + if (indices.length % 3) { 1.37466 + throwError('ArgumentError', Errors.InvalidParamError); 1.37467 + } else { 1.37468 + numTriangles = indices.length / 3; 1.37469 + } 1.37470 + } else { 1.37471 + if (vertices.length % 6) { 1.37472 + throwError('ArgumentError', Errors.InvalidParamError); 1.37473 + } else { 1.37474 + numTriangles = vertices.length / 6; 1.37475 + } 1.37476 + } 1.37477 + var numStrides = 0; 1.37478 + if (uvtData) { 1.37479 + if (uvtData.length == numVertices * 2) { 1.37480 + numStrides = 2; 1.37481 + } else if (uvtData.length == numVertices * 3) { 1.37482 + numStrides = 3; 1.37483 + } else { 1.37484 + throwError('ArgumentError', Errors.InvalidParamError); 1.37485 + } 1.37486 + } 1.37487 + var culling = 0; 1.37488 + if (cullingStr === 'none') { 1.37489 + culling = 0; 1.37490 + } else if (cullingStr === 'negative') { 1.37491 + culling = -1; 1.37492 + } else if (cullingStr === 'positive') { 1.37493 + culling = 1; 1.37494 + } else { 1.37495 + throwError('ArgumentError', Errors.InvalidEnumError, 'culling'); 1.37496 + } 1.37497 + notImplemented('Graphics#drawTriangles'); 1.37498 + }, 1.37499 + endFill: function () { 1.37500 + this.beginPath(); 1.37501 + this._currentPath.fillStyle = null; 1.37502 + }, 1.37503 + lineBitmapStyle: function (bitmap, matrix, repeat, smooth) { 1.37504 + this.beginPath(); 1.37505 + this._currentPath.lineStyle = createPatternStyle(bitmap, matrix, repeat, smooth); 1.37506 + }, 1.37507 + lineGradientStyle: function (type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPos) { 1.37508 + var style = createGradientStyle(type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPos); 1.37509 + this.beginPath(); 1.37510 + this._currentPath.lineStyle = style; 1.37511 + }, 1.37512 + lineStyle: function (width, color, alpha, pxHinting, scale, cap, joint, mlimit) { 1.37513 + this.beginPath(); 1.37514 + if (width) { 1.37515 + if (alpha === undefined) 1.37516 + alpha = 1; 1.37517 + if (mlimit === undefined) 1.37518 + mlimit = 3; 1.37519 + this._currentPath.lineStyle = { 1.37520 + style: rgbIntAlphaToStr(color, alpha), 1.37521 + lineCap: cap || 'round', 1.37522 + lineJoin: cap || 'round', 1.37523 + width: width * 20 | 0, 1.37524 + miterLimit: mlimit * 2 1.37525 + }; 1.37526 + } else { 1.37527 + this._currentPath.lineStyle = null; 1.37528 + } 1.37529 + }, 1.37530 + lineTo: function (x, y) { 1.37531 + this._invalidate(); 1.37532 + this._currentPath.lineTo(x * 20 | 0, y * 20 | 0); 1.37533 + }, 1.37534 + moveTo: function (x, y) { 1.37535 + this._currentPath.moveTo(x * 20 | 0, y * 20 | 0); 1.37536 + }, 1.37537 + _getBounds: function (includeStroke) { 1.37538 + var bbox = includeStroke ? this.strokeBbox : this.bbox; 1.37539 + if (bbox) { 1.37540 + return bbox; 1.37541 + } 1.37542 + var subpaths = this._paths; 1.37543 + var xMins = [], yMins = [], xMaxs = [], yMaxs = []; 1.37544 + for (var i = 0, n = subpaths.length; i < n; i++) { 1.37545 + var path = subpaths[i]; 1.37546 + if (path.commands.length) { 1.37547 + var b = path.getBounds(includeStroke); 1.37548 + if (b) { 1.37549 + xMins.push(b.xMin); 1.37550 + yMins.push(b.yMin); 1.37551 + xMaxs.push(b.xMax); 1.37552 + yMaxs.push(b.yMax); 1.37553 + } 1.37554 + } 1.37555 + } 1.37556 + if (xMins.length === 0) { 1.37557 + bbox = { 1.37558 + xMin: 0, 1.37559 + yMin: 0, 1.37560 + xMax: 0, 1.37561 + yMax: 0 1.37562 + }; 1.37563 + } else { 1.37564 + bbox = { 1.37565 + xMin: Math.min.apply(Math, xMins), 1.37566 + yMin: Math.min.apply(Math, yMins), 1.37567 + xMax: Math.max.apply(Math, xMaxs), 1.37568 + yMax: Math.max.apply(Math, yMaxs) 1.37569 + }; 1.37570 + } 1.37571 + if (includeStroke) { 1.37572 + this.strokeBbox = bbox; 1.37573 + } else { 1.37574 + this.bbox = bbox; 1.37575 + } 1.37576 + return bbox; 1.37577 + } 1.37578 + }; 1.37579 + def.__glue__ = { 1.37580 + native: { 1.37581 + instance: { 1.37582 + beginFill: def.beginFill, 1.37583 + beginGradientFill: def.beginGradientFill, 1.37584 + beginBitmapFill: def.beginBitmapFill, 1.37585 + beginFillObject: def.beginFillObject, 1.37586 + beginStrokeObject: def.beginStrokeObject, 1.37587 + clear: def.clear, 1.37588 + copyFrom: def.copyFrom, 1.37589 + cubicCurveTo: def.cubicCurveTo, 1.37590 + curveTo: def.curveTo, 1.37591 + drawCircle: def.drawCircle, 1.37592 + drawEllipse: def.drawEllipse, 1.37593 + drawPath: def.drawPath, 1.37594 + drawRect: def.drawRect, 1.37595 + drawRoundRect: def.drawRoundRect, 1.37596 + drawRoundRectComplex: def.drawRoundRectComplex, 1.37597 + drawTriangles: def.drawTriangles, 1.37598 + endFill: def.endFill, 1.37599 + lineBitmapStyle: def.lineBitmapStyle, 1.37600 + lineGradientStyle: def.lineGradientStyle, 1.37601 + lineStyle: def.lineStyle, 1.37602 + moveTo: def.moveTo, 1.37603 + lineTo: def.lineTo 1.37604 + } 1.37605 + } 1.37606 + }; 1.37607 + return def; 1.37608 + }.call(this); 1.37609 +function createPatternStyle(bitmap, matrix, repeat, smooth) { 1.37610 + var repeatStyle = repeat === false ? 'no-repeat' : 'repeat'; 1.37611 + var pattern = factoryCtx.createPattern(bitmap._drawable, repeatStyle); 1.37612 + var transform = matrix ? { 1.37613 + a: matrix.a, 1.37614 + b: matrix.b, 1.37615 + c: matrix.c, 1.37616 + d: matrix.d, 1.37617 + e: matrix.tx, 1.37618 + f: matrix.ty 1.37619 + } : { 1.37620 + a: 1, 1.37621 + b: 0, 1.37622 + c: 0, 1.37623 + d: 1, 1.37624 + e: 0, 1.37625 + f: 0 1.37626 + }; 1.37627 + return { 1.37628 + style: pattern, 1.37629 + transform: transform, 1.37630 + smooth: smooth 1.37631 + }; 1.37632 +} 1.37633 +function createGradientStyle(type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPos) { 1.37634 + type === null || type === undefined && throwError('TypeError', Errors.NullPointerError, 'type'); 1.37635 + colors === null || type === undefined && throwError('TypeError', Errors.NullPointerError, 'colors'); 1.37636 + if (!(type === 'linear' || type === 'radial')) { 1.37637 + throwError('ArgumentError', Errors.InvalidEnumError, 'type'); 1.37638 + } 1.37639 + var colorStops = []; 1.37640 + for (var i = 0, n = colors.length; i < n; i++) { 1.37641 + colorStops.push({ 1.37642 + ratio: ratios[i] / 255, 1.37643 + color: rgbIntAlphaToStr(colors[i], alphas[i]) 1.37644 + }); 1.37645 + } 1.37646 + var gradientConstructor; 1.37647 + if (type === 'linear') { 1.37648 + gradientConstructor = buildLinearGradientFactory(colorStops); 1.37649 + } else { 1.37650 + gradientConstructor = buildRadialGradientFactory(focalPos || 0, colorStops); 1.37651 + } 1.37652 + var scale = 819.2; 1.37653 + var transform = matrix ? { 1.37654 + a: scale * matrix.a, 1.37655 + b: scale * matrix.b, 1.37656 + c: scale * matrix.c, 1.37657 + d: scale * matrix.d, 1.37658 + e: matrix.tx, 1.37659 + f: matrix.ty 1.37660 + } : { 1.37661 + a: scale, 1.37662 + b: 0, 1.37663 + c: 0, 1.37664 + d: scale, 1.37665 + e: 0, 1.37666 + f: 0 1.37667 + }; 1.37668 + return { 1.37669 + style: gradientConstructor, 1.37670 + transform: transform 1.37671 + }; 1.37672 +} 1.37673 +function drawGraphicsData(data) { 1.37674 + if (data === null) { 1.37675 + return; 1.37676 + } 1.37677 + for (var i = 0; i < data.length; i++) { 1.37678 + var item = data[i]; 1.37679 + if (flash.display.IGraphicsPath.class.isInstanceOf(item)) { 1.37680 + this._drawPathObject(item); 1.37681 + } else if (flash.display.IGraphicsStroke.class.isInstanceOf(item)) { 1.37682 + this.beginStrokeObject(item); 1.37683 + } else if (flash.display.IGraphicsFill.class.isInstanceOf(item)) { 1.37684 + this.beginFillObject(item); 1.37685 + } 1.37686 + } 1.37687 +} 1.37688 +var InteractiveObjectDefinition = function () { 1.37689 + var def = { 1.37690 + initialize: function () { 1.37691 + this._contextMenu = null; 1.37692 + this._doubleClickEnabled = false; 1.37693 + this._focusRect = null; 1.37694 + this._mouseEnabled = true; 1.37695 + this._tabEnabled = false; 1.37696 + }, 1.37697 + get accessibilityImplementation() { 1.37698 + return null; 1.37699 + }, 1.37700 + set accessibilityImplementation(val) { 1.37701 + somewhatImplemented('accessibilityImplementation'); 1.37702 + }, 1.37703 + get contextMenu() { 1.37704 + somewhatImplemented('contextMenu'); 1.37705 + return this._contextMenu; 1.37706 + }, 1.37707 + set contextMenu(val) { 1.37708 + somewhatImplemented('contextMenu'); 1.37709 + this._contextMenu = val; 1.37710 + }, 1.37711 + get doubleClickEnabled() { 1.37712 + return this._doubleClickEnabled; 1.37713 + }, 1.37714 + set doubleClickEnabled(val) { 1.37715 + this._doubleClickEnabled = val; 1.37716 + }, 1.37717 + get focusRect() { 1.37718 + return this._focusRect; 1.37719 + }, 1.37720 + set focusRect(val) { 1.37721 + this._focusRect = val; 1.37722 + }, 1.37723 + get mouseEnabled() { 1.37724 + return this._mouseEnabled; 1.37725 + }, 1.37726 + set mouseEnabled(val) { 1.37727 + this._mouseEnabled = val; 1.37728 + }, 1.37729 + get needsSoftKeyboard() { 1.37730 + return false; 1.37731 + }, 1.37732 + set needsSoftKeyboard(val) { 1.37733 + notImplemented(); 1.37734 + }, 1.37735 + get softKeyboardInputAreaOfInterest() { 1.37736 + return null; 1.37737 + }, 1.37738 + set softKeyboardInputAreaOfInterest(val) { 1.37739 + notImplemented(); 1.37740 + }, 1.37741 + get tabEnabled() { 1.37742 + return this._tabEnabled; 1.37743 + }, 1.37744 + set tabEnabled(val) { 1.37745 + var old = this._tabEnabled; 1.37746 + this._tabEnabled = val; 1.37747 + if (old !== val) { 1.37748 + var Event = flash.events.Event; 1.37749 + this._dispatchEvent(new Event('tabEnabledChange', false, false)); 1.37750 + } 1.37751 + }, 1.37752 + requestSoftKeyboard: function () { 1.37753 + notImplemented(); 1.37754 + } 1.37755 + }; 1.37756 + var desc = Object.getOwnPropertyDescriptor; 1.37757 + def.__glue__ = { 1.37758 + native: { 1.37759 + instance: { 1.37760 + tabEnabled: desc(def, 'tabEnabled'), 1.37761 + tabIndex: { 1.37762 + get: function tabIndex() { 1.37763 + return this._tabIndex; 1.37764 + }, 1.37765 + set: function tabIndex(index) { 1.37766 + this._tabIndex = index; 1.37767 + } 1.37768 + }, 1.37769 + focusRect: desc(def, 'focusRect'), 1.37770 + mouseEnabled: desc(def, 'mouseEnabled'), 1.37771 + doubleClickEnabled: desc(def, 'doubleClickEnabled'), 1.37772 + accessibilityImplementation: desc(def, 'accessibilityImplementation'), 1.37773 + softKeyboardInputAreaOfInterest: desc(def, 'softKeyboardInputAreaOfInterest'), 1.37774 + needsSoftKeyboard: desc(def, 'needsSoftKeyboard'), 1.37775 + contextMenu: desc(def, 'contextMenu'), 1.37776 + requestSoftKeyboard: def.requestSoftKeyboard 1.37777 + } 1.37778 + } 1.37779 + }; 1.37780 + return def; 1.37781 + }.call(this); 1.37782 +var $RELEASE = false; 1.37783 +var LoaderDefinition = function () { 1.37784 + var WORKERS_ENABLED = true; 1.37785 + var LOADER_PATH = true ? 'shumway-worker.js' : 'swf/resourceloader.js'; 1.37786 + var head = document.head; 1.37787 + head.insertBefore(document.createElement('style'), head.firstChild); 1.37788 + var style = document.styleSheets[0]; 1.37789 + var def = { 1.37790 + __class__: 'flash.display.Loader', 1.37791 + initialize: function () { 1.37792 + this._contentLoaderInfo = new flash.display.LoaderInfo(); 1.37793 + this._contentLoaderInfo._loader = this; 1.37794 + this._dictionary = {}; 1.37795 + this._dictionaryResolved = {}; 1.37796 + this._displayList = null; 1.37797 + this._timeline = []; 1.37798 + this._lastPromise = null; 1.37799 + this._uncaughtErrorEvents = null; 1.37800 + this._worker = null; 1.37801 + var abc = AVM2.currentAbc(); 1.37802 + if (abc && abc.env.loader) { 1.37803 + this._contentLoaderInfo._loaderURL = abc.env.loader._contentLoaderInfo._url; 1.37804 + } 1.37805 + }, 1.37806 + _commitData: function (data) { 1.37807 + switch (data.command) { 1.37808 + case 'init': 1.37809 + this._init(data.result); 1.37810 + break; 1.37811 + case 'progress': 1.37812 + this._updateProgress(data.result); 1.37813 + break; 1.37814 + case 'complete': 1.37815 + var frameConstructed = new Promise(function (resolve) { 1.37816 + avm2.systemDomain.onMessage.register('frameConstructed', function waitForFrame(type) { 1.37817 + if (type === 'frameConstructed') { 1.37818 + resolve(); 1.37819 + avm2.systemDomain.onMessage.unregister('frameConstructed', waitForFrame); 1.37820 + } 1.37821 + }); 1.37822 + }); 1.37823 + this._contentLoaderInfo._dispatchEvent('parsed'); 1.37824 + Promise.all([ 1.37825 + frameConstructed, 1.37826 + this._lastPromise 1.37827 + ]).then(function () { 1.37828 + this._content._complete = true; 1.37829 + this._contentLoaderInfo._dispatchEvent('complete'); 1.37830 + }.bind(this)); 1.37831 + var stats = data.stats; 1.37832 + if (stats) { 1.37833 + TelemetryService.reportTelemetry(stats); 1.37834 + } 1.37835 + this._worker && this._worker.terminate(); 1.37836 + break; 1.37837 + case 'empty': 1.37838 + this._lastPromise = Promise.resolve(); 1.37839 + break; 1.37840 + case 'error': 1.37841 + this._contentLoaderInfo._dispatchEvent('ioError', flash.events.IOErrorEvent); 1.37842 + break; 1.37843 + default: 1.37844 + if (data.id === 0) 1.37845 + break; 1.37846 + if (data.isSymbol) 1.37847 + this._commitSymbol(data); 1.37848 + else if (data.type === 'frame') 1.37849 + this._commitFrame(data); 1.37850 + else if (data.type === 'image') 1.37851 + this._commitImage(data); 1.37852 + break; 1.37853 + } 1.37854 + }, 1.37855 + _updateProgress: function (state) { 1.37856 + var loaderInfo = this._contentLoaderInfo; 1.37857 + loaderInfo._bytesLoaded = state.bytesLoaded || 0; 1.37858 + loaderInfo._bytesTotal = state.bytesTotal || 0; 1.37859 + var event = new flash.events.ProgressEvent('progress', false, false, loaderInfo._bytesLoaded, loaderInfo._bytesTotal); 1.37860 + loaderInfo._dispatchEvent(event); 1.37861 + }, 1.37862 + _buildFrame: function (currentDisplayList, timeline, promiseQueue, frame, frameNum) { 1.37863 + var loader = this; 1.37864 + var dictionary = loader._dictionary; 1.37865 + var dictionaryResolved = loader._dictionaryResolved; 1.37866 + var displayList = {}; 1.37867 + var depths = []; 1.37868 + var cmds = frame.depths; 1.37869 + if (currentDisplayList) { 1.37870 + var currentDepths = currentDisplayList.depths; 1.37871 + for (var i = 0; i < currentDepths.length; i++) { 1.37872 + var depth = currentDepths[i]; 1.37873 + if (cmds[depth] === null) { 1.37874 + continue; 1.37875 + } 1.37876 + displayList[depth] = currentDisplayList[depth]; 1.37877 + depths.push(depth); 1.37878 + } 1.37879 + } 1.37880 + for (var depth in cmds) { 1.37881 + var cmd = cmds[depth]; 1.37882 + if (!cmd) { 1.37883 + continue; 1.37884 + } 1.37885 + if (cmd.move) { 1.37886 + var oldCmd = cmd; 1.37887 + cmd = cloneObject(currentDisplayList[depth]); 1.37888 + for (var prop in oldCmd) { 1.37889 + var val = oldCmd[prop]; 1.37890 + if (val) { 1.37891 + cmd[prop] = val; 1.37892 + } 1.37893 + } 1.37894 + } 1.37895 + if (cmd.symbolId) { 1.37896 + var itemPromise = dictionary[cmd.symbolId]; 1.37897 + if (itemPromise && !dictionaryResolved[cmd.symbolId]) { 1.37898 + promiseQueue.push(itemPromise); 1.37899 + } 1.37900 + cmd = cloneObject(cmd); 1.37901 + Object.defineProperty(cmd, 'symbolInfo', { 1.37902 + get: function (dictionaryResolved, symbolId) { 1.37903 + return function () { 1.37904 + return dictionaryResolved[symbolId]; 1.37905 + }; 1.37906 + }(dictionaryResolved, cmd.symbolId) 1.37907 + }); 1.37908 + } 1.37909 + if (!displayList[depth]) { 1.37910 + depths.push(depth); 1.37911 + } 1.37912 + displayList[depth] = cmd; 1.37913 + } 1.37914 + depths.sort(sortNumeric); 1.37915 + displayList.depths = depths; 1.37916 + var i = frame.repeat; 1.37917 + while (i--) { 1.37918 + timeline.push(displayList); 1.37919 + } 1.37920 + return displayList; 1.37921 + }, 1.37922 + _commitFrame: function (frame) { 1.37923 + var abcBlocks = frame.abcBlocks; 1.37924 + var actionBlocks = frame.actionBlocks; 1.37925 + var initActionBlocks = frame.initActionBlocks; 1.37926 + var exports = frame.exports; 1.37927 + var symbolClasses = frame.symbolClasses; 1.37928 + var sceneData = frame.sceneData; 1.37929 + var loader = this; 1.37930 + var dictionary = loader._dictionary; 1.37931 + var loaderInfo = loader._contentLoaderInfo; 1.37932 + var timeline = loader._timeline; 1.37933 + var frameNum = timeline.length + 1; 1.37934 + var framePromiseResolve; 1.37935 + var framePromise = new Promise(function (resolve) { 1.37936 + framePromiseResolve = resolve; 1.37937 + }); 1.37938 + var labelName = frame.labelName; 1.37939 + var prevPromise = this._lastPromise; 1.37940 + this._lastPromise = framePromise; 1.37941 + var promiseQueue = [ 1.37942 + prevPromise 1.37943 + ]; 1.37944 + this._displayList = this._buildFrame(this._displayList, timeline, promiseQueue, frame, frameNum); 1.37945 + var framesLoaded = timeline.length; 1.37946 + if (frame.bgcolor) 1.37947 + loaderInfo._backgroundColor = frame.bgcolor; 1.37948 + else if (isNullOrUndefined(loaderInfo._backgroundColor)) 1.37949 + loaderInfo._backgroundColor = { 1.37950 + red: 255, 1.37951 + green: 255, 1.37952 + blue: 255, 1.37953 + alpha: 255 1.37954 + }; 1.37955 + Promise.all(promiseQueue).then(function () { 1.37956 + if (abcBlocks && loader._isAvm2Enabled) { 1.37957 + var appDomain = avm2.applicationDomain; 1.37958 + for (var i = 0, n = abcBlocks.length; i < n; i++) { 1.37959 + var abc = new AbcFile(abcBlocks[i].data, 'abc_block_' + i); 1.37960 + abc.env.loader = loader; 1.37961 + if (abcBlocks[i].flags) { 1.37962 + appDomain.loadAbc(abc); 1.37963 + } else { 1.37964 + appDomain.executeAbc(abc); 1.37965 + } 1.37966 + } 1.37967 + } 1.37968 + if (symbolClasses && loader._isAvm2Enabled) { 1.37969 + var symbolClassesPromises = []; 1.37970 + for (var i = 0, n = symbolClasses.length; i < n; i++) { 1.37971 + var asset = symbolClasses[i]; 1.37972 + var symbolPromise = dictionary[asset.symbolId]; 1.37973 + if (!symbolPromise) 1.37974 + continue; 1.37975 + symbolPromise.then(function (className) { 1.37976 + return function symbolPromiseResolved(symbolInfo) { 1.37977 + symbolInfo.className = className; 1.37978 + avm2.applicationDomain.getClass(className).setSymbol(symbolInfo.props); 1.37979 + }; 1.37980 + }(asset.className)); 1.37981 + symbolClassesPromises.push(symbolPromise); 1.37982 + } 1.37983 + return Promise.all(symbolClassesPromises); 1.37984 + } 1.37985 + if (exports && !loader._isAvm2Enabled) { 1.37986 + var exportPromises = []; 1.37987 + for (var i = 0, n = exports.length; i < n; i++) { 1.37988 + var asset = exports[i]; 1.37989 + var symbolPromise = dictionary[asset.symbolId]; 1.37990 + if (!symbolPromise) 1.37991 + continue; 1.37992 + symbolPromise.then(function (className) { 1.37993 + return function symbolPromiseResolved(symbolInfo) { 1.37994 + loader._avm1Context.addAsset(className, symbolInfo.props); 1.37995 + }; 1.37996 + }(asset.className)); 1.37997 + exportPromises.push(symbolPromise); 1.37998 + } 1.37999 + return Promise.all(exportPromises); 1.38000 + } 1.38001 + }).then(function () { 1.38002 + var root = loader._content; 1.38003 + var labelMap; 1.38004 + if (!root) { 1.38005 + var parent = loader._parent; 1.38006 + true; 1.38007 + var rootInfo = loader._dictionaryResolved[0]; 1.38008 + var rootClass = avm2.applicationDomain.getClass(rootInfo.className); 1.38009 + root = rootClass.createAsSymbol({ 1.38010 + framesLoaded: framesLoaded, 1.38011 + loader: loader, 1.38012 + parent: parent || loader, 1.38013 + index: parent ? 0 : -1, 1.38014 + level: parent ? 0 : -1, 1.38015 + timeline: timeline, 1.38016 + totalFrames: rootInfo.props.totalFrames, 1.38017 + stage: loader._stage, 1.38018 + complete: frame.complete 1.38019 + }); 1.38020 + if (!loader._isAvm2Enabled) { 1.38021 + var avm1Context = loader._avm1Context; 1.38022 + var _root = root; 1.38023 + if (parent && parent !== loader._stage) { 1.38024 + var parentLoader = parent.loaderInfo._loader; 1.38025 + while (parentLoader._parent && parentLoader._parent !== loader._stage) { 1.38026 + parentLoader = parentLoader._parent.loaderInfo._loader; 1.38027 + } 1.38028 + if (parentLoader._isAvm2Enabled) { 1.38029 + somewhatImplemented('AVM1Movie'); 1.38030 + this._worker && this._worker.terminate(); 1.38031 + return; 1.38032 + } 1.38033 + _root = parentLoader._content; 1.38034 + } 1.38035 + var as2Object = _root._getAS2Object(); 1.38036 + avm1Context.globals.asSetPublicProperty('_root', as2Object); 1.38037 + avm1Context.globals.asSetPublicProperty('_level0', as2Object); 1.38038 + avm1Context.globals.asSetPublicProperty('_level1', as2Object); 1.38039 + var parameters = loader.loaderInfo._parameters; 1.38040 + for (var paramName in parameters) { 1.38041 + if (!(paramName in as2Object)) { 1.38042 + as2Object[paramName] = parameters[paramName]; 1.38043 + } 1.38044 + } 1.38045 + } 1.38046 + var isRootMovie = parent && parent == loader._stage && loader._stage._children.length === 0; 1.38047 + if (isRootMovie) { 1.38048 + parent._frameRate = loaderInfo._frameRate; 1.38049 + parent._stageHeight = loaderInfo._height; 1.38050 + parent._stageWidth = loaderInfo._width; 1.38051 + parent._root = root; 1.38052 + parent._setup(); 1.38053 + } else { 1.38054 + loader._children.push(root); 1.38055 + } 1.38056 + var labels; 1.38057 + labelMap = root.symbol.labelMap = createEmptyObject(); 1.38058 + if (sceneData) { 1.38059 + var scenes = []; 1.38060 + var startFrame; 1.38061 + var endFrame = root.symbol.totalFrames - 1; 1.38062 + var sd = sceneData.scenes; 1.38063 + var ld = sceneData.labels; 1.38064 + var i = sd.length; 1.38065 + while (i--) { 1.38066 + var s = sd[i]; 1.38067 + startFrame = s.offset; 1.38068 + labels = []; 1.38069 + var j = ld.length; 1.38070 + while (j--) { 1.38071 + var lbl = ld[j]; 1.38072 + if (lbl.frame >= startFrame && lbl.frame <= endFrame) { 1.38073 + labelMap[lbl.name] = lbl.frame + 1; 1.38074 + labels.unshift(new flash.display.FrameLabel(lbl.name, lbl.frame - startFrame + 1)); 1.38075 + } 1.38076 + } 1.38077 + var scene = new flash.display.Scene(s.name, labels, endFrame - startFrame + 1); 1.38078 + scene._startFrame = startFrame + 1; 1.38079 + scene._endFrame = endFrame + 1; 1.38080 + scenes.unshift(scene); 1.38081 + endFrame = startFrame - 1; 1.38082 + } 1.38083 + root.symbol.scenes = scenes; 1.38084 + } else { 1.38085 + labels = []; 1.38086 + if (labelName) { 1.38087 + labelMap[labelName] = frameNum; 1.38088 + labels.push(new flash.display.FrameLabel(labelName, frameNum)); 1.38089 + } 1.38090 + var scene = new flash.display.Scene('Scene 1', labels, root.symbol.totalFrames); 1.38091 + scene._startFrame = 1; 1.38092 + scene._endFrame = root.symbol.totalFrames; 1.38093 + root.symbol.scenes = [ 1.38094 + scene 1.38095 + ]; 1.38096 + } 1.38097 + if (loader._stage) { 1.38098 + loader._stage._children[0] = root; 1.38099 + } 1.38100 + rootClass.instanceConstructor.call(root); 1.38101 + loader._content = root; 1.38102 + } else { 1.38103 + root._framesLoaded = framesLoaded; 1.38104 + if (labelName && root._labelMap) { 1.38105 + if (root._labelMap[labelName] === undefined) { 1.38106 + root._labelMap[labelName] = frameNum; 1.38107 + for (var i = 0, n = root.symbol.scenes.length; i < n; i++) { 1.38108 + var scene = root.symbol.scenes[i]; 1.38109 + if (frameNum >= scene._startFrame && frameNum <= scene._endFrame) { 1.38110 + scene.labels.push(new flash.display.FrameLabel(labelName, frameNum - scene._startFrame)); 1.38111 + break; 1.38112 + } 1.38113 + } 1.38114 + } 1.38115 + } 1.38116 + } 1.38117 + if (frame.startSounds) { 1.38118 + root._registerStartSounds(frameNum, frame.startSounds); 1.38119 + } 1.38120 + if (frame.soundStream) { 1.38121 + root._initSoundStream(frame.soundStream); 1.38122 + } 1.38123 + if (frame.soundStreamBlock) { 1.38124 + root._addSoundStreamBlock(frameNum, frame.soundStreamBlock); 1.38125 + } 1.38126 + if (!loader._isAvm2Enabled) { 1.38127 + var avm1Context = loader._avm1Context; 1.38128 + if (initActionBlocks) { 1.38129 + for (var i = 0; i < initActionBlocks.length; i++) { 1.38130 + var spriteId = initActionBlocks[i].spriteId; 1.38131 + var actionsData = initActionBlocks[i].actionsData; 1.38132 + root.addFrameScript(frameNum - 1, function (actionsData, spriteId, state) { 1.38133 + if (state.executed) 1.38134 + return; 1.38135 + state.executed = true; 1.38136 + return executeActions(actionsData, avm1Context, this._getAS2Object()); 1.38137 + }.bind(root, actionsData, spriteId, { 1.38138 + executed: false 1.38139 + })); 1.38140 + } 1.38141 + } 1.38142 + if (actionBlocks) { 1.38143 + for (var i = 0; i < actionBlocks.length; i++) { 1.38144 + var block = actionBlocks[i]; 1.38145 + root.addFrameScript(frameNum - 1, function (block) { 1.38146 + return function () { 1.38147 + return executeActions(block, avm1Context, this._getAS2Object()); 1.38148 + }; 1.38149 + }(block)); 1.38150 + } 1.38151 + } 1.38152 + } 1.38153 + if (frameNum === 1) 1.38154 + loaderInfo._dispatchEvent(new flash.events.Event('init', false, false)); 1.38155 + framePromiseResolve(frame); 1.38156 + }); 1.38157 + }, 1.38158 + _commitImage: function (imageInfo) { 1.38159 + var loader = this; 1.38160 + var imgPromiseResolve; 1.38161 + var imgPromise = this._lastPromise = new Promise(function (resolve) { 1.38162 + imgPromiseResolve = resolve; 1.38163 + }); 1.38164 + var img = new Image(); 1.38165 + imageInfo.props.img = img; 1.38166 + img.onload = function () { 1.38167 + var Bitmap = avm2.systemDomain.getClass('flash.display.Bitmap'); 1.38168 + var BitmapData = avm2.systemDomain.getClass('flash.display.BitmapData'); 1.38169 + var props = imageInfo.props; 1.38170 + props.parent = loader._parent; 1.38171 + props.stage = loader._stage; 1.38172 + props.skipCopyToCanvas = true; 1.38173 + var bitmapData = BitmapData.createAsSymbol(props); 1.38174 + BitmapData.instanceConstructor.call(bitmapData, 0, 0, true, 4294967295); 1.38175 + var image = Bitmap.createAsSymbol(bitmapData); 1.38176 + Bitmap.instanceConstructor.call(image, bitmapData); 1.38177 + image._parent = loader; 1.38178 + loader._children.push(image); 1.38179 + loader._invalidateBounds(); 1.38180 + loader._content = image; 1.38181 + imgPromiseResolve(imageInfo); 1.38182 + var loaderInfo = loader._contentLoaderInfo; 1.38183 + loaderInfo._width = image.width; 1.38184 + loaderInfo._height = image.height; 1.38185 + loaderInfo._dispatchEvent('init'); 1.38186 + }; 1.38187 + img.src = URL.createObjectURL(imageInfo.data); 1.38188 + imageInfo.data = null; 1.38189 + }, 1.38190 + _commitSymbol: function (symbol) { 1.38191 + var dictionary = this._dictionary; 1.38192 + var dictionaryResolved = this._dictionaryResolved; 1.38193 + if ('updates' in symbol) { 1.38194 + dictionary[symbol.id].then(function (s) { 1.38195 + for (var i in symbol.updates) { 1.38196 + s.props[i] = symbol.updates[i]; 1.38197 + } 1.38198 + }); 1.38199 + return; 1.38200 + } 1.38201 + var className = 'flash.display.DisplayObject'; 1.38202 + var dependencies = symbol.require; 1.38203 + var promiseQueue = []; 1.38204 + var props = { 1.38205 + symbolId: symbol.id, 1.38206 + loader: this 1.38207 + }; 1.38208 + var symbolPromiseResolve; 1.38209 + var symbolPromise = new Promise(function (resolve) { 1.38210 + symbolPromiseResolve = resolve; 1.38211 + }); 1.38212 + if (dependencies && dependencies.length) { 1.38213 + for (var i = 0, n = dependencies.length; i < n; i++) { 1.38214 + var dependencyId = dependencies[i]; 1.38215 + var dependencyPromise = dictionary[dependencyId]; 1.38216 + if (dependencyPromise && !dictionaryResolved[dependencyId]) 1.38217 + promiseQueue.push(dependencyPromise); 1.38218 + } 1.38219 + } 1.38220 + switch (symbol.type) { 1.38221 + case 'button': 1.38222 + var states = {}; 1.38223 + for (var stateName in symbol.states) { 1.38224 + var characters = []; 1.38225 + var displayList = {}; 1.38226 + var state = symbol.states[stateName]; 1.38227 + var depths = Object.keys(state); 1.38228 + for (var i = 0; i < depths.length; i++) { 1.38229 + var depth = depths[i]; 1.38230 + var cmd = state[depth]; 1.38231 + var characterPromise = dictionary[cmd.symbolId]; 1.38232 + if (characterPromise && !dictionaryResolved[cmd.symbolId]) { 1.38233 + promiseQueue.push(characterPromise); 1.38234 + } 1.38235 + characters.push(characterPromise); 1.38236 + displayList[depth] = Object.create(cmd, { 1.38237 + symbolInfo: { 1.38238 + get: function (dictionaryResolved, symbolId) { 1.38239 + return function () { 1.38240 + return dictionaryResolved[symbolId]; 1.38241 + }; 1.38242 + }(dictionaryResolved, cmd.symbolId) 1.38243 + } 1.38244 + }); 1.38245 + } 1.38246 + depths.sort(sortNumeric); 1.38247 + displayList.depths = depths; 1.38248 + states[stateName] = { 1.38249 + className: 'flash.display.Sprite', 1.38250 + props: { 1.38251 + loader: this, 1.38252 + timeline: [ 1.38253 + displayList 1.38254 + ] 1.38255 + } 1.38256 + }; 1.38257 + } 1.38258 + className = 'flash.display.SimpleButton'; 1.38259 + props.states = states; 1.38260 + props.buttonActions = symbol.buttonActions; 1.38261 + break; 1.38262 + case 'font': 1.38263 + var charset = fromCharCode.apply(null, symbol.codes); 1.38264 + if (charset) { 1.38265 + style.insertRule('@font-face{font-family:"' + symbol.uniqueName + '";' + 'src:url(data:font/opentype;base64,' + btoa(symbol.data) + ')' + '}', style.cssRules.length); 1.38266 + if (!/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.test(window.navigator.userAgent)) { 1.38267 + var testDiv = document.createElement('div'); 1.38268 + testDiv.setAttribute('style', 'position: absolute; top: 0; right: 0;visibility: hidden; z-index: -500;font-family:"' + symbol.uniqueName + '";'); 1.38269 + testDiv.textContent = 'font test'; 1.38270 + document.body.appendChild(testDiv); 1.38271 + var fontPromise = new Promise(function (resolve) { 1.38272 + setTimeout(function () { 1.38273 + resolve(); 1.38274 + document.body.removeChild(testDiv); 1.38275 + }, 200); 1.38276 + }); 1.38277 + promiseQueue.push(fontPromise); 1.38278 + } 1.38279 + } 1.38280 + className = 'flash.text.Font'; 1.38281 + props.name = symbol.name; 1.38282 + props.uniqueName = symbol.uniqueName; 1.38283 + props.charset = symbol.charset; 1.38284 + props.bold = symbol.bold; 1.38285 + props.italic = symbol.italic; 1.38286 + props.metrics = symbol.metrics; 1.38287 + this._registerFont(className, props); 1.38288 + break; 1.38289 + case 'image': 1.38290 + var img = new Image(); 1.38291 + var imgPromiseResolve; 1.38292 + var imgPromise = new Promise(function (resolve) { 1.38293 + imgPromiseResolve = resolve; 1.38294 + }); 1.38295 + img.onload = function () { 1.38296 + if (symbol.mask) { 1.38297 + var maskCanvas = document.createElement('canvas'); 1.38298 + maskCanvas.width = symbol.width; 1.38299 + maskCanvas.height = symbol.height; 1.38300 + var maskContext = maskCanvas.getContext('2d'); 1.38301 + maskContext.drawImage(img, 0, 0); 1.38302 + var maskImageData = maskContext.getImageData(0, 0, symbol.width, symbol.height); 1.38303 + var maskImageDataBytes = maskImageData.data; 1.38304 + var symbolMaskBytes = symbol.mask; 1.38305 + var length = maskImageData.width * maskImageData.height; 1.38306 + for (var i = 0, j = 3; i < length; i++, j += 4) { 1.38307 + maskImageDataBytes[j] = symbolMaskBytes[i]; 1.38308 + } 1.38309 + maskContext.putImageData(maskImageData, 0, 0); 1.38310 + props.img = maskCanvas; 1.38311 + } 1.38312 + imgPromiseResolve(); 1.38313 + }; 1.38314 + img.src = URL.createObjectURL(symbol.data); 1.38315 + promiseQueue.push(imgPromise); 1.38316 + className = 'flash.display.Bitmap'; 1.38317 + props.img = img; 1.38318 + props.width = symbol.width; 1.38319 + props.height = symbol.height; 1.38320 + break; 1.38321 + case 'label': 1.38322 + var drawFn = new Function('c,r,ct', symbol.data); 1.38323 + className = 'flash.text.StaticText'; 1.38324 + props.bbox = symbol.bbox; 1.38325 + props.draw = drawFn; 1.38326 + break; 1.38327 + case 'text': 1.38328 + props.bbox = symbol.bbox; 1.38329 + props.html = symbol.html; 1.38330 + if (symbol.type === 'label') { 1.38331 + className = 'flash.text.StaticText'; 1.38332 + } else { 1.38333 + className = 'flash.text.TextField'; 1.38334 + props.tag = symbol.tag; 1.38335 + props.variableName = symbol.variableName; 1.38336 + } 1.38337 + break; 1.38338 + case 'shape': 1.38339 + className = symbol.morph ? 'flash.display.MorphShape' : 'flash.display.Shape'; 1.38340 + props.bbox = symbol.bbox; 1.38341 + props.strokeBbox = symbol.strokeBbox; 1.38342 + props.paths = symbol.paths; 1.38343 + props.dictionaryResolved = dictionaryResolved; 1.38344 + break; 1.38345 + case 'sound': 1.38346 + if (!symbol.pcm && !PLAY_USING_AUDIO_TAG) { 1.38347 + var decodePromiseResolve; 1.38348 + var decodePromise = new Promise(function (resolve) { 1.38349 + decodePromiseResolve = resolve; 1.38350 + }); 1.38351 + MP3DecoderSession.processAll(symbol.packaged.data, function (props, pcm, id3tags, error) { 1.38352 + props.pcm = pcm || new Uint8Array(0); 1.38353 + decodePromiseResolve(); 1.38354 + if (error) { 1.38355 + console.error('ERROR: ' + error); 1.38356 + } 1.38357 + }.bind(null, props)); 1.38358 + promiseQueue.push(decodePromise); 1.38359 + } 1.38360 + className = 'flash.media.Sound'; 1.38361 + props.sampleRate = symbol.sampleRate; 1.38362 + props.channels = symbol.channels; 1.38363 + props.pcm = symbol.pcm; 1.38364 + props.packaged = symbol.packaged; 1.38365 + break; 1.38366 + case 'binary': 1.38367 + props.data = symbol.data; 1.38368 + break; 1.38369 + case 'sprite': 1.38370 + var displayList = null; 1.38371 + var frameCount = symbol.frameCount; 1.38372 + var labelMap = {}; 1.38373 + var frameNum = 1; 1.38374 + var frames = symbol.frames; 1.38375 + var timeline = []; 1.38376 + var startSoundRegistrations = []; 1.38377 + for (var i = 0, n = frames.length; i < n; i++) { 1.38378 + var frame = frames[i]; 1.38379 + var frameNum = timeline.length + 1; 1.38380 + if (frame.labelName) { 1.38381 + labelMap[frame.labelName] = frameNum; 1.38382 + } 1.38383 + if (frame.startSounds) { 1.38384 + startSoundRegistrations[frameNum] = frame.startSounds; 1.38385 + for (var j = 0; j < frame.startSounds.length; j++) { 1.38386 + var soundId = frame.startSounds[j].soundId; 1.38387 + var itemPromise = dictionary[soundId]; 1.38388 + if (itemPromise && !dictionaryResolved[soundId]) { 1.38389 + promiseQueue.push(itemPromise); 1.38390 + } 1.38391 + } 1.38392 + } 1.38393 + displayList = this._buildFrame(displayList, timeline, promiseQueue, frame, frameNum); 1.38394 + } 1.38395 + var frameScripts = {}; 1.38396 + if (!this._isAvm2Enabled) { 1.38397 + if (symbol.frameScripts) { 1.38398 + var data = symbol.frameScripts; 1.38399 + for (var i = 0; i < data.length; i += 2) { 1.38400 + var frameNum = data[i] + 1; 1.38401 + var block = data[i + 1]; 1.38402 + var script = function (block, loader) { 1.38403 + return function () { 1.38404 + var avm1Context = loader._avm1Context; 1.38405 + return executeActions(block, avm1Context, this._getAS2Object()); 1.38406 + }; 1.38407 + }(block, this); 1.38408 + if (!frameScripts[frameNum]) 1.38409 + frameScripts[frameNum] = [ 1.38410 + script 1.38411 + ]; 1.38412 + else 1.38413 + frameScripts[frameNum].push(script); 1.38414 + } 1.38415 + } 1.38416 + } 1.38417 + className = 'flash.display.MovieClip'; 1.38418 + props.timeline = timeline; 1.38419 + props.framesLoaded = frameCount; 1.38420 + props.labelMap = labelMap; 1.38421 + props.frameScripts = frameScripts; 1.38422 + props.totalFrames = frameCount; 1.38423 + props.startSoundRegistrations = startSoundRegistrations; 1.38424 + break; 1.38425 + } 1.38426 + dictionary[symbol.id] = symbolPromise; 1.38427 + Promise.all(promiseQueue).then(function () { 1.38428 + var symbolInfo = { 1.38429 + className: className, 1.38430 + props: props 1.38431 + }; 1.38432 + dictionaryResolved[symbol.id] = symbolInfo; 1.38433 + symbolPromiseResolve(symbolInfo); 1.38434 + }); 1.38435 + }, 1.38436 + _registerFont: function (className, props) { 1.38437 + this._vmPromise.then(function () { 1.38438 + var fontClass = avm2.applicationDomain.getClass(className); 1.38439 + var font = fontClass.createAsSymbol(props); 1.38440 + fontClass.instanceConstructor.call(font); 1.38441 + }); 1.38442 + }, 1.38443 + _init: function (info) { 1.38444 + var loader = this; 1.38445 + var loaderInfo = loader._contentLoaderInfo; 1.38446 + loaderInfo._swfVersion = info.swfVersion; 1.38447 + var bbox = info.bbox; 1.38448 + loaderInfo._width = bbox.xMax - bbox.xMin; 1.38449 + loaderInfo._height = bbox.yMax - bbox.yMin; 1.38450 + loaderInfo._frameRate = info.frameRate; 1.38451 + var vmPromiseResolve, vmPromiseReject; 1.38452 + var vmPromise = new Promise(function (resolve, reject) { 1.38453 + vmPromiseResolve = resolve; 1.38454 + vmPromiseReject = reject; 1.38455 + }); 1.38456 + vmPromise.resolve = vmPromiseResolve; 1.38457 + vmPromise.reject = vmPromiseReject; 1.38458 + var documentPromise = new Promise(function (resolve) { 1.38459 + vmPromise.then(function () { 1.38460 + var rootInfo = { 1.38461 + className: 'flash.display.MovieClip', 1.38462 + props: { 1.38463 + totalFrames: info.frameCount 1.38464 + } 1.38465 + }; 1.38466 + loader._dictionaryResolved[0] = rootInfo; 1.38467 + resolve(rootInfo); 1.38468 + }); 1.38469 + }); 1.38470 + loader._dictionary[0] = documentPromise; 1.38471 + loader._lastPromise = documentPromise; 1.38472 + loader._vmPromise = vmPromise; 1.38473 + loader._isAvm2Enabled = info.fileAttributes.doAbc; 1.38474 + this._setup(); 1.38475 + }, 1.38476 + _load: function (request, checkPolicyFile, applicationDomain, securityDomain, requestedContentParent, parameters, deblockingFilter, allowCodeImport, imageDecodingPolicy) { 1.38477 + if (flash.net.URLRequest.class.isInstanceOf(request)) { 1.38478 + this._contentLoaderInfo._url = request._url; 1.38479 + } 1.38480 + var worker; 1.38481 + if (WORKERS_ENABLED) { 1.38482 + worker = new Worker(SHUMWAY_ROOT + LOADER_PATH); 1.38483 + } else { 1.38484 + worker = new ResourceLoader(window); 1.38485 + } 1.38486 + var loader = this; 1.38487 + loader._worker = worker; 1.38488 + worker.onmessage = function (evt) { 1.38489 + if (evt.data.type === 'exception') { 1.38490 + avm2.exceptions.push({ 1.38491 + source: 'parser', 1.38492 + message: evt.data.message, 1.38493 + stack: evt.data.stack 1.38494 + }); 1.38495 + } else { 1.38496 + loader._commitData(evt.data); 1.38497 + } 1.38498 + }; 1.38499 + if (flash.net.URLRequest.class.isInstanceOf(request)) { 1.38500 + var session = FileLoadingService.createSession(); 1.38501 + session.onprogress = function (data, progress) { 1.38502 + worker.postMessage({ 1.38503 + data: data, 1.38504 + progress: progress 1.38505 + }); 1.38506 + }; 1.38507 + session.onerror = function (error) { 1.38508 + loader._commitData({ 1.38509 + command: 'error', 1.38510 + error: error 1.38511 + }); 1.38512 + }; 1.38513 + session.onopen = function () { 1.38514 + worker.postMessage('pipe:'); 1.38515 + }; 1.38516 + session.onclose = function () { 1.38517 + worker.postMessage({ 1.38518 + data: null 1.38519 + }); 1.38520 + }; 1.38521 + session.open(request._toFileRequest()); 1.38522 + } else { 1.38523 + worker.postMessage(request); 1.38524 + } 1.38525 + }, 1.38526 + _setup: function () { 1.38527 + var loader = this; 1.38528 + var stage = loader._stage; 1.38529 + if (loader._isAvm2Enabled) { 1.38530 + var mouseClass = avm2.systemDomain.getClass('flash.ui.Mouse'); 1.38531 + mouseClass._stage = stage; 1.38532 + loader._vmPromise.resolve(); 1.38533 + return; 1.38534 + } 1.38535 + if (!avm2.loadAVM1) { 1.38536 + loader._vmPromise.reject('AVM1 loader is not found'); 1.38537 + return; 1.38538 + } 1.38539 + var loaded = function () { 1.38540 + var loaderInfo = loader._contentLoaderInfo; 1.38541 + var avm1Context = new AS2Context(loaderInfo._swfVersion); 1.38542 + avm1Context.stage = stage; 1.38543 + loader._avm1Context = avm1Context; 1.38544 + avm1lib.AS2Key.class.$bind(stage); 1.38545 + avm1lib.AS2Mouse.class.$bind(stage); 1.38546 + stage._addEventListener('frameConstructed', avm1Context.flushPendingScripts.bind(avm1Context), false, Number.MAX_VALUE); 1.38547 + loader._vmPromise.resolve(); 1.38548 + }; 1.38549 + if (avm2.isAVM1Loaded) { 1.38550 + if (AS2Context.instance) { 1.38551 + loader._avm1Context = AS2Context.instance; 1.38552 + loader._vmPromise.resolve(); 1.38553 + } else { 1.38554 + loaded(); 1.38555 + } 1.38556 + } else { 1.38557 + avm2.isAVM1Loaded = true; 1.38558 + avm2.loadAVM1(loaded); 1.38559 + } 1.38560 + }, 1.38561 + get contentLoaderInfo() { 1.38562 + return this._contentLoaderInfo; 1.38563 + }, 1.38564 + get content() { 1.38565 + somewhatImplemented('Loader.content'); 1.38566 + return this._content; 1.38567 + } 1.38568 + }; 1.38569 + def.__glue__ = { 1.38570 + native: { 1.38571 + instance: { 1.38572 + content: Object.getOwnPropertyDescriptor(def, 'content'), 1.38573 + contentLoaderInfo: Object.getOwnPropertyDescriptor(def, 'contentLoaderInfo'), 1.38574 + _getJPEGLoaderContextdeblockingfilter: function (context) { 1.38575 + return 0; 1.38576 + }, 1.38577 + _load: def._load, 1.38578 + _loadBytes: function _loadBytes(bytes, checkPolicyFile, applicationDomain, securityDomain, requestedContentParent, parameters, deblockingFilter, allowLoadBytesCodeExecution, imageDecodingPolicy) { 1.38579 + this._load(bytes.a, checkPolicyFile, applicationDomain, securityDomain, requestedContentParent, parameters, deblockingFilter, allowLoadBytesCodeExecution, imageDecodingPolicy); 1.38580 + }, 1.38581 + _unload: function _unload(halt, gc) { 1.38582 + somewhatImplemented('Loader._unload, do we even need to do anything here?'); 1.38583 + }, 1.38584 + _close: function _close() { 1.38585 + somewhatImplemented('Loader._close'); 1.38586 + }, 1.38587 + _getUncaughtErrorEvents: function _getUncaughtErrorEvents() { 1.38588 + somewhatImplemented('Loader._getUncaughtErrorEvents'); 1.38589 + return this._uncaughtErrorEvents; 1.38590 + }, 1.38591 + _setUncaughtErrorEvents: function _setUncaughtErrorEvents(value) { 1.38592 + somewhatImplemented('Loader._setUncaughtErrorEvents'); 1.38593 + this._uncaughtErrorEvents = value; 1.38594 + } 1.38595 + } 1.38596 + } 1.38597 + }; 1.38598 + return def; 1.38599 + }.call(this); 1.38600 +var LoaderInfoDefinition = function () { 1.38601 + function dispatchEvent(event) { 1.38602 + notImplemented('LoaderInfo.dispatchEvent'); 1.38603 + } 1.38604 + return { 1.38605 + __class__: 'flash.display.LoaderInfo', 1.38606 + initialize: function () { 1.38607 + this._actionScriptVersion = null; 1.38608 + this._backgroundColor = null; 1.38609 + this._bytes = null; 1.38610 + this._bytesLoaded = 0; 1.38611 + this._bytesTotal = 0; 1.38612 + this._content = null; 1.38613 + this._contentType = null; 1.38614 + this._frameRate = null; 1.38615 + this._height = null; 1.38616 + this._loader = null; 1.38617 + this._loaderURL = null; 1.38618 + this._swfVersion = null; 1.38619 + this._url = null; 1.38620 + this._width = null; 1.38621 + this._uncaughtErrorEvents = null; 1.38622 + }, 1.38623 + __glue__: { 1.38624 + native: { 1.38625 + static: { 1.38626 + getLoaderInfoByDefinition: function getLoaderInfoByDefinition(object) { 1.38627 + notImplemented('LoaderInfo.getLoaderInfoByDefinition'); 1.38628 + } 1.38629 + }, 1.38630 + instance: { 1.38631 + _getArgs: function _getArgs() { 1.38632 + var params = this._parameters; 1.38633 + var mangled = {}; 1.38634 + for (var k in params) { 1.38635 + mangled[Multiname.getPublicQualifiedName(k)] = params[k]; 1.38636 + } 1.38637 + return mangled; 1.38638 + }, 1.38639 + _getUncaughtErrorEvents: function _getUncaughtErrorEvents() { 1.38640 + somewhatImplemented('Loader._getUncaughtErrorEvents'); 1.38641 + return this._uncaughtErrorEvents; 1.38642 + }, 1.38643 + _setUncaughtErrorEvents: function _setUncaughtErrorEvents(value) { 1.38644 + somewhatImplemented('Loader._setUncaughtErrorEvents'); 1.38645 + this._uncaughtErrorEvents = value; 1.38646 + }, 1.38647 + loaderURL: { 1.38648 + get: function loaderURL() { 1.38649 + return this._loaderURL; 1.38650 + } 1.38651 + }, 1.38652 + url: { 1.38653 + get: function url() { 1.38654 + return this._url; 1.38655 + } 1.38656 + }, 1.38657 + isURLInaccessible: { 1.38658 + get: function isURLInaccessible() { 1.38659 + return this._isURLInaccessible; 1.38660 + } 1.38661 + }, 1.38662 + bytesLoaded: { 1.38663 + get: function bytesLoaded() { 1.38664 + return this._bytesLoaded; 1.38665 + } 1.38666 + }, 1.38667 + bytesTotal: { 1.38668 + get: function bytesTotal() { 1.38669 + return this._bytesTotal; 1.38670 + } 1.38671 + }, 1.38672 + applicationDomain: { 1.38673 + get: function applicationDomain() { 1.38674 + return new flash.system.ApplicationDomain(avm2.applicationDomain); 1.38675 + } 1.38676 + }, 1.38677 + swfVersion: { 1.38678 + get: function swfVersion() { 1.38679 + return this._swfVersion; 1.38680 + } 1.38681 + }, 1.38682 + actionScriptVersion: { 1.38683 + get: function actionScriptVersion() { 1.38684 + return this._actionScriptVersion; 1.38685 + } 1.38686 + }, 1.38687 + frameRate: { 1.38688 + get: function frameRate() { 1.38689 + return this._frameRate; 1.38690 + } 1.38691 + }, 1.38692 + width: { 1.38693 + get: function width() { 1.38694 + return this._width; 1.38695 + } 1.38696 + }, 1.38697 + height: { 1.38698 + get: function height() { 1.38699 + return this._height; 1.38700 + } 1.38701 + }, 1.38702 + contentType: { 1.38703 + get: function contentType() { 1.38704 + return this._contentType; 1.38705 + } 1.38706 + }, 1.38707 + sharedEvents: { 1.38708 + get: function sharedEvents() { 1.38709 + return this._sharedEvents; 1.38710 + } 1.38711 + }, 1.38712 + parentSandboxBridge: { 1.38713 + get: function parentSandboxBridge() { 1.38714 + return this._parentSandboxBridge; 1.38715 + }, 1.38716 + set: function parentSandboxBridge(door) { 1.38717 + this._parentSandboxBridge = door; 1.38718 + } 1.38719 + }, 1.38720 + childSandboxBridge: { 1.38721 + get: function childSandboxBridge() { 1.38722 + return this._childSandboxBridge; 1.38723 + }, 1.38724 + set: function childSandboxBridge(door) { 1.38725 + this._childSandboxBridge = door; 1.38726 + } 1.38727 + }, 1.38728 + sameDomain: { 1.38729 + get: function sameDomain() { 1.38730 + return this._sameDomain; 1.38731 + } 1.38732 + }, 1.38733 + childAllowsParent: { 1.38734 + get: function childAllowsParent() { 1.38735 + return this._childAllowsParent; 1.38736 + } 1.38737 + }, 1.38738 + parentAllowsChild: { 1.38739 + get: function parentAllowsChild() { 1.38740 + return this._parentAllowsChild; 1.38741 + } 1.38742 + }, 1.38743 + loader: { 1.38744 + get: function loader() { 1.38745 + return this._loader; 1.38746 + } 1.38747 + }, 1.38748 + content: { 1.38749 + get: function content() { 1.38750 + return this._loader._content; 1.38751 + } 1.38752 + }, 1.38753 + bytes: { 1.38754 + get: function bytes() { 1.38755 + return this._bytes; 1.38756 + } 1.38757 + } 1.38758 + } 1.38759 + }, 1.38760 + script: { 1.38761 + instance: scriptProperties('public', [ 1.38762 + 'swfVersion', 1.38763 + 'bytesTotal', 1.38764 + 'bytesLoaded', 1.38765 + 'parameters', 1.38766 + 'uncaughtErrorEvent' 1.38767 + ]) 1.38768 + } 1.38769 + } 1.38770 + }; 1.38771 + }.call(this); 1.38772 +var MorphShapeDefinition = function () { 1.38773 + var def = { 1.38774 + __class__: 'flash.display.MorphShape', 1.38775 + initialize: function () { 1.38776 + var graphics = this._graphics = new flash.display.Graphics(); 1.38777 + var s = this.symbol; 1.38778 + if (s && s.paths) { 1.38779 + graphics._paths = s.paths; 1.38780 + graphics.bbox = s.bbox; 1.38781 + graphics.strokeBbox = s.strokeBbox; 1.38782 + if (this._stage && this._stage._quality === 'low' && !graphics._bitmap) 1.38783 + graphics._cacheAsBitmap(this._bbox); 1.38784 + } 1.38785 + } 1.38786 + }; 1.38787 + def.__glue__ = { 1.38788 + native: { 1.38789 + instance: { 1.38790 + graphics: { 1.38791 + get: function () { 1.38792 + return this._graphics; 1.38793 + } 1.38794 + } 1.38795 + } 1.38796 + } 1.38797 + }; 1.38798 + return def; 1.38799 + }.call(this); 1.38800 +var MovieClipDefinition = function () { 1.38801 + var def = { 1.38802 + __class__: 'flash.display.MovieClip', 1.38803 + initialize: function () { 1.38804 + this._playHead = 1; 1.38805 + this._currentFrame = 1; 1.38806 + this._currentFrameLabel = null; 1.38807 + this._currentLabel = null; 1.38808 + this._currentScene = 0; 1.38809 + this._enabled = true; 1.38810 + this._frameScripts = {}; 1.38811 + this._framesLoaded = 1; 1.38812 + this._isPlaying = false; 1.38813 + this._labelMap = {}; 1.38814 + this._sceneFrameMap = {}; 1.38815 + this._sceneMap = {}; 1.38816 + this._scenes = null; 1.38817 + this._timeline = null; 1.38818 + this._totalFrames = 1; 1.38819 + this._startSoundRegistrations = []; 1.38820 + this._allowFrameNavigation = true; 1.38821 + this._complete = true; 1.38822 + var s = this.symbol; 1.38823 + if (s) { 1.38824 + this._timeline = s.timeline || null; 1.38825 + this._framesLoaded = s.framesLoaded || 1; 1.38826 + this._labelMap = Object.create(s.labelMap || null); 1.38827 + this._frameScripts = Object.create(s.frameScripts || null); 1.38828 + this._totalFrames = s.totalFrames || 1; 1.38829 + this._startSoundRegistrations = s.startSoundRegistrations || []; 1.38830 + this._scenes = s.scenes || null; 1.38831 + this._complete = s.complete === false ? false : true; 1.38832 + var map = this._labelMap; 1.38833 + for (var name in map) { 1.38834 + var frame = map[name]; 1.38835 + if (frame == 1) { 1.38836 + this._currentFrameLabel = this._currentLabel = name; 1.38837 + } 1.38838 + } 1.38839 + } 1.38840 + this._enterFrame(1); 1.38841 + var self = this; 1.38842 + this._onExecuteFrame = function onExecuteFrame() { 1.38843 + self._removeEventListener('executeFrame', onExecuteFrame); 1.38844 + self._allowFrameNavigation = false; 1.38845 + self._callFrame(self._currentFrame); 1.38846 + self._allowFrameNavigation = true; 1.38847 + if (self._playHead !== self._currentFrame) { 1.38848 + self._gotoFrame(self._playHead, true); 1.38849 + } 1.38850 + self._postConstructChildren(); 1.38851 + }; 1.38852 + this._addEventListener('executeFrame', this._onExecuteFrame); 1.38853 + if (this._complete && this._totalFrames <= 1) { 1.38854 + return this; 1.38855 + } 1.38856 + this._onAdvanceFrame = function onAdvanceFrame() { 1.38857 + var frameNum = self._playHead + 1; 1.38858 + if (self._complete && frameNum > self._totalFrames) { 1.38859 + frameNum = 1; 1.38860 + } else if (frameNum > self._framesLoaded) { 1.38861 + return; 1.38862 + } 1.38863 + self._updateDisplayList(frameNum); 1.38864 + if (self._sparse) { 1.38865 + self._addEventListener('constructChildren', self._onConstructChildren); 1.38866 + } 1.38867 + self._startSounds(frameNum); 1.38868 + self._enterFrame(frameNum); 1.38869 + if (frameNum in self._frameScripts) { 1.38870 + self._addEventListener('executeFrame', self._onExecuteFrame); 1.38871 + } 1.38872 + }; 1.38873 + this._onConstructChildren = function onConstructChildren() { 1.38874 + self._removeEventListener('constructChildren', onConstructChildren); 1.38875 + self._constructChildren(); 1.38876 + }; 1.38877 + this.play(); 1.38878 + }, 1.38879 + _updateDisplayList: function (nextFrameNum) { 1.38880 + this._destructChildren(nextFrameNum); 1.38881 + this._declareChildren(nextFrameNum); 1.38882 + }, 1.38883 + _declareChildren: function declareChildren(nextFrameNum) { 1.38884 + var currentFrame = this._currentFrame; 1.38885 + if (nextFrameNum === currentFrame) { 1.38886 + return; 1.38887 + } 1.38888 + var timeline = this._timeline; 1.38889 + var nextDisplayList = timeline[nextFrameNum - 1]; 1.38890 + if (nextDisplayList === timeline[currentFrame - 1]) { 1.38891 + return; 1.38892 + } 1.38893 + var prevDisplayListItem = null; 1.38894 + var currentDisplayListItem = this._currentDisplayList; 1.38895 + var children = this._children; 1.38896 + var depths = nextDisplayList.depths; 1.38897 + var index = children.length; 1.38898 + var i = depths.length; 1.38899 + while (i--) { 1.38900 + var depth = depths[i], depthInt = depth | 0; 1.38901 + while (currentDisplayListItem && currentDisplayListItem.depth > depthInt) { 1.38902 + prevDisplayListItem = currentDisplayListItem; 1.38903 + currentDisplayListItem = currentDisplayListItem.next; 1.38904 + } 1.38905 + var currentChild = null; 1.38906 + if (currentDisplayListItem && currentDisplayListItem.depth === depthInt) { 1.38907 + currentChild = currentDisplayListItem.obj; 1.38908 + if (currentChild && currentChild._owned) { 1.38909 + index = this.getChildIndex(currentChild); 1.38910 + } 1.38911 + } 1.38912 + var currentCmd = currentDisplayListItem && currentDisplayListItem.depth === depthInt ? currentDisplayListItem.cmd : null; 1.38913 + var nextCmd = nextDisplayList[depth]; 1.38914 + if (!nextCmd || nextCmd === currentCmd) { 1.38915 + continue; 1.38916 + } 1.38917 + if (currentCmd && currentChild && nextCmd.symbolId === currentCmd.symbolId && nextCmd.ratio === currentCmd.ratio) { 1.38918 + if (currentChild._animated) { 1.38919 + currentChild._invalidate(); 1.38920 + if (nextCmd.hasMatrix) { 1.38921 + currentChild._setTransformMatrix(nextCmd.matrix, false); 1.38922 + } 1.38923 + if (nextCmd.hasCxform) { 1.38924 + currentChild._cxform = nextCmd.cxform; 1.38925 + } 1.38926 + if (nextCmd.clip) { 1.38927 + currentChild._clipDepth = nextCmd.clipDepth; 1.38928 + } 1.38929 + if (nextCmd.hasName) { 1.38930 + currentChild.name = nextCmd.name; 1.38931 + } 1.38932 + if (nextCmd.blend) { 1.38933 + currentChild._blendMode = this._resolveBlendMode(nextCmd.blendMode); 1.38934 + } 1.38935 + } 1.38936 + currentDisplayListItem.cmd = nextCmd; 1.38937 + continue; 1.38938 + } 1.38939 + var newDisplayListItem = this._addTimelineChild(nextCmd, index); 1.38940 + newDisplayListItem.next = currentDisplayListItem; 1.38941 + if (prevDisplayListItem) { 1.38942 + prevDisplayListItem.next = newDisplayListItem; 1.38943 + } else { 1.38944 + this._currentDisplayList = newDisplayListItem; 1.38945 + } 1.38946 + prevDisplayListItem = newDisplayListItem; 1.38947 + } 1.38948 + }, 1.38949 + _destructChildren: function destructChildren(nextFrameNum) { 1.38950 + var currentFrame = this._currentFrame; 1.38951 + if (nextFrameNum === currentFrame) { 1.38952 + return; 1.38953 + } 1.38954 + var timeline = this._timeline; 1.38955 + var nextDisplayList = timeline[nextFrameNum - 1]; 1.38956 + if (nextDisplayList === timeline[currentFrame - 1]) { 1.38957 + return; 1.38958 + } 1.38959 + var prevEntry = null; 1.38960 + var currentEntry = this._currentDisplayList; 1.38961 + var toRemove = null; 1.38962 + while (currentEntry) { 1.38963 + var depth = currentEntry.depth; 1.38964 + var currentCmd = currentEntry.cmd; 1.38965 + var nextCmd = nextDisplayList[depth]; 1.38966 + if (!nextCmd || nextCmd.symbolId !== currentCmd.symbolId || nextCmd.ratio !== currentCmd.ratio) { 1.38967 + var nextDisplayListItem = currentEntry.next; 1.38968 + if (prevEntry) { 1.38969 + prevEntry.next = nextDisplayListItem; 1.38970 + } else { 1.38971 + this._currentDisplayList = nextDisplayListItem; 1.38972 + } 1.38973 + currentEntry.next = toRemove; 1.38974 + toRemove = currentEntry; 1.38975 + currentEntry = nextDisplayListItem; 1.38976 + } else { 1.38977 + prevEntry = currentEntry; 1.38978 + currentEntry = currentEntry.next; 1.38979 + } 1.38980 + } 1.38981 + while (toRemove) { 1.38982 + var child = toRemove.obj; 1.38983 + if (child && child._owned) { 1.38984 + this._sparse = true; 1.38985 + this.removeChild(child); 1.38986 + child.destroy(); 1.38987 + if (child._isPlaying) { 1.38988 + child.stop(); 1.38989 + } 1.38990 + } 1.38991 + toRemove = toRemove.next; 1.38992 + } 1.38993 + }, 1.38994 + _gotoFrame: function gotoFrame(frameNum, execute) { 1.38995 + var enterFrame = frameNum !== this._currentFrame; 1.38996 + if (this._allowFrameNavigation || !this._loader._isAvm2Enabled) { 1.38997 + if (enterFrame) { 1.38998 + this._updateDisplayList(frameNum); 1.38999 + this._enterFrame(frameNum); 1.39000 + } 1.39001 + this._constructChildren(); 1.39002 + if (this._loader._isAvm2Enabled && this.loaderInfo._swfVersion >= 10) { 1.39003 + if (enterFrame) { 1.39004 + this._addEventListener('executeFrame', this._onExecuteFrame); 1.39005 + } 1.39006 + var domain = avm2.systemDomain; 1.39007 + domain.broadcastMessage('frameConstructed'); 1.39008 + domain.broadcastMessage('executeFrame'); 1.39009 + domain.broadcastMessage('exitFrame'); 1.39010 + return; 1.39011 + } 1.39012 + if (enterFrame && (execute || !this._loader._isAvm2Enabled)) { 1.39013 + this._callFrame(frameNum); 1.39014 + } 1.39015 + this._postConstructChildren(); 1.39016 + return; 1.39017 + } 1.39018 + if (enterFrame) { 1.39019 + this._playHead = frameNum; 1.39020 + } 1.39021 + }, 1.39022 + _enterFrame: function navigate(frameNum) { 1.39023 + if (frameNum === this._currentFrame) { 1.39024 + return; 1.39025 + } 1.39026 + this._currentFrameLabel = null; 1.39027 + if (frameNum === 1) { 1.39028 + this._currentLabel = null; 1.39029 + } 1.39030 + var map = this._labelMap; 1.39031 + for (var name in map) { 1.39032 + if (map[name] === frameNum) { 1.39033 + this._currentFrameLabel = this._currentLabel = name; 1.39034 + break; 1.39035 + } 1.39036 + } 1.39037 + if (this._scenes) { 1.39038 + var scenes = this._scenes; 1.39039 + for (var j = 0, n = scenes.length; j < n; j++) { 1.39040 + var scene = scenes[j]; 1.39041 + if (frameNum >= scene._startFrame && frameNum <= scene._endFrame) { 1.39042 + this._currentScene = j; 1.39043 + break; 1.39044 + } 1.39045 + } 1.39046 + } 1.39047 + this._playHead = this._currentFrame = frameNum; 1.39048 + }, 1.39049 + _callFrame: function callFrame(frame) { 1.39050 + if (isNaN(frame)) { 1.39051 + frame = this._labelMap[frame]; 1.39052 + if (frame === undefined) { 1.39053 + return; 1.39054 + } 1.39055 + } 1.39056 + if (frame in this._frameScripts) { 1.39057 + var scripts = this._frameScripts[frame]; 1.39058 + try { 1.39059 + for (var i = 0, n = scripts.length; i < n; i++) { 1.39060 + scripts[i].call(this); 1.39061 + } 1.39062 + } catch (e) { 1.39063 + var AVM2_ERROR_TYPE = 2; 1.39064 + TelemetryService.reportTelemetry({ 1.39065 + topic: 'error', 1.39066 + error: AVM2_ERROR_TYPE 1.39067 + }); 1.39068 + if (false) { 1.39069 + console.error('error ' + e + ', stack: \n' + e.stack); 1.39070 + } 1.39071 + this.stop(); 1.39072 + throw e; 1.39073 + } 1.39074 + } 1.39075 + }, 1.39076 + _gotoButtonState: function gotoButtonState(stateName) { 1.39077 + if (this._enabled) { 1.39078 + this.gotoLabel('_' + stateName); 1.39079 + } 1.39080 + }, 1.39081 + _getAbsFrameNum: function (frameNum, sceneName) { 1.39082 + if (frameNum < 1) { 1.39083 + frameNum = 1; 1.39084 + } 1.39085 + if (sceneName && this._scenes && this._scenes.length > 1) { 1.39086 + var scenes = this._scenes; 1.39087 + for (var i = 0; i < scenes.length; i++) { 1.39088 + var scene = scenes[i]; 1.39089 + if (scene.name === sceneName) { 1.39090 + frameNum += scene._startFrame - 1; 1.39091 + if (frameNum > scene._endFrame) { 1.39092 + frameNum = scene._endFrame; 1.39093 + } 1.39094 + break; 1.39095 + } 1.39096 + } 1.39097 + } 1.39098 + if (frameNum > this._framesLoaded) { 1.39099 + return this._framesLoaded; 1.39100 + } 1.39101 + return frameNum; 1.39102 + }, 1.39103 + _registerStartSounds: function (frameNum, starts) { 1.39104 + this._startSoundRegistrations[frameNum] = starts; 1.39105 + }, 1.39106 + _initSoundStream: function (streamInfo) { 1.39107 + this._soundStream = new MovieClipSoundStream(streamInfo, this); 1.39108 + }, 1.39109 + _addSoundStreamBlock: function (frameNum, streamBlock) { 1.39110 + this._soundStream.appendBlock(frameNum, streamBlock); 1.39111 + }, 1.39112 + _startSounds: function (frameNum) { 1.39113 + var starts = this._startSoundRegistrations[frameNum]; 1.39114 + if (starts) { 1.39115 + var sounds = this._sounds || (this._sounds = {}); 1.39116 + var loader = this.loaderInfo._loader; 1.39117 + for (var i = 0; i < starts.length; i++) { 1.39118 + var start = starts[i]; 1.39119 + var symbolId = start.soundId; 1.39120 + var info = start.soundInfo; 1.39121 + var sound = sounds[symbolId]; 1.39122 + if (!sound) { 1.39123 + var symbolInfo = loader._dictionaryResolved[symbolId]; 1.39124 + if (!symbolInfo) 1.39125 + continue; 1.39126 + var symbolClass = avm2.systemDomain.findClass(symbolInfo.className) ? avm2.systemDomain.getClass(symbolInfo.className) : avm2.applicationDomain.getClass(symbolInfo.className); 1.39127 + var soundObj = symbolClass.createAsSymbol(symbolInfo.props); 1.39128 + symbolClass.instanceConstructor.call(soundObj); 1.39129 + sounds[symbolId] = sound = { 1.39130 + object: soundObj 1.39131 + }; 1.39132 + } 1.39133 + if (sound.channel) { 1.39134 + sound.channel.stop(); 1.39135 + sound.channel = null; 1.39136 + } 1.39137 + if (!info.stop) { 1.39138 + var loops = info.hasLoops ? info.loopCount : 0; 1.39139 + sound.channel = sound.object.play(0, loops); 1.39140 + } 1.39141 + } 1.39142 + } 1.39143 + if (this._soundStream) { 1.39144 + this._soundStream.playFrame(frameNum); 1.39145 + } 1.39146 + }, 1.39147 + _getAS2Object: function () { 1.39148 + if (!this.$as2Object) { 1.39149 + if (this._avm1SymbolClass) { 1.39150 + var nativeObject = this, nativeObjectClass = this._avm1SymbolClass; 1.39151 + var constructWrapper = function () { 1.39152 + this.init(nativeObject); 1.39153 + nativeObjectClass.call(this); 1.39154 + }; 1.39155 + constructWrapper.prototype = Object.create(nativeObjectClass.prototype); 1.39156 + constructWrapper.instanceConstructor = constructWrapper; 1.39157 + constructWrapper.debugName = 'avm1 <symbol constructor wrapper>'; 1.39158 + construct(constructWrapper); 1.39159 + } else { 1.39160 + new avm1lib.AS2MovieClip(this); 1.39161 + } 1.39162 + } 1.39163 + return this.$as2Object; 1.39164 + }, 1.39165 + get currentFrame() { 1.39166 + var frameNum = this._currentFrame; 1.39167 + return this._scenes ? frameNum - this.currentScene._startFrame + 1 : frameNum; 1.39168 + }, 1.39169 + get currentFrameLabel() { 1.39170 + return this._currentFrameLabel; 1.39171 + }, 1.39172 + get currentLabel() { 1.39173 + return this._currentLabel; 1.39174 + }, 1.39175 + get currentLabels() { 1.39176 + if (this._scenes) { 1.39177 + return this._scenes[this._currentScene].labels; 1.39178 + } else { 1.39179 + var labels = []; 1.39180 + var map = this._labelMap; 1.39181 + for (var name in map) { 1.39182 + labels.push(new flash.display.FrameLabel(name, map[name])); 1.39183 + } 1.39184 + return labels; 1.39185 + } 1.39186 + }, 1.39187 + get currentScene() { 1.39188 + return this._scenes ? this._scenes[this._currentScene] : new flash.display.Scene('', this.currentLabels, this._framesLoaded); 1.39189 + }, 1.39190 + get enabled() { 1.39191 + return this._enabled; 1.39192 + }, 1.39193 + set enabled(val) { 1.39194 + this._enabled = val; 1.39195 + }, 1.39196 + get framesLoaded() { 1.39197 + return this._framesLoaded; 1.39198 + }, 1.39199 + get totalFrames() { 1.39200 + return this._totalFrames; 1.39201 + }, 1.39202 + get scenes() { 1.39203 + return this._scenes || [ 1.39204 + new flash.display.Scene('', this.currentLabels, this._framesLoaded) 1.39205 + ]; 1.39206 + }, 1.39207 + get trackAsMenu() { 1.39208 + return false; 1.39209 + }, 1.39210 + set trackAsMenu(val) { 1.39211 + notImplemented(); 1.39212 + }, 1.39213 + addFrameScript: function () { 1.39214 + var frameScripts = this._frameScripts; 1.39215 + for (var i = 0, n = arguments.length; i < n; i += 2) { 1.39216 + var frameNum = arguments[i] + 1; 1.39217 + var fn = arguments[i + 1]; 1.39218 + if (!fn) { 1.39219 + continue; 1.39220 + } 1.39221 + var scripts = frameScripts[frameNum]; 1.39222 + if (scripts) { 1.39223 + scripts.push(fn); 1.39224 + } else { 1.39225 + frameScripts[frameNum] = [ 1.39226 + fn 1.39227 + ]; 1.39228 + } 1.39229 + if (frameNum === this._currentFrame) { 1.39230 + this._addEventListener('executeFrame', this._onExecuteFrame); 1.39231 + } 1.39232 + } 1.39233 + }, 1.39234 + gotoAndPlay: function (frame, scene) { 1.39235 + this.play(); 1.39236 + if (isNaN(frame)) { 1.39237 + this.gotoLabel(frame); 1.39238 + } else { 1.39239 + this._gotoFrame(this._getAbsFrameNum(frame, scene)); 1.39240 + } 1.39241 + }, 1.39242 + gotoAndStop: function (frame, scene) { 1.39243 + this.stop(); 1.39244 + if (isNaN(frame)) { 1.39245 + this.gotoLabel(frame); 1.39246 + } else { 1.39247 + this._gotoFrame(this._getAbsFrameNum(frame, scene)); 1.39248 + } 1.39249 + }, 1.39250 + gotoLabel: function (labelName) { 1.39251 + var frameNum = this._labelMap[labelName]; 1.39252 + if (frameNum !== undefined) { 1.39253 + this._gotoFrame(frameNum); 1.39254 + } 1.39255 + }, 1.39256 + isPlaying: function () { 1.39257 + return this._isPlaying; 1.39258 + }, 1.39259 + nextFrame: function () { 1.39260 + this.stop(); 1.39261 + if (this._currentFrame < this._framesLoaded) { 1.39262 + this._gotoFrame(this._currentFrame + 1); 1.39263 + } 1.39264 + }, 1.39265 + nextScene: function () { 1.39266 + if (this._scenes && this._currentScene < this._scenes.length - 1) { 1.39267 + this._gotoFrame(this._scenes[this._currentScene + 1]._startFrame); 1.39268 + } 1.39269 + }, 1.39270 + play: function () { 1.39271 + if (this._isPlaying || this._complete && this._totalFrames <= 1) { 1.39272 + return; 1.39273 + } 1.39274 + this._isPlaying = true; 1.39275 + this._addEventListener('advanceFrame', this._onAdvanceFrame); 1.39276 + }, 1.39277 + prevFrame: function () { 1.39278 + this.stop(); 1.39279 + if (this._currentFrame > 1) { 1.39280 + this._gotoFrame(this._currentFrame - 1); 1.39281 + } 1.39282 + }, 1.39283 + prevScene: function () { 1.39284 + if (this._scenes && this._currentScene > 0) { 1.39285 + this._gotoFrame(this._scenes[this._currentScene - 1]._startFrame); 1.39286 + } 1.39287 + }, 1.39288 + stop: function () { 1.39289 + if (!this._isPlaying || this._complete && this._totalFrames <= 1) { 1.39290 + return; 1.39291 + } 1.39292 + this._isPlaying = false; 1.39293 + this._removeEventListener('advanceFrame', this._onAdvanceFrame); 1.39294 + } 1.39295 + }; 1.39296 + var desc = Object.getOwnPropertyDescriptor; 1.39297 + def.__glue__ = { 1.39298 + native: { 1.39299 + instance: { 1.39300 + currentFrame: desc(def, 'currentFrame'), 1.39301 + framesLoaded: desc(def, 'framesLoaded'), 1.39302 + totalFrames: desc(def, 'totalFrames'), 1.39303 + trackAsMenu: desc(def, 'trackAsMenu'), 1.39304 + scenes: desc(def, 'scenes'), 1.39305 + currentScene: desc(def, 'currentScene'), 1.39306 + currentLabel: desc(def, 'currentLabel'), 1.39307 + currentFrameLabel: desc(def, 'currentFrameLabel'), 1.39308 + enabled: desc(def, 'enabled'), 1.39309 + isPlaying: desc(def, 'isPlaying'), 1.39310 + play: def.play, 1.39311 + stop: def.stop, 1.39312 + nextFrame: def.nextFrame, 1.39313 + prevFrame: def.prevFrame, 1.39314 + gotoAndPlay: def.gotoAndPlay, 1.39315 + gotoAndStop: def.gotoAndStop, 1.39316 + addFrameScript: def.addFrameScript, 1.39317 + prevScene: def.prevScene, 1.39318 + nextScene: def.nextScene 1.39319 + } 1.39320 + } 1.39321 + }; 1.39322 + return def; 1.39323 + }.call(this); 1.39324 +var MovieClipSoundStream = function () { 1.39325 + var MP3_MIME_TYPE = 'audio/mpeg'; 1.39326 + function openMediaSource(soundStream, mediaSource) { 1.39327 + var sourceBuffer; 1.39328 + try { 1.39329 + sourceBuffer = mediaSource.addSourceBuffer(MP3_MIME_TYPE); 1.39330 + soundStream.mediaSource = mediaSource; 1.39331 + soundStream.sourceBuffer = sourceBuffer; 1.39332 + soundStream.rawFrames.forEach(function (data) { 1.39333 + sourceBuffer.appendBuffer(data); 1.39334 + }); 1.39335 + delete soundStream.rawFrames; 1.39336 + } catch (e) { 1.39337 + console.error('MediaSource mp3 playback is not supported: ' + e); 1.39338 + } 1.39339 + } 1.39340 + function syncTime(element, movieClip) { 1.39341 + var initialized = false; 1.39342 + var startMediaTime, startRealTime; 1.39343 + element.addEventListener('timeupdate', function (e) { 1.39344 + if (!initialized) { 1.39345 + startMediaTime = element.currentTime; 1.39346 + startRealTime = performance.now(); 1.39347 + initialized = true; 1.39348 + movieClip._stage._frameScheduler.startTrackDelta(); 1.39349 + return; 1.39350 + } 1.39351 + var mediaDelta = element.currentTime - startMediaTime; 1.39352 + var realDelta = performance.now() - startRealTime; 1.39353 + movieClip._stage._frameScheduler.setDelta(realDelta - mediaDelta * 1000); 1.39354 + }); 1.39355 + element.addEventListener('pause', function (e) { 1.39356 + movieClip._stage._frameScheduler.endTrackDelta(); 1.39357 + initialized = false; 1.39358 + }); 1.39359 + element.addEventListener('seeking', function (e) { 1.39360 + movieClip._stage._frameScheduler.endTrackDelta(); 1.39361 + initialized = false; 1.39362 + }); 1.39363 + } 1.39364 + function MovieClipSoundStream(streamInfo, movieClip) { 1.39365 + this.movieClip = movieClip; 1.39366 + this.data = { 1.39367 + sampleRate: streamInfo.sampleRate, 1.39368 + channels: streamInfo.channels 1.39369 + }; 1.39370 + this.seekIndex = []; 1.39371 + this.position = 0; 1.39372 + var isMP3 = streamInfo.format === 'mp3'; 1.39373 + if (isMP3 && PLAY_USING_AUDIO_TAG) { 1.39374 + var element = document.createElement('audio'); 1.39375 + element.preload = 'metadata'; 1.39376 + element.loop = false; 1.39377 + syncTime(element, movieClip); 1.39378 + if (element.canPlayType(MP3_MIME_TYPE)) { 1.39379 + this.element = element; 1.39380 + if (typeof MediaSource !== 'undefined') { 1.39381 + var mediaSource = new MediaSource(); 1.39382 + mediaSource.addEventListener('sourceopen', openMediaSource.bind(null, this, mediaSource)); 1.39383 + element.src = URL.createObjectURL(mediaSource); 1.39384 + } else { 1.39385 + console.warn('MediaSource is not supported'); 1.39386 + } 1.39387 + this.rawFrames = []; 1.39388 + return; 1.39389 + } 1.39390 + } 1.39391 + var totalSamples = streamInfo.samplesCount * streamInfo.channels; 1.39392 + this.data.pcm = new Float32Array(totalSamples); 1.39393 + if (isMP3) { 1.39394 + var soundStream = this; 1.39395 + soundStream.decoderPosition = 0; 1.39396 + soundStream.decoderSession = new MP3DecoderSession(); 1.39397 + soundStream.decoderSession.onframedata = function (frameData) { 1.39398 + var position = soundStream.decoderPosition; 1.39399 + soundStream.data.pcm.set(frameData, position); 1.39400 + soundStream.decoderPosition = position + frameData.length; 1.39401 + }.bind(this); 1.39402 + soundStream.decoderSession.onerror = function (error) { 1.39403 + console.error('ERROR: MP3DecoderSession: ' + error); 1.39404 + }; 1.39405 + } 1.39406 + } 1.39407 + MovieClipSoundStream.prototype = { 1.39408 + appendBlock: function (frameNum, streamBlock) { 1.39409 + var streamPosition = this.position; 1.39410 + this.seekIndex[frameNum] = streamPosition + streamBlock.seek * this.data.channels; 1.39411 + this.position = streamPosition + streamBlock.samplesCount * this.data.channels; 1.39412 + if (this.sourceBuffer) { 1.39413 + this.sourceBuffer.appendBuffer(streamBlock.data); 1.39414 + return; 1.39415 + } 1.39416 + if (this.rawFrames) { 1.39417 + this.rawFrames.push(streamBlock.data); 1.39418 + return; 1.39419 + } 1.39420 + var decoderSession = this.decoderSession; 1.39421 + if (decoderSession) { 1.39422 + decoderSession.pushAsync(streamBlock.data); 1.39423 + } else { 1.39424 + this.data.pcm.set(streamBlock.pcm, streamPosition); 1.39425 + } 1.39426 + }, 1.39427 + playFrame: function (frameNum) { 1.39428 + if (isNaN(this.seekIndex[frameNum])) { 1.39429 + return; 1.39430 + } 1.39431 + var PAUSE_WHEN_OF_SYNC_GREATER = 1; 1.39432 + var PLAYBACK_ADJUSTMENT = 0.25; 1.39433 + var element = this.element; 1.39434 + if (element) { 1.39435 + var soundStreamData = this.data; 1.39436 + var time = this.seekIndex[frameNum] / soundStreamData.sampleRate / soundStreamData.channels; 1.39437 + if (!this.channel && (this.movieClip._complete || this.sourceBuffer)) { 1.39438 + if (!this.sourceBuffer) { 1.39439 + var blob = new Blob(this.rawFrames); 1.39440 + element.src = URL.createObjectURL(blob); 1.39441 + } 1.39442 + var symbolClass = flash.media.SoundChannel.class; 1.39443 + var channel = symbolClass.createAsSymbol({ 1.39444 + element: element 1.39445 + }); 1.39446 + symbolClass.instanceConstructor.call(channel); 1.39447 + this.channel = channel; 1.39448 + this.expectedFrame = 0; 1.39449 + this.waitFor = 0; 1.39450 + } else if (this.sourceBuffer || !isNaN(element.duration)) { 1.39451 + if (this.mediaSource && this.movieClip._complete) { 1.39452 + this.mediaSource.endOfStream(); 1.39453 + this.mediaSource = null; 1.39454 + } 1.39455 + var elementTime = element.currentTime; 1.39456 + if (this.expectedFrame !== frameNum) { 1.39457 + if (element.paused) { 1.39458 + element.play(); 1.39459 + element.addEventListener('playing', function setTime(e) { 1.39460 + element.removeEventListener('playing', setTime); 1.39461 + element.currentTime = time; 1.39462 + }); 1.39463 + } else { 1.39464 + element.currentTime = time; 1.39465 + } 1.39466 + } else if (this.waitFor > 0) { 1.39467 + if (this.waitFor <= time) { 1.39468 + if (element.paused) { 1.39469 + element.play(); 1.39470 + } 1.39471 + this.waitFor = 0; 1.39472 + } 1.39473 + } else if (elementTime - time > PAUSE_WHEN_OF_SYNC_GREATER) { 1.39474 + console.warn('Sound is faster than frames by ' + (elementTime - time)); 1.39475 + this.waitFor = elementTime - PLAYBACK_ADJUSTMENT; 1.39476 + element.pause(); 1.39477 + } else if (time - elementTime > PAUSE_WHEN_OF_SYNC_GREATER) { 1.39478 + console.warn('Sound is slower than frames by ' + (time - elementTime)); 1.39479 + element.currentTime = time + PLAYBACK_ADJUSTMENT; 1.39480 + } 1.39481 + this.expectedFrame = frameNum + 1; 1.39482 + } 1.39483 + } else if (!this.sound) { 1.39484 + var symbolClass = flash.media.Sound.class; 1.39485 + var sound = symbolClass.createAsSymbol(this.data); 1.39486 + symbolClass.instanceConstructor.call(sound); 1.39487 + var channel = sound.play(); 1.39488 + this.sound = sound; 1.39489 + this.channel = channel; 1.39490 + } 1.39491 + } 1.39492 + }; 1.39493 + return MovieClipSoundStream; 1.39494 + }(); 1.39495 +var NativeMenuDefinition = function () { 1.39496 + return { 1.39497 + __class__: 'flash.display.NativeMenu', 1.39498 + initialize: function () { 1.39499 + }, 1.39500 + __glue__: { 1.39501 + native: { 1.39502 + static: {}, 1.39503 + instance: {} 1.39504 + } 1.39505 + } 1.39506 + }; 1.39507 + }.call(this); 1.39508 +var NativeMenuItemDefinition = function () { 1.39509 + return { 1.39510 + __class__: 'flash.display.NativeMenuItem', 1.39511 + initialize: function () { 1.39512 + }, 1.39513 + __glue__: { 1.39514 + native: { 1.39515 + static: {}, 1.39516 + instance: { 1.39517 + enabled: { 1.39518 + get: function enabled() { 1.39519 + somewhatImplemented('NativeMenuItem.enabled'); 1.39520 + return this._enabled; 1.39521 + }, 1.39522 + set: function enabled(isSeparator) { 1.39523 + somewhatImplemented('NativeMenuItem.enabled'); 1.39524 + this._enabled = isSeparator; 1.39525 + } 1.39526 + } 1.39527 + } 1.39528 + } 1.39529 + } 1.39530 + }; 1.39531 + }.call(this); 1.39532 +var SceneDefinition = function () { 1.39533 + return { 1.39534 + __class__: 'flash.display.Scene', 1.39535 + initialize: function () { 1.39536 + this._startFrame = 1; 1.39537 + this._endFrame = 1; 1.39538 + }, 1.39539 + __glue__: { 1.39540 + native: { 1.39541 + static: {}, 1.39542 + instance: {} 1.39543 + }, 1.39544 + script: { 1.39545 + static: {}, 1.39546 + instance: { 1.39547 + name: { 1.39548 + get: function name() { 1.39549 + notImplemented('Scene.name'); 1.39550 + return this._name; 1.39551 + } 1.39552 + }, 1.39553 + labels: { 1.39554 + get: function labels() { 1.39555 + notImplemented('Scene.labels'); 1.39556 + return this._labels; 1.39557 + } 1.39558 + }, 1.39559 + numFrames: { 1.39560 + get: function numFrames() { 1.39561 + notImplemented('Scene.numFrames'); 1.39562 + return this._numFrames; 1.39563 + } 1.39564 + } 1.39565 + } 1.39566 + } 1.39567 + } 1.39568 + }; 1.39569 + }.call(this); 1.39570 +var ShaderDefinition = function () { 1.39571 + return { 1.39572 + __class__: 'flash.display.Shader', 1.39573 + initialize: function () { 1.39574 + this._data = null; 1.39575 + }, 1.39576 + __glue__: { 1.39577 + native: { 1.39578 + static: {}, 1.39579 + instance: { 1.39580 + data: { 1.39581 + get: function data() { 1.39582 + return this._data; 1.39583 + }, 1.39584 + set: function data(p) { 1.39585 + this._data = p; 1.39586 + } 1.39587 + }, 1.39588 + precisionHint: { 1.39589 + get: function precisionHint() { 1.39590 + return this._precisionHint; 1.39591 + }, 1.39592 + set: function precisionHint(p) { 1.39593 + this._precisionHint = p; 1.39594 + } 1.39595 + } 1.39596 + } 1.39597 + }, 1.39598 + script: { 1.39599 + instance: Glue.ALL 1.39600 + } 1.39601 + } 1.39602 + }; 1.39603 + }.call(this); 1.39604 +var ShaderDataDefinition = function () { 1.39605 + return { 1.39606 + __class__: 'flash.display.ShaderData', 1.39607 + initialize: function () { 1.39608 + this._byteCode = null; 1.39609 + }, 1.39610 + __glue__: { 1.39611 + native: { 1.39612 + static: {}, 1.39613 + instance: { 1.39614 + _setByteCode: function _setByteCode(code) { 1.39615 + this._byteCode = code; 1.39616 + } 1.39617 + } 1.39618 + }, 1.39619 + script: { 1.39620 + instance: Glue.ALL 1.39621 + } 1.39622 + } 1.39623 + }; 1.39624 + }.call(this); 1.39625 +var ShapeDefinition = function () { 1.39626 + var def = { 1.39627 + __class__: 'flash.display.Shape', 1.39628 + initialize: function () { 1.39629 + var graphics = this._graphics = new flash.display.Graphics(); 1.39630 + graphics._parent = this; 1.39631 + var s = this.symbol; 1.39632 + if (s && s.paths) { 1.39633 + graphics._paths = s.paths; 1.39634 + for (var i = 0; i < s.paths.length; i++) { 1.39635 + s.paths[i] = finishShapePath(s.paths[i], s.dictionaryResolved); 1.39636 + } 1.39637 + graphics.bbox = s.bbox; 1.39638 + graphics.strokeBbox = s.strokeBbox; 1.39639 + if (this._stage && this._stage._quality === 'low' && !graphics._bitmap) 1.39640 + graphics._cacheAsBitmap(this._bbox); 1.39641 + this.ratio = s.ratio || 0; 1.39642 + } 1.39643 + } 1.39644 + }; 1.39645 + def.__glue__ = { 1.39646 + native: { 1.39647 + instance: { 1.39648 + graphics: { 1.39649 + get: function () { 1.39650 + return this._graphics; 1.39651 + } 1.39652 + } 1.39653 + } 1.39654 + } 1.39655 + }; 1.39656 + return def; 1.39657 + }.call(this); 1.39658 +var SimpleButtonDefinition = function () { 1.39659 + var AVM1KeyCodeMap = [ 1.39660 + 0, 1.39661 + 37, 1.39662 + 39, 1.39663 + 36, 1.39664 + 35, 1.39665 + 45, 1.39666 + 46, 1.39667 + 0, 1.39668 + 8, 1.39669 + 0, 1.39670 + 0, 1.39671 + 0, 1.39672 + 0, 1.39673 + 13, 1.39674 + 38, 1.39675 + 40, 1.39676 + 33, 1.39677 + 34, 1.39678 + 9, 1.39679 + 27 1.39680 + ]; 1.39681 + var AVM1MouseTransitionEvents = [ 1.39682 + 0, 1.39683 + 0, 1.39684 + 1, 1.39685 + 128, 1.39686 + 64, 1.39687 + 0, 1.39688 + 0, 1.39689 + 32, 1.39690 + 2, 1.39691 + 0, 1.39692 + 0, 1.39693 + 4, 1.39694 + 256, 1.39695 + 16, 1.39696 + 8, 1.39697 + 0 1.39698 + ]; 1.39699 + return { 1.39700 + __class__: 'flash.display.SimpleButton', 1.39701 + initialize: function () { 1.39702 + this._useHandCursor = true; 1.39703 + this._enabled = true; 1.39704 + this._trackAsMenu = false; 1.39705 + this._upState = null; 1.39706 + this._overState = null; 1.39707 + this._downState = null; 1.39708 + this._hitTestState = null; 1.39709 + this._currentButtonState = 'up'; 1.39710 + this._mouseChildren = false; 1.39711 + this._buttonMode = true; 1.39712 + this._prevAvm1StateCode = 0; 1.39713 + this._avm1StateCode = 0; 1.39714 + this._avm1MouseEvents = null; 1.39715 + this._isContainer = true; 1.39716 + var s = this.symbol; 1.39717 + if (s) { 1.39718 + var states = s.states; 1.39719 + if (states.down) { 1.39720 + this._downState = this._constructState(states.down, this); 1.39721 + } 1.39722 + if (states.hitTest) { 1.39723 + this._hitTestState = this._constructState(states.hitTest, this); 1.39724 + } 1.39725 + if (states.over) { 1.39726 + this._overState = this._constructState(states.over, this); 1.39727 + } 1.39728 + if (states.up) { 1.39729 + this._upState = this._constructState(states.up, this); 1.39730 + } 1.39731 + } 1.39732 + if (this._loader && !this._loader._isAvm2Enabled && s && s.buttonActions) { 1.39733 + this._addEventListener('addedToStage', function (e) { 1.39734 + this._initAvm1Events(s.buttonActions); 1.39735 + }.bind(this), false); 1.39736 + } 1.39737 + }, 1.39738 + _constructState: function constructState(symbolInfo) { 1.39739 + var symbolClass = avm2.systemDomain.findClass(symbolInfo.className) ? avm2.systemDomain.getClass(symbolInfo.className) : avm2.applicationDomain.getClass(symbolInfo.className); 1.39740 + var instance = symbolClass.createAsSymbol(symbolInfo.props); 1.39741 + symbolClass.instanceConstructor.call(instance); 1.39742 + if (instance._children.length === 1) { 1.39743 + instance = instance._children[0]; 1.39744 + instance._parent = null; 1.39745 + instance._index = -1; 1.39746 + } 1.39747 + return instance; 1.39748 + }, 1.39749 + _updateButton: function updateButton() { 1.39750 + var state = null; 1.39751 + switch (this._currentButtonState) { 1.39752 + case 'up': 1.39753 + state = this._upState; 1.39754 + break; 1.39755 + case 'over': 1.39756 + state = this._overState; 1.39757 + break; 1.39758 + case 'down': 1.39759 + state = this._downState; 1.39760 + break; 1.39761 + } 1.39762 + if (!state) { 1.39763 + return; 1.39764 + } 1.39765 + var currentChild = this._children[0]; 1.39766 + if (currentChild) { 1.39767 + if (currentChild === state) { 1.39768 + return; 1.39769 + } 1.39770 + if (this._stage) { 1.39771 + this._stage._removeFromStage(currentChild); 1.39772 + } 1.39773 + currentChild._invalidateTransform(); 1.39774 + } 1.39775 + if (!state) { 1.39776 + this._children.shift(); 1.39777 + return; 1.39778 + } 1.39779 + this._children[0] = state; 1.39780 + state._parent = this; 1.39781 + state._invalidateTransform(); 1.39782 + if (this._stage) { 1.39783 + this._stage._addToStage(state); 1.39784 + } 1.39785 + }, 1.39786 + _gotoButtonState: function gotoButtonState(buttonState) { 1.39787 + this._invalidateBounds(); 1.39788 + this._currentButtonState = buttonState; 1.39789 + this._updateButton(); 1.39790 + if (this._avm1MouseEvents) { 1.39791 + this._processAvm1MouseEvents(this._avm1MouseEvents); 1.39792 + } 1.39793 + }, 1.39794 + _getRegion: function getRegion(targetCoordSpace) { 1.39795 + if (!this._hitTestState) { 1.39796 + return { 1.39797 + xMin: 0, 1.39798 + yMin: 0, 1.39799 + xMax: 0, 1.39800 + yMax: 0 1.39801 + }; 1.39802 + } 1.39803 + var b = this._hitTestState.getBounds(null); 1.39804 + return this._getTransformedRect(b, targetCoordSpace); 1.39805 + }, 1.39806 + _getAS2Object: function () { 1.39807 + if (!this.$as2Object) { 1.39808 + new avm1lib.AS2Button(this); 1.39809 + } 1.39810 + return this.$as2Object; 1.39811 + }, 1.39812 + _initAvm1Events: function (buttonActions) { 1.39813 + var loader = this._loader; 1.39814 + var avm1Context = loader._avm1Context; 1.39815 + var keyEvents = null; 1.39816 + for (var i = 0; i < buttonActions.length; i++) { 1.39817 + var buttonAction = buttonActions[i]; 1.39818 + var fn = function (actionBlock) { 1.39819 + return executeActions(actionBlock, avm1Context, this._getAS2Object()); 1.39820 + }.bind(this.parent, buttonAction.actionsData); 1.39821 + var mouseEventFlags = buttonAction.mouseEventFlags; 1.39822 + if (mouseEventFlags) { 1.39823 + var mouseEvents = this._avm1MouseEvents || (this._avm1MouseEvents = []); 1.39824 + mouseEvents.push({ 1.39825 + flags: mouseEventFlags, 1.39826 + listener: fn 1.39827 + }); 1.39828 + } 1.39829 + var keyPress = buttonAction.keyPress; 1.39830 + if (keyPress) { 1.39831 + keyEvents = keyEvents || (keyEvents = []); 1.39832 + keyEvents.push({ 1.39833 + keyCode: AVM1KeyCodeMap[keyPress] || 0, 1.39834 + charCode: keyPress, 1.39835 + listener: fn 1.39836 + }); 1.39837 + } 1.39838 + } 1.39839 + if (keyEvents) { 1.39840 + var keyListener = function (e) { 1.39841 + for (var i = 0; i < keyEvents.length; i++) { 1.39842 + var keyEvent = keyEvents[i]; 1.39843 + if (keyEvent.keyCode ? keyEvent.keyCode === e.keyCode : keyEvent.charCode === e.charCode) { 1.39844 + keyEvent.listener(); 1.39845 + } 1.39846 + } 1.39847 + }; 1.39848 + var KeyboardEventClass = flash.events.KeyboardEvent; 1.39849 + this.stage._addEventListener(KeyboardEventClass.class.KEY_DOWN, keyListener, false); 1.39850 + this._addEventListener('removedFromStage', function (stage) { 1.39851 + stage._removeEventListener(KeyboardEventClass.class.KEY_DOWN, keyListener, false); 1.39852 + }.bind(this, this.stage), false); 1.39853 + } 1.39854 + }, 1.39855 + _processAvm1MouseEvents: function (mouseEvents) { 1.39856 + var prevAvm1StateCode = this._avm1StateCode; 1.39857 + var avm1StateCode = (this._currentButtonState === 'down' ? 1 : 0) | (this._currentButtonState !== 'up' ? 2 : 0); 1.39858 + if (prevAvm1StateCode !== avm1StateCode) { 1.39859 + this._prevAvm1StateCode = prevAvm1StateCode; 1.39860 + this._avm1StateCode = avm1StateCode; 1.39861 + var flag = AVM1MouseTransitionEvents[prevAvm1StateCode << 2 | avm1StateCode]; 1.39862 + for (var i = 0; i < mouseEvents.length; i++) { 1.39863 + var mouseEvent = mouseEvents[i]; 1.39864 + if ((mouseEvent.flags & flag) !== 0) { 1.39865 + mouseEvent.listener(); 1.39866 + } 1.39867 + } 1.39868 + } 1.39869 + }, 1.39870 + __glue__: { 1.39871 + native: { 1.39872 + instance: { 1.39873 + _updateButton: function _updateButton() { 1.39874 + this._updateButton(); 1.39875 + }, 1.39876 + useHandCursor: { 1.39877 + get: function useHandCursor() { 1.39878 + return this._useHandCursor; 1.39879 + }, 1.39880 + set: function useHandCursor(value) { 1.39881 + this._useHandCursor = value; 1.39882 + } 1.39883 + }, 1.39884 + enabled: { 1.39885 + get: function enabled() { 1.39886 + return this._enabled; 1.39887 + }, 1.39888 + set: function enabled(value) { 1.39889 + this._enabled = value; 1.39890 + } 1.39891 + }, 1.39892 + trackAsMenu: { 1.39893 + get: function trackAsMenu() { 1.39894 + notImplemented('SimpleButton.trackAsMenu'); 1.39895 + return this._trackAsMenu; 1.39896 + }, 1.39897 + set: function trackAsMenu(value) { 1.39898 + notImplemented('SimpleButton.trackAsMenu'); 1.39899 + this._trackAsMenu = value; 1.39900 + } 1.39901 + }, 1.39902 + upState: { 1.39903 + get: function upState() { 1.39904 + return this._upState; 1.39905 + }, 1.39906 + set: function upState(value) { 1.39907 + this._upState = value; 1.39908 + this._updateButton(); 1.39909 + } 1.39910 + }, 1.39911 + overState: { 1.39912 + get: function overState() { 1.39913 + return this._overState; 1.39914 + }, 1.39915 + set: function overState(value) { 1.39916 + this._overState = value; 1.39917 + this._updateButton(); 1.39918 + } 1.39919 + }, 1.39920 + downState: { 1.39921 + get: function downState() { 1.39922 + return this._downState; 1.39923 + }, 1.39924 + set: function downState(value) { 1.39925 + this._downState = value; 1.39926 + this._updateButton(); 1.39927 + } 1.39928 + }, 1.39929 + hitTestState: { 1.39930 + get: function hitTestState() { 1.39931 + return this._hitTestState; 1.39932 + }, 1.39933 + set: function hitTestState(value) { 1.39934 + if (value === this._hitTestState) { 1.39935 + return; 1.39936 + } 1.39937 + this._invalidate(); 1.39938 + this._hitTestState = value; 1.39939 + } 1.39940 + }, 1.39941 + soundTransform: { 1.39942 + get: function soundTransform() { 1.39943 + notImplemented('SimpleButton.soundTransform'); 1.39944 + return this._soundTransform; 1.39945 + }, 1.39946 + set: function soundTransform(value) { 1.39947 + notImplemented('SimpleButton.soundTransform'); 1.39948 + this._soundTransform = value; 1.39949 + } 1.39950 + } 1.39951 + } 1.39952 + } 1.39953 + } 1.39954 + }; 1.39955 + }.call(this); 1.39956 +var SpriteDefinition = function () { 1.39957 + var def = { 1.39958 + __class__: 'flash.display.Sprite', 1.39959 + initialize: function () { 1.39960 + this._buttonMode = false; 1.39961 + this._hitArea = null; 1.39962 + this._useHandCursor = true; 1.39963 + this._hitTarget = null; 1.39964 + this._currentDisplayList = null; 1.39965 + var s = this.symbol; 1.39966 + if (s) { 1.39967 + this._graphics = s.graphics || new flash.display.Graphics(); 1.39968 + if (s.timeline) { 1.39969 + var displayList = s.timeline[0]; 1.39970 + if (displayList) { 1.39971 + var depths = displayList.depths; 1.39972 + for (var i = 0; i < depths.length; i++) { 1.39973 + var cmd = displayList[depths[i]]; 1.39974 + if (cmd) { 1.39975 + var displayListItem = this._addTimelineChild(cmd); 1.39976 + displayListItem.next = this._currentDisplayList; 1.39977 + this._currentDisplayList = displayListItem; 1.39978 + } 1.39979 + } 1.39980 + } 1.39981 + } 1.39982 + } else { 1.39983 + this._graphics = new flash.display.Graphics(); 1.39984 + } 1.39985 + this._graphics._parent = this; 1.39986 + }, 1.39987 + _addTimelineChild: function addTimelineChild(cmd, index) { 1.39988 + var symbolInfo = cmd.symbolInfo; 1.39989 + var props = Object.create(symbolInfo.props); 1.39990 + props.symbolId = cmd.symbolId; 1.39991 + props.depth = cmd.depth; 1.39992 + if (cmd.clip) { 1.39993 + props.clipDepth = cmd.clipDepth; 1.39994 + } 1.39995 + if (cmd.hasCxform) { 1.39996 + props.cxform = cmd.cxform; 1.39997 + } 1.39998 + if (cmd.hasMatrix) { 1.39999 + props.currentTransform = cmd.matrix; 1.40000 + } 1.40001 + if (cmd.hasName) { 1.40002 + props.name = cmd.name; 1.40003 + } 1.40004 + if (cmd.hasRatio) { 1.40005 + props.ratio = cmd.ratio / 65535; 1.40006 + } 1.40007 + if (cmd.blend) { 1.40008 + props.blendMode = cmd.blendMode; 1.40009 + } 1.40010 + var displayListItem = { 1.40011 + cmd: cmd, 1.40012 + depth: cmd.depth, 1.40013 + className: symbolInfo.className, 1.40014 + props: props, 1.40015 + events: cmd.events, 1.40016 + obj: null 1.40017 + }; 1.40018 + if (index !== undefined) { 1.40019 + this._children.splice(index, 0, displayListItem); 1.40020 + } else { 1.40021 + this._children.push(displayListItem); 1.40022 + } 1.40023 + this._sparse = true; 1.40024 + return displayListItem; 1.40025 + }, 1.40026 + _constructChildren: function () { 1.40027 + if (!this._sparse) { 1.40028 + return; 1.40029 + } 1.40030 + var loader = this._loader; 1.40031 + var children = this._children; 1.40032 + for (var i = 0; i < children.length; i++) { 1.40033 + var displayListItem = children[i]; 1.40034 + Counter.count('constructChild'); 1.40035 + if (flash.display.DisplayObject.class.isInstanceOf(displayListItem)) { 1.40036 + displayListItem._index = i; 1.40037 + } else { 1.40038 + var symbolClass = avm2.systemDomain.findClass(displayListItem.className) ? avm2.systemDomain.getClass(displayListItem.className) : avm2.applicationDomain.getClass(displayListItem.className); 1.40039 + var props = Object.create(displayListItem.props); 1.40040 + var name = props.name; 1.40041 + props.animated = true; 1.40042 + props.owned = true; 1.40043 + props.parent = this; 1.40044 + props.stage = this._stage; 1.40045 + if (this._level > -1) { 1.40046 + props.level = this._level + 1; 1.40047 + } 1.40048 + props.index = i; 1.40049 + var instance = symbolClass.createAsSymbol(props); 1.40050 + if (name) { 1.40051 + this[Multiname.getPublicQualifiedName(name)] = instance; 1.40052 + } 1.40053 + symbolClass.instanceConstructor.call(instance); 1.40054 + if (flash.display.BitmapData.class.isInstanceOf(instance)) { 1.40055 + var bitmapData = instance; 1.40056 + instance = flash.display.Bitmap.class.createAsSymbol(props); 1.40057 + flash.display.Bitmap.class.instanceConstructor.call(instance, bitmapData); 1.40058 + } 1.40059 + if (!loader._isAvm2Enabled) { 1.40060 + this._initAvm1Bindings(instance, name, displayListItem.events); 1.40061 + instance._dispatchEvent('init'); 1.40062 + instance._dispatchEvent('construct'); 1.40063 + instance._needLoadEvent = true; 1.40064 + } else { 1.40065 + instance._dispatchEvent('load'); 1.40066 + } 1.40067 + instance._dispatchEvent('added', undefined, true); 1.40068 + if (this._stage) { 1.40069 + this._stage._addToStage(instance); 1.40070 + } 1.40071 + children[i] = instance; 1.40072 + displayListItem.obj = instance; 1.40073 + } 1.40074 + } 1.40075 + this._sparse = false; 1.40076 + }, 1.40077 + _postConstructChildren: function () { 1.40078 + var loader = this._loader; 1.40079 + if (!loader || loader._isAvm2Enabled) { 1.40080 + return; 1.40081 + } 1.40082 + var children = this._children; 1.40083 + for (var i = 0; i < children.length; i++) { 1.40084 + var instance = children[i]; 1.40085 + if (instance._needLoadEvent) { 1.40086 + instance._needLoadEvent = false; 1.40087 + instance._dispatchEvent('load'); 1.40088 + } 1.40089 + } 1.40090 + }, 1.40091 + _duplicate: function (name, depth, initObject) { 1.40092 + var loader = this._loader; 1.40093 + var parent = this._parent; 1.40094 + var children = parent._children; 1.40095 + var symbolClass = this.class; 1.40096 + var symbolInfo = this.symbol; 1.40097 + var props = Object.create(symbolInfo); 1.40098 + props.name = name; 1.40099 + props.parent = parent; 1.40100 + props.depth = depth; 1.40101 + var instance = symbolClass.createAsSymbol(props); 1.40102 + if (name && loader && !loader._isAvm2Enabled && !parent.asHasProperty(undefined, name, 0, false)) { 1.40103 + parent.asSetPublicProperty(name, instance); 1.40104 + } 1.40105 + symbolClass.instanceConstructor.call(instance); 1.40106 + instance._index = children.length; 1.40107 + children.push(instance); 1.40108 + if (!loader._isAvm2Enabled) { 1.40109 + parent._initAvm1Bindings(instance, name, symbolInfo && symbolInfo.events); 1.40110 + instance._dispatchEvent('init'); 1.40111 + instance._dispatchEvent('construct'); 1.40112 + } 1.40113 + instance._dispatchEvent('load'); 1.40114 + instance._dispatchEvent('added'); 1.40115 + if (this._stage) { 1.40116 + instance._invalidate(); 1.40117 + } 1.40118 + return instance; 1.40119 + }, 1.40120 + _insertChildAtDepth: function (child, depth) { 1.40121 + this.addChild(child); 1.40122 + var name = child._name; 1.40123 + var loader = this._loader; 1.40124 + if (name && loader && !loader._isAvm2Enabled && !this._getAS2Object().asHasProperty(undefined, name, 0, true)) { 1.40125 + this._getAS2Object().asSetPublicProperty(name, child._getAS2Object()); 1.40126 + } 1.40127 + }, 1.40128 + _initAvm1Bindings: function (instance, name, events) { 1.40129 + var loader = this._loader; 1.40130 + var avm1Context = loader._avm1Context; 1.40131 + var symbolProps = instance.symbol; 1.40132 + if (symbolProps && symbolProps.variableName) { 1.40133 + instance._getAS2Object().asSetPublicProperty('variable', symbolProps.variableName); 1.40134 + } 1.40135 + if (events) { 1.40136 + var eventsBound = []; 1.40137 + for (var i = 0; i < events.length; i++) { 1.40138 + var event = events[i]; 1.40139 + if (event.eoe) { 1.40140 + break; 1.40141 + } 1.40142 + var fn = function (actionBlock) { 1.40143 + return executeActions(actionBlock, avm1Context, this._getAS2Object()); 1.40144 + }.bind(instance, event.actionsData); 1.40145 + for (var eventName in event) { 1.40146 + if (eventName.indexOf('on') !== 0 || !event[eventName]) 1.40147 + continue; 1.40148 + var avm2EventName = eventName[2].toLowerCase() + eventName.substring(3); 1.40149 + if (avm2EventName === 'enterFrame') { 1.40150 + avm2EventName = 'frameConstructed'; 1.40151 + } 1.40152 + var avm2EventTarget = instance; 1.40153 + if (avm2EventName === 'mouseDown' || avm2EventName === 'mouseUp' || avm2EventName === 'mouseMove') { 1.40154 + avm2EventTarget = this._stage; 1.40155 + } 1.40156 + avm2EventTarget._addEventListener(avm2EventName, fn, false); 1.40157 + eventsBound.push({ 1.40158 + name: avm2EventName, 1.40159 + fn: fn, 1.40160 + target: avm2EventTarget 1.40161 + }); 1.40162 + } 1.40163 + } 1.40164 + if (eventsBound.length > 0) { 1.40165 + instance._addEventListener('removed', function (eventsBound) { 1.40166 + for (var i = 0; i < eventsBound.length; i++) { 1.40167 + eventsBound[i].target._removeEventListener(eventsBound[i].name, eventsBound[i].fn, false); 1.40168 + } 1.40169 + }.bind(instance, eventsBound), false); 1.40170 + } 1.40171 + } 1.40172 + if (name && this._getAS2Object && instance._getAS2Object) { 1.40173 + this._getAS2Object().asSetPublicProperty(name, instance._getAS2Object()); 1.40174 + } 1.40175 + }, 1.40176 + _gotoButtonState: function gotoButtonState(stateName) { 1.40177 + }, 1.40178 + get buttonMode() { 1.40179 + return this._buttonMode; 1.40180 + }, 1.40181 + set buttonMode(val) { 1.40182 + this._buttonMode = val; 1.40183 + }, 1.40184 + get graphics() { 1.40185 + return this._graphics; 1.40186 + }, 1.40187 + get hitArea() { 1.40188 + return this._hitArea; 1.40189 + }, 1.40190 + set hitArea(val) { 1.40191 + if (this._hitArea === val) { 1.40192 + return; 1.40193 + } 1.40194 + if (val && val._hitTarget) { 1.40195 + val._hitTarget.hitArea = null; 1.40196 + } 1.40197 + this._hitArea = val; 1.40198 + if (val) { 1.40199 + val._hitTarget = this; 1.40200 + } 1.40201 + }, 1.40202 + get soundTransform() { 1.40203 + notImplemented(); 1.40204 + }, 1.40205 + set soundTransform(val) { 1.40206 + notImplemented(); 1.40207 + }, 1.40208 + get useHandCursor() { 1.40209 + return this._useHandCursor; 1.40210 + }, 1.40211 + set useHandCursor(val) { 1.40212 + this._useHandCursor = val; 1.40213 + if (this._stage) { 1.40214 + this._stage._mouseMoved = true; 1.40215 + } 1.40216 + }, 1.40217 + startDrag: function (lockCenter, bounds) { 1.40218 + notImplemented(); 1.40219 + }, 1.40220 + startTouchDrag: function (touchPointID, lockCenter, bounds) { 1.40221 + notImplemented(); 1.40222 + }, 1.40223 + stopDrag: function () { 1.40224 + notImplemented(); 1.40225 + }, 1.40226 + stopTouchDrag: function (touchPointID) { 1.40227 + notImplemented(); 1.40228 + } 1.40229 + }; 1.40230 + var desc = Object.getOwnPropertyDescriptor; 1.40231 + def.__glue__ = { 1.40232 + native: { 1.40233 + instance: { 1.40234 + graphics: desc(def, 'graphics'), 1.40235 + buttonMode: desc(def, 'buttonMode'), 1.40236 + dropTarget: desc(def, 'dropTarget'), 1.40237 + startDrag: def.startDrag, 1.40238 + stopDrag: def.stopDrag, 1.40239 + startTouchDrag: def.startTouchDrag, 1.40240 + stopTouchDrag: def.stopTouchDrag, 1.40241 + constructChildren: def._constructChildren, 1.40242 + hitArea: desc(def, 'hitArea'), 1.40243 + useHandCursor: desc(def, 'useHandCursor'), 1.40244 + soundTransform: desc(def, 'soundTransform') 1.40245 + } 1.40246 + } 1.40247 + }; 1.40248 + return def; 1.40249 + }.call(this); 1.40250 +var StageDefinition = function () { 1.40251 + return { 1.40252 + __class__: 'flash.display.Stage', 1.40253 + initialize: function () { 1.40254 + this._frameRate = 24; 1.40255 + this._scaleMode = 'showAll'; 1.40256 + this._align = ''; 1.40257 + this._stageWidth = 0; 1.40258 + this._stageHeight = 0; 1.40259 + this._quality = 'high'; 1.40260 + this._color = 4294967295; 1.40261 + this._stage = this; 1.40262 + this._deferRenderEvent = false; 1.40263 + this._focus = null; 1.40264 + this._showDefaultContextMenu = true; 1.40265 + this._displayState = 'normal'; 1.40266 + this._colorCorrection = 'default'; 1.40267 + this._stageFocusRect = true; 1.40268 + this._fullScreenSourceRect = null; 1.40269 + this._wmodeGPU = false; 1.40270 + this._root = null; 1.40271 + this._qtree = null; 1.40272 + this._invalidRegions = new RegionCluster(); 1.40273 + this._mouseMoved = false; 1.40274 + this._mouseTarget = this; 1.40275 + this._mouseEvents = []; 1.40276 + this._cursor = 'auto'; 1.40277 + this._stageVideos = []; 1.40278 + this._concatenatedTransform.invalid = false; 1.40279 + }, 1.40280 + _setup: function setup(ctx, options) { 1.40281 + this._qtree = new QuadTree(0, 0, this._stageWidth, this._stageHeight, null); 1.40282 + this._invalid = true; 1.40283 + }, 1.40284 + _addToStage: function addToStage(displayObject) { 1.40285 + displayObject._stage = this; 1.40286 + var parent = displayObject._parent; 1.40287 + displayObject._level = parent._level + 1; 1.40288 + displayObject._invalid = true; 1.40289 + var children = displayObject._children; 1.40290 + for (var i = 0; i < children.length; i++) { 1.40291 + var child = children[i]; 1.40292 + if (child._stage === null) { 1.40293 + this._addToStage(child); 1.40294 + } 1.40295 + } 1.40296 + displayObject._dispatchEvent('addedToStage'); 1.40297 + }, 1.40298 + _removeFromStage: function removeFromStage(displayObject) { 1.40299 + var children = displayObject._children; 1.40300 + for (var i = 0; i < children.length; i++) { 1.40301 + var child = children[i]; 1.40302 + if (child._stage) { 1.40303 + this._removeFromStage(children[i]); 1.40304 + } 1.40305 + } 1.40306 + displayObject._dispatchEvent('removedFromStage'); 1.40307 + displayObject._stage = null; 1.40308 + displayObject._level = -1; 1.40309 + if (displayObject._region) { 1.40310 + this._qtree.remove(displayObject._region); 1.40311 + this._invalidRegions.insert(displayObject._region); 1.40312 + displayObject._region = null; 1.40313 + } 1.40314 + }, 1.40315 + _processInvalidations: function processInvalidations(refreshStage) { 1.40316 + var qtree = this._qtree; 1.40317 + var invalidRegions = this._invalidRegions; 1.40318 + var stack = []; 1.40319 + var zindex = 0; 1.40320 + var children = this._children; 1.40321 + var i = children.length; 1.40322 + while (i--) { 1.40323 + var child = children[i]; 1.40324 + if (refreshStage) { 1.40325 + child._invalid = true; 1.40326 + } 1.40327 + child._invisible = !child._visible; 1.40328 + stack.push(child); 1.40329 + } 1.40330 + while (stack.length) { 1.40331 + var node = stack.pop(); 1.40332 + var m = node._concatenatedTransform; 1.40333 + var children = node._children; 1.40334 + var i = children.length; 1.40335 + while (i--) { 1.40336 + var child = children[i]; 1.40337 + if (!flash.display.DisplayObject.class.isInstanceOf(child)) { 1.40338 + continue; 1.40339 + } 1.40340 + if (node._invalid) { 1.40341 + child._invalid = true; 1.40342 + } 1.40343 + if (m.invalid) { 1.40344 + child._concatenatedTransform.invalid = true; 1.40345 + } 1.40346 + child._invisible = node._invisible || !child._visible; 1.40347 + stack.push(child); 1.40348 + } 1.40349 + if (node._level && m.invalid) { 1.40350 + var m2 = node._currentTransform; 1.40351 + var m3 = node._parent._concatenatedTransform; 1.40352 + m.a = m2.a * m3.a + m2.b * m3.c; 1.40353 + m.b = m2.a * m3.b + m2.b * m3.d; 1.40354 + m.c = m2.c * m3.a + m2.d * m3.c; 1.40355 + m.d = m2.d * m3.d + m2.c * m3.b; 1.40356 + m.tx = m2.tx * m3.a + m3.tx + m2.ty * m3.c; 1.40357 + m.ty = m2.ty * m3.d + m3.ty + m2.tx * m3.b; 1.40358 + m.invalid = false; 1.40359 + } 1.40360 + var invalidRegion = node._region; 1.40361 + var currentRegion = node._getRegion(m); 1.40362 + var hidden = node._invisible || !currentRegion || currentRegion.xMax - currentRegion.xMin === 0 || currentRegion.yMax - currentRegion.yMin === 0 || currentRegion.xMax <= 0 || currentRegion.xMin >= this._stageWidth || currentRegion.yMax <= 0 || currentRegion.yMin >= this._stageHeight; 1.40363 + if (node._invalid) { 1.40364 + if (invalidRegion) { 1.40365 + invalidRegions.insert(invalidRegion); 1.40366 + } 1.40367 + if (!hidden && (!invalidRegion || currentRegion.xMin !== invalidRegion.xMin || currentRegion.yMin !== invalidRegion.yMin || currentRegion.xMax !== invalidRegion.xMax || currentRegion.yMax !== invalidRegion.yMax)) { 1.40368 + invalidRegions.insert(currentRegion); 1.40369 + } 1.40370 + } 1.40371 + if (hidden) { 1.40372 + if (invalidRegion) { 1.40373 + qtree.remove(invalidRegion); 1.40374 + node._region = null; 1.40375 + } 1.40376 + } else if (invalidRegion) { 1.40377 + invalidRegion.xMin = currentRegion.xMin; 1.40378 + invalidRegion.xMax = currentRegion.xMax; 1.40379 + invalidRegion.yMin = currentRegion.yMin; 1.40380 + invalidRegion.yMax = currentRegion.yMax; 1.40381 + qtree.update(invalidRegion); 1.40382 + } else { 1.40383 + currentRegion.obj = node; 1.40384 + qtree.insert(currentRegion); 1.40385 + node._region = currentRegion; 1.40386 + } 1.40387 + node._zindex = zindex++; 1.40388 + } 1.40389 + var invalidPath = new ShapePath(); 1.40390 + if (refreshStage) { 1.40391 + invalidPath.rect(0, 0, this._stageWidth, this._stageHeight); 1.40392 + invalidRegions.reset(); 1.40393 + return invalidPath; 1.40394 + } 1.40395 + var redrawRegions = invalidRegions.retrieve(); 1.40396 + for (var i = 0; i < redrawRegions.length; i++) { 1.40397 + var region = redrawRegions[i]; 1.40398 + var xMin = region.xMin - region.xMin % 20 - 40; 1.40399 + var yMin = region.yMin - region.yMin % 20 - 40; 1.40400 + var xMax = region.xMax - region.xMax % 20 + 80; 1.40401 + var yMax = region.yMax - region.yMax % 20 + 80; 1.40402 + var intersectees = qtree.retrieve(xMin, xMax, yMin, yMax); 1.40403 + for (var j = 0; j < intersectees.length; j++) { 1.40404 + var item = intersectees[j]; 1.40405 + item.obj._invalid = true; 1.40406 + } 1.40407 + invalidPath.rect(xMin, yMin, xMax - xMin, yMax - yMin); 1.40408 + } 1.40409 + invalidRegions.reset(); 1.40410 + return invalidPath; 1.40411 + }, 1.40412 + _handleMouseButtons: function () { 1.40413 + if (this._mouseEvents.length === 0) { 1.40414 + return; 1.40415 + } 1.40416 + var eventType = this._mouseEvents.shift(); 1.40417 + switch (eventType) { 1.40418 + case 'mousedown': 1.40419 + if (this._mouseTarget._buttonMode) { 1.40420 + this._mouseTarget._gotoButtonState('down'); 1.40421 + } 1.40422 + this._mouseTarget._dispatchEvent('mouseDown'); 1.40423 + break; 1.40424 + case 'mouseup': 1.40425 + if (this._mouseTarget._buttonMode) { 1.40426 + this._mouseTarget._gotoButtonState('over'); 1.40427 + } 1.40428 + this._mouseTarget._dispatchEvent('mouseUp'); 1.40429 + break; 1.40430 + } 1.40431 + }, 1.40432 + _handleMouse: function handleMouse() { 1.40433 + var mouseX = this._mouseX; 1.40434 + var mouseY = this._mouseY; 1.40435 + var candidates = this._qtree.retrieve(mouseX, mouseX, mouseY, mouseY); 1.40436 + var objectsUnderMouse = []; 1.40437 + for (var i = 0; i < candidates.length; i++) { 1.40438 + var item = candidates[i]; 1.40439 + var displayObject = item.obj; 1.40440 + var isUnderMouse = false; 1.40441 + if (flash.display.SimpleButton.class.isInstanceOf(displayObject)) { 1.40442 + if (!displayObject._enabled) { 1.40443 + continue; 1.40444 + } 1.40445 + var hitArea = displayObject._hitTestState; 1.40446 + hitArea._parent = displayObject; 1.40447 + isUnderMouse = hitArea._hitTest(true, mouseX, mouseY, true); 1.40448 + hitArea._parent = null; 1.40449 + } else { 1.40450 + isUnderMouse = displayObject._hitTest(true, mouseX, mouseY, true); 1.40451 + } 1.40452 + if (isUnderMouse) { 1.40453 + var currentNode = displayObject; 1.40454 + var lastEnabled = null; 1.40455 + if (!flash.display.InteractiveObject.class.isInstanceOf(currentNode)) { 1.40456 + lastEnabled = currentNode; 1.40457 + currentNode = currentNode._parent; 1.40458 + } 1.40459 + do { 1.40460 + if (!currentNode._mouseEnabled) { 1.40461 + lastEnabled = null; 1.40462 + } else if (lastEnabled === null) { 1.40463 + lastEnabled = currentNode; 1.40464 + } 1.40465 + currentNode = currentNode._parent; 1.40466 + } while (currentNode); 1.40467 + objectsUnderMouse.push(lastEnabled); 1.40468 + } 1.40469 + } 1.40470 + var target; 1.40471 + if (objectsUnderMouse.length) { 1.40472 + objectsUnderMouse.sort(sortByZindex); 1.40473 + var i = objectsUnderMouse.length; 1.40474 + while (i--) { 1.40475 + target = null; 1.40476 + var currentNode = objectsUnderMouse[i]; 1.40477 + if (!flash.display.InteractiveObject.class.isInstanceOf(currentNode)) { 1.40478 + var j = i; 1.40479 + while (j--) { 1.40480 + if (objectsUnderMouse[j]._parent === currentNode._parent && flash.display.InteractiveObject.class.isInstanceOf(objectsUnderMouse[j])) { 1.40481 + currentNode = objectsUnderMouse[j]; 1.40482 + i = j; 1.40483 + } 1.40484 + } 1.40485 + } 1.40486 + do { 1.40487 + if (flash.display.InteractiveObject.class.isInstanceOf(currentNode)) { 1.40488 + if ((!target || !currentNode._mouseChildren) && !currentNode._hitArea) { 1.40489 + target = currentNode; 1.40490 + } 1.40491 + } 1.40492 + currentNode = currentNode._parent; 1.40493 + } while (currentNode); 1.40494 + if (target !== objectsUnderMouse[i] && flash.display.SimpleButton.class.isInstanceOf(target)) { 1.40495 + continue; 1.40496 + } 1.40497 + break; 1.40498 + } 1.40499 + } 1.40500 + if (!target) { 1.40501 + target = this; 1.40502 + } else if (target._hitTarget) { 1.40503 + target = target._hitTarget; 1.40504 + } 1.40505 + if (target === this._mouseTarget) { 1.40506 + target._dispatchEvent('mouseMove'); 1.40507 + } else { 1.40508 + if (this._mouseTarget._buttonMode) { 1.40509 + this._mouseTarget._gotoButtonState('up'); 1.40510 + } 1.40511 + this._mouseTarget._dispatchEvent('mouseOut'); 1.40512 + var nodeLeft = this._mouseTarget; 1.40513 + var containerLeft = nodeLeft._parent; 1.40514 + var nodeEntered = target; 1.40515 + var containerEntered = nodeEntered._parent; 1.40516 + var cursor = 'auto'; 1.40517 + while (nodeLeft._level >= 0 && nodeLeft !== containerEntered) { 1.40518 + if (nodeLeft._hasEventListener('rollOut')) { 1.40519 + nodeLeft._dispatchEvent('rollOut'); 1.40520 + } 1.40521 + nodeLeft = nodeLeft._parent; 1.40522 + } 1.40523 + while (nodeEntered._level >= 0 && nodeEntered !== containerLeft) { 1.40524 + if (nodeEntered._hasEventListener('rollOver')) { 1.40525 + nodeEntered._dispatchEvent('rollOver'); 1.40526 + } 1.40527 + if (nodeEntered._buttonMode && nodeEntered._useHandCursor) { 1.40528 + cursor = 'pointer'; 1.40529 + } 1.40530 + nodeEntered = nodeEntered._parent; 1.40531 + } 1.40532 + if (target._buttonMode) { 1.40533 + target._gotoButtonState('over'); 1.40534 + } 1.40535 + target._dispatchEvent('mouseOver'); 1.40536 + this._mouseTarget = target; 1.40537 + this._cursor = cursor; 1.40538 + } 1.40539 + }, 1.40540 + _as2SetLevel: function (level, loader) { 1.40541 + somewhatImplemented('Stage._as2SetLevel'); 1.40542 + this.addChild(loader); 1.40543 + }, 1.40544 + __glue__: { 1.40545 + native: { 1.40546 + instance: { 1.40547 + invalidate: function invalidate() { 1.40548 + this._invalid = true; 1.40549 + this._deferRenderEvent = true; 1.40550 + }, 1.40551 + isFocusInaccessible: function isFocusInaccessible() { 1.40552 + notImplemented('Stage.isFocusInaccessible'); 1.40553 + }, 1.40554 + set_displayState: function set_displayState(value) { 1.40555 + somewhatImplemented('Stage.set_displayState'); 1.40556 + this._displayState = value; 1.40557 + }, 1.40558 + get_simulatedFullScreenWidth: function get_simulatedFullScreenWidth() { 1.40559 + notImplemented('Stage.get_simulatedFullScreenWidth'); 1.40560 + }, 1.40561 + get_simulatedFullScreenHeight: function get_simulatedFullScreenHeight() { 1.40562 + notImplemented('Stage.get_simulatedFullScreenHeight'); 1.40563 + }, 1.40564 + removeChildAt: function removeChildAt(index) { 1.40565 + notImplemented('Stage.removeChildAt'); 1.40566 + }, 1.40567 + swapChildrenAt: function swapChildrenAt(index1, index2) { 1.40568 + notImplemented('Stage.swapChildrenAt'); 1.40569 + }, 1.40570 + requireOwnerPermissions: function requireOwnerPermissions() { 1.40571 + somewhatImplemented('Stage.requireOwnerPermissions'); 1.40572 + }, 1.40573 + frameRate: { 1.40574 + get: function frameRate() { 1.40575 + return this._frameRate; 1.40576 + }, 1.40577 + set: function frameRate(value) { 1.40578 + this._frameRate = value; 1.40579 + } 1.40580 + }, 1.40581 + scaleMode: { 1.40582 + get: function scaleMode() { 1.40583 + return this._scaleMode; 1.40584 + }, 1.40585 + set: function scaleMode(value) { 1.40586 + this._scaleMode = value; 1.40587 + this._invalid = true; 1.40588 + } 1.40589 + }, 1.40590 + align: { 1.40591 + get: function align() { 1.40592 + return this._align; 1.40593 + }, 1.40594 + set: function align(value) { 1.40595 + this._align = value; 1.40596 + this._invalid = true; 1.40597 + } 1.40598 + }, 1.40599 + stageWidth: { 1.40600 + get: function stageWidth() { 1.40601 + return this._stageWidth / 20; 1.40602 + }, 1.40603 + set: function stageWidth(value) { 1.40604 + notImplemented('Stage.stageWidth'); 1.40605 + this._stageWidth = value * 20 | 0; 1.40606 + } 1.40607 + }, 1.40608 + stageHeight: { 1.40609 + get: function stageHeight() { 1.40610 + return this._stageHeight / 20; 1.40611 + }, 1.40612 + set: function stageHeight(value) { 1.40613 + notImplemented('Stage.stageHeight'); 1.40614 + this._stageHeight = value * 20 | 0; 1.40615 + } 1.40616 + }, 1.40617 + showDefaultContextMenu: { 1.40618 + get: function showDefaultContextMenu() { 1.40619 + return this._showDefaultContextMenu; 1.40620 + }, 1.40621 + set: function showDefaultContextMenu(value) { 1.40622 + somewhatImplemented('Stage.showDefaultContextMenu'); 1.40623 + this._showDefaultContextMenu = value; 1.40624 + } 1.40625 + }, 1.40626 + focus: { 1.40627 + get: function focus() { 1.40628 + return this._focus; 1.40629 + }, 1.40630 + set: function focus(newFocus) { 1.40631 + somewhatImplemented('Stage.focus'); 1.40632 + this._focus = newFocus; 1.40633 + } 1.40634 + }, 1.40635 + colorCorrection: { 1.40636 + get: function colorCorrection() { 1.40637 + return this._colorCorrection; 1.40638 + }, 1.40639 + set: function colorCorrection(value) { 1.40640 + notImplemented('Stage.colorCorrection'); 1.40641 + this._colorCorrection = value; 1.40642 + } 1.40643 + }, 1.40644 + colorCorrectionSupport: { 1.40645 + get: function colorCorrectionSupport() { 1.40646 + return false; 1.40647 + } 1.40648 + }, 1.40649 + stageFocusRect: { 1.40650 + get: function stageFocusRect() { 1.40651 + return this._stageFocusRect; 1.40652 + }, 1.40653 + set: function stageFocusRect(on) { 1.40654 + somewhatImplemented('Stage.stageFocusRect'); 1.40655 + this._stageFocusRect = on; 1.40656 + } 1.40657 + }, 1.40658 + quality: { 1.40659 + get: function quality() { 1.40660 + return this._quality; 1.40661 + }, 1.40662 + set: function quality(value) { 1.40663 + somewhatImplemented('Stage.stageFocusRect'); 1.40664 + this._quality = value; 1.40665 + } 1.40666 + }, 1.40667 + displayState: { 1.40668 + get: function displayState() { 1.40669 + return this._displayState; 1.40670 + }, 1.40671 + set: function displayState(value) { 1.40672 + this._displayState = value; 1.40673 + } 1.40674 + }, 1.40675 + simulatedDisplayState: { 1.40676 + get: function simulatedDisplayState() { 1.40677 + notImplemented('Stage.simulatedDisplayState'); 1.40678 + return this._simulatedDisplayState; 1.40679 + }, 1.40680 + set: function simulatedDisplayState(value) { 1.40681 + notImplemented('Stage.simulatedDisplayState'); 1.40682 + this._simulatedDisplayState = value; 1.40683 + } 1.40684 + }, 1.40685 + fullScreenSourceRect: { 1.40686 + get: function fullScreenSourceRect() { 1.40687 + return this._fullScreenSourceRect; 1.40688 + }, 1.40689 + set: function fullScreenSourceRect(value) { 1.40690 + notImplemented('Stage.fullScreenSourceRect'); 1.40691 + this._fullScreenSourceRect = value; 1.40692 + } 1.40693 + }, 1.40694 + simulatedFullScreenSourceRect: { 1.40695 + get: function simulatedFullScreenSourceRect() { 1.40696 + notImplemented('Stage.simulatedFullScreenSourceRect'); 1.40697 + return this._simulatedFullScreenSourceRect; 1.40698 + }, 1.40699 + set: function simulatedFullScreenSourceRect(value) { 1.40700 + notImplemented('Stage.simulatedFullScreenSourceRect'); 1.40701 + this._simulatedFullScreenSourceRect = value; 1.40702 + } 1.40703 + }, 1.40704 + stageVideos: { 1.40705 + get: function stageVideos() { 1.40706 + somewhatImplemented('Stage.stageVideos'); 1.40707 + return this._stageVideos; 1.40708 + } 1.40709 + }, 1.40710 + stage3Ds: { 1.40711 + get: function stage3Ds() { 1.40712 + notImplemented('Stage.stage3Ds'); 1.40713 + return this._stage3Ds; 1.40714 + } 1.40715 + }, 1.40716 + color: { 1.40717 + get: function color() { 1.40718 + return this._color; 1.40719 + }, 1.40720 + set: function color(color) { 1.40721 + this._color = color; 1.40722 + this._invalid = true; 1.40723 + } 1.40724 + }, 1.40725 + fullScreenWidth: { 1.40726 + get: function fullScreenWidth() { 1.40727 + notImplemented('Stage.fullScreenWidth'); 1.40728 + return this._fullScreenWidth; 1.40729 + } 1.40730 + }, 1.40731 + fullScreenHeight: { 1.40732 + get: function fullScreenHeight() { 1.40733 + notImplemented('Stage.fullScreenHeight'); 1.40734 + return this._fullScreenHeight; 1.40735 + } 1.40736 + }, 1.40737 + wmodeGPU: { 1.40738 + get: function wmodeGPU() { 1.40739 + somewhatImplemented('Stage.wmodeGPU'); 1.40740 + return this._wmodeGPU; 1.40741 + } 1.40742 + }, 1.40743 + softKeyboardRect: { 1.40744 + get: function softKeyboardRect() { 1.40745 + notImplemented('Stage.softKeyboardRect'); 1.40746 + return this._softKeyboardRect; 1.40747 + } 1.40748 + }, 1.40749 + allowsFullScreen: { 1.40750 + get: function allowsFullScreen() { 1.40751 + return false; 1.40752 + } 1.40753 + }, 1.40754 + displayContextInfo: { 1.40755 + get: function displayContextInfo() { 1.40756 + notImplemented('Stage.displayContextInfo'); 1.40757 + return this._displayContextInfo; 1.40758 + } 1.40759 + } 1.40760 + } 1.40761 + } 1.40762 + } 1.40763 + }; 1.40764 + }.call(this); 1.40765 +{ 1.40766 + var EventDefinition = function () { 1.40767 + return { 1.40768 + __class__: 'flash.events.Event', 1.40769 + initialize: function () { 1.40770 + this._stopPropagation = false; 1.40771 + this._stopImmediatePropagation = false; 1.40772 + this._isDefaultPrevented = false; 1.40773 + this._target = null; 1.40774 + this._currentTarget = null; 1.40775 + this._eventPhase = 2; 1.40776 + }, 1.40777 + __glue__: { 1.40778 + native: { 1.40779 + instance: { 1.40780 + ctor: function ctor(type, bubbles, cancelable) { 1.40781 + Counter.count('Event: ' + type); 1.40782 + this._type = type; 1.40783 + this._bubbles = bubbles; 1.40784 + this._cancelable = cancelable; 1.40785 + }, 1.40786 + stopPropagation: function stopPropagation() { 1.40787 + this._stopPropagation = true; 1.40788 + }, 1.40789 + stopImmediatePropagation: function stopImmediatePropagation() { 1.40790 + this._stopImmediatePropagation = this._stopPropagation = true; 1.40791 + }, 1.40792 + preventDefault: function preventDefault() { 1.40793 + if (this._cancelable) 1.40794 + this._isDefaultPrevented = true; 1.40795 + }, 1.40796 + isDefaultPrevented: function isDefaultPrevented() { 1.40797 + return this._isDefaultPrevented; 1.40798 + }, 1.40799 + type: { 1.40800 + get: function type() { 1.40801 + return this._type; 1.40802 + } 1.40803 + }, 1.40804 + bubbles: { 1.40805 + get: function bubbles() { 1.40806 + return this._bubbles; 1.40807 + } 1.40808 + }, 1.40809 + cancelable: { 1.40810 + get: function cancelable() { 1.40811 + return this._cancelable; 1.40812 + } 1.40813 + }, 1.40814 + target: { 1.40815 + get: function target() { 1.40816 + return this._target; 1.40817 + } 1.40818 + }, 1.40819 + currentTarget: { 1.40820 + get: function currentTarget() { 1.40821 + return this._currentTarget; 1.40822 + } 1.40823 + }, 1.40824 + eventPhase: { 1.40825 + get: function eventPhase() { 1.40826 + return this._eventPhase; 1.40827 + } 1.40828 + } 1.40829 + } 1.40830 + }, 1.40831 + script: { 1.40832 + static: Glue.ALL, 1.40833 + instance: { 1.40834 + clone: 'open public clone' 1.40835 + } 1.40836 + } 1.40837 + } 1.40838 + }; 1.40839 + }.call(this); 1.40840 +} 1.40841 +var EventDispatcherDefinition = function () { 1.40842 + var mouseEvents = { 1.40843 + click: true, 1.40844 + contextMenu: true, 1.40845 + doubleClick: true, 1.40846 + middleClick: true, 1.40847 + middleMouseDown: true, 1.40848 + middleMouseUp: true, 1.40849 + mouseDown: true, 1.40850 + mouseMove: true, 1.40851 + mouseOut: true, 1.40852 + mouseOver: true, 1.40853 + mouseUp: true, 1.40854 + mouseWheel: true, 1.40855 + releaseOutside: true, 1.40856 + rightClick: true, 1.40857 + rightMouseDown: true, 1.40858 + rightMouseUp: true, 1.40859 + rollOut: false, 1.40860 + rollOver: false 1.40861 + }; 1.40862 + function doDispatchEvent(dispatcher, event, eventClass, bubbles) { 1.40863 + var target = dispatcher._target; 1.40864 + var type = event._type || event; 1.40865 + var listeners = dispatcher._listeners[type]; 1.40866 + if (bubbles || typeof event === 'string' && mouseEvents[event] || event._bubbles) { 1.40867 + var ancestors = []; 1.40868 + var currentNode = target._parent; 1.40869 + while (currentNode) { 1.40870 + if (currentNode._hasEventListener(type)) { 1.40871 + ancestors.push(currentNode); 1.40872 + } 1.40873 + currentNode = currentNode._parent; 1.40874 + } 1.40875 + if (!listeners && !ancestors.length) { 1.40876 + return true; 1.40877 + } 1.40878 + var keepPropagating = true; 1.40879 + var i = ancestors.length; 1.40880 + while (i-- && keepPropagating) { 1.40881 + var currentTarget = ancestors[i]; 1.40882 + var queue = currentTarget._captureListeners[type]; 1.40883 + keepPropagating = processListeners(queue, event, eventClass, bubbles, target, currentTarget, 1); 1.40884 + } 1.40885 + if (listeners && keepPropagating) { 1.40886 + keepPropagating = processListeners(listeners, event, eventClass, bubbles, target); 1.40887 + } 1.40888 + for (var i = 0; i < ancestors.length && keepPropagating; i++) { 1.40889 + var currentTarget = ancestors[i]; 1.40890 + var queue = currentTarget._listeners[type]; 1.40891 + keepPropagating = processListeners(queue, event, eventClass, bubbles, target, currentTarget, 3); 1.40892 + } 1.40893 + } else if (listeners) { 1.40894 + processListeners(listeners, event, eventClass, bubbles, target); 1.40895 + } 1.40896 + return !event._isDefaultPrevented; 1.40897 + } 1.40898 + function processListeners(queue, event, eventClass, bubbles, target, currentTarget, eventPhase) { 1.40899 + if (queue) { 1.40900 + queue = queue.slice(); 1.40901 + var needsInit = true; 1.40902 + try { 1.40903 + for (var i = 0; i < queue.length; i++) { 1.40904 + var item = queue[i]; 1.40905 + var methodInfo = item.handleEvent.methodInfo; 1.40906 + if (methodInfo) { 1.40907 + if (methodInfo.parameters.length) { 1.40908 + if (!methodInfo.parameters[0].isUsed) { 1.40909 + item.handleEvent(); 1.40910 + continue; 1.40911 + } 1.40912 + } 1.40913 + } 1.40914 + if (needsInit) { 1.40915 + if (typeof event === 'string') { 1.40916 + if (eventClass) { 1.40917 + event = new eventClass(event); 1.40918 + } else { 1.40919 + if (mouseEvents[event]) { 1.40920 + event = new flash.events.MouseEvent(event, mouseEvents[event]); 1.40921 + if (target._stage) { 1.40922 + event._localX = target.mouseX; 1.40923 + event._localY = target.mouseY; 1.40924 + } 1.40925 + } else { 1.40926 + event = new flash.events.Event(event); 1.40927 + } 1.40928 + } 1.40929 + } else if (event._target) { 1.40930 + event = event.clone(); 1.40931 + } 1.40932 + event._target = target; 1.40933 + event._currentTarget = currentTarget || target; 1.40934 + event._eventPhase = eventPhase || 2; 1.40935 + needsInit = false; 1.40936 + } 1.40937 + item.handleEvent(event); 1.40938 + if (event._stopImmediatePropagation) { 1.40939 + break; 1.40940 + } 1.40941 + } 1.40942 + } catch (e) { 1.40943 + avm2.exceptions.push({ 1.40944 + source: 'avm2', 1.40945 + message: e.message, 1.40946 + stack: e.stack 1.40947 + }); 1.40948 + throw e; 1.40949 + } 1.40950 + } 1.40951 + return !event._stopPropagation; 1.40952 + } 1.40953 + return { 1.40954 + __class__: 'flash.events.EventDispatcher', 1.40955 + initialize: function () { 1.40956 + this._target = this; 1.40957 + this._listeners = {}; 1.40958 + this._captureListeners = {}; 1.40959 + }, 1.40960 + _addEventListenerImpl: function addEventListenerImpl(type, listener, useCapture, priority) { 1.40961 + if (typeof listener !== 'function') { 1.40962 + throwError('TypeError', Errors.CheckTypeFailedError, listener, 'Function'); 1.40963 + } 1.40964 + var listeners = useCapture ? this._captureListeners : this._listeners; 1.40965 + var queue = listeners[type]; 1.40966 + var listenerObj = { 1.40967 + handleEvent: listener, 1.40968 + priority: priority || 0 1.40969 + }; 1.40970 + if (queue) { 1.40971 + var level = queue.length; 1.40972 + var i = level; 1.40973 + while (i--) { 1.40974 + var item = queue[i]; 1.40975 + if (item.handleEvent === listener) { 1.40976 + return; 1.40977 + } 1.40978 + if (priority > item.priority) { 1.40979 + level = i; 1.40980 + } 1.40981 + } 1.40982 + queue.splice(level, 0, listenerObj); 1.40983 + } else { 1.40984 + listeners[type] = [ 1.40985 + listenerObj 1.40986 + ]; 1.40987 + } 1.40988 + }, 1.40989 + _addEventListener: function addEventListener(type, listener, useCapture, priority) { 1.40990 + this._addEventListenerImpl(type, listener, useCapture, priority); 1.40991 + }, 1.40992 + _removeEventListenerImpl: function removeEventListenerImpl(type, listener, useCapture) { 1.40993 + if (typeof listener !== 'function') { 1.40994 + throwError('TypeError', Errors.CheckTypeFailedError, listener, 'Function'); 1.40995 + } 1.40996 + var listeners = useCapture ? this._captureListeners : this._listeners; 1.40997 + var queue = listeners[type]; 1.40998 + if (queue) { 1.40999 + for (var i = 0; i < queue.length; i++) { 1.41000 + var item = queue[i]; 1.41001 + if (item.handleEvent === listener) { 1.41002 + queue.splice(i, 1); 1.41003 + if (!queue.length) { 1.41004 + listeners[type] = null; 1.41005 + } 1.41006 + return; 1.41007 + } 1.41008 + } 1.41009 + } 1.41010 + }, 1.41011 + _removeEventListener: function removeEventListener(type, listener, useCapture) { 1.41012 + this._removeEventListenerImpl(type, listener, useCapture); 1.41013 + }, 1.41014 + _hasEventListener: function hasEventListener(type) { 1.41015 + return this._listeners[type] || this._captureListeners[type]; 1.41016 + }, 1.41017 + _dispatchEvent: function dispatchEvent(event, eventClass, bubbles) { 1.41018 + doDispatchEvent(this, event, eventClass, bubbles); 1.41019 + }, 1.41020 + __glue__: { 1.41021 + native: { 1.41022 + instance: { 1.41023 + ctor: function ctor(target) { 1.41024 + this._target = target || this; 1.41025 + }, 1.41026 + addEventListener: function addEventListener(type, listener, useCapture, priority, useWeakReference) { 1.41027 + this._addEventListener(type, listener, useCapture, priority); 1.41028 + }, 1.41029 + removeEventListener: function removeEventListener(type, listener, useCapture) { 1.41030 + this._removeEventListener(type, listener, useCapture); 1.41031 + }, 1.41032 + hasEventListener: function hasEventListener(type) { 1.41033 + return this._hasEventListener(type); 1.41034 + }, 1.41035 + willTrigger: function willTrigger(type) { 1.41036 + var currentNode = this._target; 1.41037 + do { 1.41038 + if (currentNode._hasEventListener(type)) { 1.41039 + return true; 1.41040 + } 1.41041 + } while (currentNode = currentNode._parent); 1.41042 + return false; 1.41043 + }, 1.41044 + dispatchEventFunction: function dispatchEventFunction(event) { 1.41045 + return doDispatchEvent(this, event); 1.41046 + } 1.41047 + } 1.41048 + } 1.41049 + } 1.41050 + }; 1.41051 + }.call(this); 1.41052 +var KeyboardEventDefinition = function () { 1.41053 + return { 1.41054 + __class__: 'flash.events.KeyboardEvent', 1.41055 + __glue__: { 1.41056 + native: { 1.41057 + instance: { 1.41058 + updateAfterEvent: function updateAfterEvent() { 1.41059 + notImplemented('KeyboardEvent.updateAfterEvent'); 1.41060 + }, 1.41061 + charCode: { 1.41062 + get: function charCode() { 1.41063 + return this._charCode; 1.41064 + }, 1.41065 + set: function charCode(value) { 1.41066 + this._charCode = value; 1.41067 + } 1.41068 + }, 1.41069 + ctrlKey: { 1.41070 + get: function ctrlKey() { 1.41071 + return this._ctrlKey; 1.41072 + }, 1.41073 + set: function ctrlKey(value) { 1.41074 + this._ctrlKey = value; 1.41075 + } 1.41076 + }, 1.41077 + altKey: { 1.41078 + get: function altKey() { 1.41079 + return this._altKey; 1.41080 + }, 1.41081 + set: function altKey(value) { 1.41082 + this._altKey = value; 1.41083 + } 1.41084 + }, 1.41085 + shiftKey: { 1.41086 + get: function shiftKey() { 1.41087 + return this._shiftKey; 1.41088 + }, 1.41089 + set: function shiftKey(value) { 1.41090 + this._shiftKey = value; 1.41091 + } 1.41092 + } 1.41093 + } 1.41094 + }, 1.41095 + script: { 1.41096 + static: Glue.ALL, 1.41097 + instance: { 1.41098 + keyCode: 'public keyCode' 1.41099 + } 1.41100 + } 1.41101 + } 1.41102 + }; 1.41103 + }.call(this); 1.41104 +var MouseEventDefinition = function () { 1.41105 + return { 1.41106 + __class__: 'flash.events.MouseEvent', 1.41107 + initialize: function () { 1.41108 + this._localX = NaN; 1.41109 + this._localY = NaN; 1.41110 + }, 1.41111 + __glue__: { 1.41112 + native: { 1.41113 + instance: { 1.41114 + updateAfterEvent: function updateAfterEvent() { 1.41115 + }, 1.41116 + getStageX: function getStageX() { 1.41117 + if (this._target) { 1.41118 + var m = this._target._getConcatenatedTransform(null, false); 1.41119 + var x = m.a * this._localX + m.c * this._localY + m.tx; 1.41120 + return x / 20; 1.41121 + } 1.41122 + return this._localX / 20; 1.41123 + }, 1.41124 + getStageY: function getStageY() { 1.41125 + if (this._target) { 1.41126 + var m = this._target._getConcatenatedTransform(null, false); 1.41127 + var y = m.d * this._localY + m.b * this._localX + m.ty; 1.41128 + return y / 20; 1.41129 + } 1.41130 + return this._localY / 20; 1.41131 + }, 1.41132 + localX: { 1.41133 + get: function localX() { 1.41134 + return this._localX / 20; 1.41135 + }, 1.41136 + set: function localX(value) { 1.41137 + this._localX = value * 20 | 0; 1.41138 + } 1.41139 + }, 1.41140 + localY: { 1.41141 + get: function localY() { 1.41142 + return this._localY / 20; 1.41143 + }, 1.41144 + set: function localY(value) { 1.41145 + this._localY = value * 20 | 0; 1.41146 + } 1.41147 + } 1.41148 + } 1.41149 + }, 1.41150 + script: { 1.41151 + static: Glue.ALL 1.41152 + } 1.41153 + } 1.41154 + }; 1.41155 + }.call(this); 1.41156 +var TextEventDefinition = function () { 1.41157 + return { 1.41158 + __class__: 'flash.events.TextEvent', 1.41159 + __glue__: { 1.41160 + native: { 1.41161 + instance: { 1.41162 + copyNativeData: function copyNativeData(other) { 1.41163 + notImplemented('TextEvent.copyNativeData'); 1.41164 + } 1.41165 + } 1.41166 + } 1.41167 + } 1.41168 + }; 1.41169 + }.call(this); 1.41170 +var TimerEventDefinition = function () { 1.41171 + return { 1.41172 + __class__: 'flash.events.TimerEvent', 1.41173 + __glue__: { 1.41174 + native: { 1.41175 + instance: { 1.41176 + updateAfterEvent: function updateAfterEvent() { 1.41177 + notImplemented('TimerEvent.updateAfterEvent'); 1.41178 + } 1.41179 + } 1.41180 + } 1.41181 + } 1.41182 + }; 1.41183 + }.call(this); 1.41184 +{ 1.41185 + var ExternalInterfaceDefinition = function () { 1.41186 + function getAvailable() { 1.41187 + return true; 1.41188 + } 1.41189 + var initialized = false; 1.41190 + var registeredCallbacks = {}; 1.41191 + function callIn(functionName, args) { 1.41192 + if (!registeredCallbacks.hasOwnProperty(functionName)) 1.41193 + return; 1.41194 + return registeredCallbacks[functionName](functionName, args); 1.41195 + } 1.41196 + return { 1.41197 + __class__: 'flash.external.ExternalInterface', 1.41198 + initialize: function () { 1.41199 + }, 1.41200 + __glue__: { 1.41201 + native: { 1.41202 + static: { 1.41203 + _initJS: function _initJS() { 1.41204 + if (initialized) 1.41205 + return; 1.41206 + TelemetryService.reportTelemetry({ 1.41207 + topic: 'feature', 1.41208 + feature: EXTERNAL_INTERFACE_FEATURE 1.41209 + }); 1.41210 + initialized = true; 1.41211 + FirefoxCom.initJS(callIn); 1.41212 + }, 1.41213 + _getPropNames: function _getPropNames(obj) { 1.41214 + var keys = []; 1.41215 + forEachPublicProperty(obj, function (key) { 1.41216 + keys.push(key); 1.41217 + }); 1.41218 + return keys; 1.41219 + }, 1.41220 + _addCallback: function _addCallback(functionName, closure, hasNullCallback) { 1.41221 + FirefoxCom.request('externalCom', { 1.41222 + action: 'register', 1.41223 + functionName: functionName, 1.41224 + remove: hasNullCallback 1.41225 + }); 1.41226 + if (hasNullCallback) { 1.41227 + delete registeredCallbacks[functionName]; 1.41228 + } else { 1.41229 + registeredCallbacks[functionName] = closure; 1.41230 + } 1.41231 + }, 1.41232 + _evalJS: function _evalJS(expression) { 1.41233 + return FirefoxCom.requestSync('externalCom', { 1.41234 + action: 'eval', 1.41235 + expression: expression 1.41236 + }); 1.41237 + }, 1.41238 + _callOut: function _callOut(request) { 1.41239 + return FirefoxCom.requestSync('externalCom', { 1.41240 + action: 'call', 1.41241 + request: request 1.41242 + }); 1.41243 + }, 1.41244 + available: { 1.41245 + get: getAvailable 1.41246 + }, 1.41247 + objectID: { 1.41248 + get: function objectID() { 1.41249 + return FirefoxCom.requestSync('externalCom', { 1.41250 + action: 'getId' 1.41251 + }); 1.41252 + } 1.41253 + }, 1.41254 + activeX: { 1.41255 + get: function activeX() { 1.41256 + return false; 1.41257 + } 1.41258 + } 1.41259 + }, 1.41260 + instance: {} 1.41261 + } 1.41262 + } 1.41263 + }; 1.41264 + }.call(this); 1.41265 +} 1.41266 +{ 1.41267 + var BevelFilterDefinition = function () { 1.41268 + var def = { 1.41269 + __class__: 'flash.filters.BevelFilter', 1.41270 + initialize: function () { 1.41271 + }, 1.41272 + _updateFilterBounds: function (bounds) { 1.41273 + } 1.41274 + }; 1.41275 + def.__glue__ = {}; 1.41276 + return def; 1.41277 + }.call(this); 1.41278 +} 1.41279 +var BitmapFilterDefinition = function () { 1.41280 + var def = { 1.41281 + __class__: 'flash.filters.BitmapFilter', 1.41282 + initialize: function () { 1.41283 + }, 1.41284 + _updateFilterBounds: function (bounds) { 1.41285 + } 1.41286 + }; 1.41287 + def.__glue__ = {}; 1.41288 + return def; 1.41289 + }.call(this); 1.41290 +var BlurFilterDefinition = function () { 1.41291 + return { 1.41292 + __class__: 'flash.filters.BlurFilter', 1.41293 + initialize: function () { 1.41294 + }, 1.41295 + _updateFilterBounds: function (bounds) { 1.41296 + var bx = this._blurX * this._quality * 20; 1.41297 + var by = this._blurY * this._quality * 20; 1.41298 + bounds.xMin -= bx; 1.41299 + bounds.xMax += bx; 1.41300 + bounds.yMin -= by; 1.41301 + bounds.yMax += by; 1.41302 + }, 1.41303 + __glue__: { 1.41304 + native: { 1.41305 + static: {}, 1.41306 + instance: { 1.41307 + blurX: { 1.41308 + get: function blurX() { 1.41309 + return this._blurX; 1.41310 + }, 1.41311 + set: function blurX(value) { 1.41312 + this._blurX = value; 1.41313 + } 1.41314 + }, 1.41315 + blurY: { 1.41316 + get: function blurY() { 1.41317 + return this._blurY; 1.41318 + }, 1.41319 + set: function blurY(value) { 1.41320 + this._blurY = value; 1.41321 + } 1.41322 + }, 1.41323 + quality: { 1.41324 + get: function quality() { 1.41325 + return this._quality; 1.41326 + }, 1.41327 + set: function quality(value) { 1.41328 + this._quality = value; 1.41329 + } 1.41330 + } 1.41331 + } 1.41332 + } 1.41333 + } 1.41334 + }; 1.41335 + }.call(this); 1.41336 +var ColorMatrixFilterDefinition = function () { 1.41337 + return { 1.41338 + __class__: 'flash.filters.ColorMatrixFilter', 1.41339 + initialize: function () { 1.41340 + }, 1.41341 + _updateFilterBounds: function (bounds) { 1.41342 + }, 1.41343 + __glue__: { 1.41344 + native: { 1.41345 + instance: { 1.41346 + matrix: { 1.41347 + get: function matrix() { 1.41348 + return this._matrix; 1.41349 + }, 1.41350 + set: function matrix(value) { 1.41351 + this._matrix = value; 1.41352 + } 1.41353 + } 1.41354 + } 1.41355 + } 1.41356 + } 1.41357 + }; 1.41358 + }.call(this); 1.41359 +var ConvolutionFilterDefinition = function () { 1.41360 + var def = { 1.41361 + __class__: 'flash.filters.ConvolutionFilter', 1.41362 + initialize: function () { 1.41363 + }, 1.41364 + _updateFilterBounds: function (bounds) { 1.41365 + } 1.41366 + }; 1.41367 + def.__glue__ = {}; 1.41368 + return def; 1.41369 + }.call(this); 1.41370 +var DisplacementMapFilterDefinition = function () { 1.41371 + var def = { 1.41372 + __class__: 'flash.filters.DisplacementMapFilter', 1.41373 + initialize: function () { 1.41374 + }, 1.41375 + _updateFilterBounds: function (bounds) { 1.41376 + } 1.41377 + }; 1.41378 + def.__glue__ = {}; 1.41379 + return def; 1.41380 + }.call(this); 1.41381 +var DropShadowFilterDefinition = function () { 1.41382 + return { 1.41383 + __class__: 'flash.filters.DropShadowFilter', 1.41384 + initialize: function () { 1.41385 + }, 1.41386 + _updateFilterBounds: function (bounds) { 1.41387 + var a = this._angle * Math.PI / 180; 1.41388 + var dy = Math.sin(a) * this._distance; 1.41389 + var dx = Math.cos(a) * this._distance; 1.41390 + var bx = this._blurX * this._quality * 20; 1.41391 + var by = this._blurY * this._quality * 20; 1.41392 + bounds.xMin -= bx - (dx > 0 ? 0 : dx); 1.41393 + bounds.xMax += bx + Math.abs(dx); 1.41394 + bounds.yMin -= by - (dy > 0 ? 0 : dy); 1.41395 + bounds.yMax += by + Math.abs(dy); 1.41396 + }, 1.41397 + __glue__: { 1.41398 + native: { 1.41399 + instance: { 1.41400 + distance: { 1.41401 + get: function distance() { 1.41402 + return this._distance; 1.41403 + }, 1.41404 + set: function distance(value) { 1.41405 + this._distance = value; 1.41406 + } 1.41407 + }, 1.41408 + angle: { 1.41409 + get: function angle() { 1.41410 + return this._angle; 1.41411 + }, 1.41412 + set: function angle(value) { 1.41413 + this._angle = value; 1.41414 + } 1.41415 + }, 1.41416 + color: { 1.41417 + get: function color() { 1.41418 + return this._color; 1.41419 + }, 1.41420 + set: function color(value) { 1.41421 + this._color = value; 1.41422 + } 1.41423 + }, 1.41424 + alpha: { 1.41425 + get: function alpha() { 1.41426 + return this._alpha; 1.41427 + }, 1.41428 + set: function alpha(value) { 1.41429 + this._alpha = value; 1.41430 + } 1.41431 + }, 1.41432 + blurX: { 1.41433 + get: function blurX() { 1.41434 + return this._blurX; 1.41435 + }, 1.41436 + set: function blurX(value) { 1.41437 + this._blurX = value; 1.41438 + } 1.41439 + }, 1.41440 + blurY: { 1.41441 + get: function blurY() { 1.41442 + return this._blurY; 1.41443 + }, 1.41444 + set: function blurY(value) { 1.41445 + this._blurY = value; 1.41446 + } 1.41447 + }, 1.41448 + hideObject: { 1.41449 + get: function hideObject() { 1.41450 + return this._hideObject; 1.41451 + }, 1.41452 + set: function hideObject(value) { 1.41453 + this._hideObject = value; 1.41454 + } 1.41455 + }, 1.41456 + inner: { 1.41457 + get: function inner() { 1.41458 + return this._inner; 1.41459 + }, 1.41460 + set: function inner(value) { 1.41461 + this._inner = value; 1.41462 + } 1.41463 + }, 1.41464 + knockout: { 1.41465 + get: function knockout() { 1.41466 + return this._knockout; 1.41467 + }, 1.41468 + set: function knockout(value) { 1.41469 + this._knockout = value; 1.41470 + } 1.41471 + }, 1.41472 + quality: { 1.41473 + get: function quality() { 1.41474 + return this._quality; 1.41475 + }, 1.41476 + set: function quality(value) { 1.41477 + this._quality = value; 1.41478 + } 1.41479 + }, 1.41480 + strength: { 1.41481 + get: function strength() { 1.41482 + return this._strength; 1.41483 + }, 1.41484 + set: function strength(value) { 1.41485 + this._strength = value; 1.41486 + } 1.41487 + } 1.41488 + } 1.41489 + } 1.41490 + } 1.41491 + }; 1.41492 + }.call(this); 1.41493 +var GlowFilterDefinition = function () { 1.41494 + return { 1.41495 + __class__: 'flash.filters.GlowFilter', 1.41496 + initialize: function () { 1.41497 + }, 1.41498 + _updateFilterBounds: function (bounds) { 1.41499 + var bx = this._blurX * this._quality * 20; 1.41500 + var by = this._blurY * this._quality * 20; 1.41501 + bounds.xMin -= bx; 1.41502 + bounds.xMax += bx; 1.41503 + bounds.yMin -= by; 1.41504 + bounds.yMax += by; 1.41505 + }, 1.41506 + __glue__: { 1.41507 + native: { 1.41508 + static: {}, 1.41509 + instance: { 1.41510 + color: { 1.41511 + get: function color() { 1.41512 + return this._color; 1.41513 + }, 1.41514 + set: function color(value) { 1.41515 + this._color = value; 1.41516 + } 1.41517 + }, 1.41518 + alpha: { 1.41519 + get: function alpha() { 1.41520 + return this._alpha; 1.41521 + }, 1.41522 + set: function alpha(value) { 1.41523 + this._alpha = value; 1.41524 + } 1.41525 + }, 1.41526 + blurX: { 1.41527 + get: function blurX() { 1.41528 + return this._blurX; 1.41529 + }, 1.41530 + set: function blurX(value) { 1.41531 + this._blurX = value; 1.41532 + } 1.41533 + }, 1.41534 + blurY: { 1.41535 + get: function blurY() { 1.41536 + return this._blurY; 1.41537 + }, 1.41538 + set: function blurY(value) { 1.41539 + this._blurY = value; 1.41540 + } 1.41541 + }, 1.41542 + inner: { 1.41543 + get: function inner() { 1.41544 + return this._inner; 1.41545 + }, 1.41546 + set: function inner(value) { 1.41547 + this._inner = value; 1.41548 + } 1.41549 + }, 1.41550 + knockout: { 1.41551 + get: function knockout() { 1.41552 + return this._knockout; 1.41553 + }, 1.41554 + set: function knockout(value) { 1.41555 + this._knockout = value; 1.41556 + } 1.41557 + }, 1.41558 + quality: { 1.41559 + get: function quality() { 1.41560 + return this._quality; 1.41561 + }, 1.41562 + set: function quality(value) { 1.41563 + this._quality = value; 1.41564 + } 1.41565 + }, 1.41566 + strength: { 1.41567 + get: function strength() { 1.41568 + return this._strength; 1.41569 + }, 1.41570 + set: function strength(value) { 1.41571 + this._strength = value; 1.41572 + } 1.41573 + } 1.41574 + } 1.41575 + } 1.41576 + } 1.41577 + }; 1.41578 + }.call(this); 1.41579 +var GradientBevelFilterDefinition = function () { 1.41580 + var def = { 1.41581 + __class__: 'flash.filters.GradientBevelFilter', 1.41582 + initialize: function () { 1.41583 + }, 1.41584 + _updateFilterBounds: function (bounds) { 1.41585 + } 1.41586 + }; 1.41587 + def.__glue__ = {}; 1.41588 + return def; 1.41589 + }.call(this); 1.41590 +var GradientGlowFilterDefinition = function () { 1.41591 + var def = { 1.41592 + __class__: 'flash.filters.GradientGlowFilter', 1.41593 + initialize: function () { 1.41594 + }, 1.41595 + _updateFilterBounds: function (bounds) { 1.41596 + } 1.41597 + }; 1.41598 + def.__glue__ = {}; 1.41599 + return def; 1.41600 + }.call(this); 1.41601 +var ShaderFilterDefinition = function () { 1.41602 + var def = { 1.41603 + __class__: 'flash.filters.ShaderFilter', 1.41604 + initialize: function () { 1.41605 + }, 1.41606 + _updateFilterBounds: function (bounds) { 1.41607 + } 1.41608 + }; 1.41609 + def.__glue__ = {}; 1.41610 + return def; 1.41611 + }.call(this); 1.41612 +{ 1.41613 + var ColorTransformDefinition = function () { 1.41614 + return { 1.41615 + __class__: 'flash.geom.ColorTransform', 1.41616 + __glue__: { 1.41617 + script: { 1.41618 + instance: Glue.ALL 1.41619 + } 1.41620 + } 1.41621 + }; 1.41622 + }.call(this); 1.41623 +} 1.41624 +var MatrixDefinition = function () { 1.41625 + return { 1.41626 + __class__: 'flash.geom.Matrix', 1.41627 + __glue__: { 1.41628 + script: { 1.41629 + instance: Glue.ALL 1.41630 + } 1.41631 + } 1.41632 + }; 1.41633 + }.call(this); 1.41634 +var Matrix3DDefinition = function () { 1.41635 + var precision = 1e-7; 1.41636 + var transposeTransform = new Uint32Array([ 1.41637 + 0, 1.41638 + 4, 1.41639 + 8, 1.41640 + 12, 1.41641 + 1, 1.41642 + 5, 1.41643 + 9, 1.41644 + 13, 1.41645 + 2, 1.41646 + 6, 1.41647 + 10, 1.41648 + 14, 1.41649 + 3, 1.41650 + 7, 1.41651 + 11, 1.41652 + 15 1.41653 + ]); 1.41654 + function getRotationMatrix(theta, u, v, w, a, b, c) { 1.41655 + var u2 = u * u, v2 = v * v, w2 = w * w; 1.41656 + var L2 = u2 + v2 + w2, L = Math.sqrt(L2); 1.41657 + u /= L; 1.41658 + v /= L; 1.41659 + w /= L; 1.41660 + u2 /= L2; 1.41661 + v2 /= L2; 1.41662 + w2 /= L2; 1.41663 + var cos = Math.cos(theta), sin = Math.sin(theta); 1.41664 + return new flash.geom.Matrix3D([ 1.41665 + u2 + (v2 + w2) * cos, 1.41666 + u * v * (1 - cos) + w * sin, 1.41667 + u * w * (1 - cos) - v * sin, 1.41668 + 0, 1.41669 + u * v * (1 - cos) - w * sin, 1.41670 + v2 + (u2 + w2) * cos, 1.41671 + v * w * (1 - cos) + u * sin, 1.41672 + 0, 1.41673 + u * w * (1 - cos) + v * sin, 1.41674 + v * w * (1 - cos) - u * sin, 1.41675 + w2 + (u2 + v2) * cos, 1.41676 + 0, 1.41677 + (a * (v2 + w2) - u * (b * v + c * w)) * (1 - cos) + (b * w - c * v) * sin, 1.41678 + (b * (u2 + w2) - v * (a * u + c * w)) * (1 - cos) + (c * u - a * w) * sin, 1.41679 + (c * (u2 + v2) - w * (a * u + b * v)) * (1 - cos) + (a * v - b * u) * sin, 1.41680 + 1 1.41681 + ]); 1.41682 + } 1.41683 + return { 1.41684 + __class__: 'flash.geom.Matrix3D', 1.41685 + initialize: function () { 1.41686 + }, 1.41687 + __glue__: { 1.41688 + native: { 1.41689 + static: { 1.41690 + interpolate: function interpolate(thisMat, toMat, percent) { 1.41691 + notImplemented('Matrix3D.interpolate'); 1.41692 + } 1.41693 + }, 1.41694 + instance: { 1.41695 + ctor: function ctor(v) { 1.41696 + this._matrix = new Float32Array(16); 1.41697 + if (v && v.length >= 16) { 1.41698 + this.copyRawDataFrom(v, 0, false); 1.41699 + } else { 1.41700 + this.identity(); 1.41701 + } 1.41702 + }, 1.41703 + clone: function clone() { 1.41704 + return new flash.geom.Matrix3D(this._matrix); 1.41705 + }, 1.41706 + copyToMatrix3D: function copyToMatrix3D(dest) { 1.41707 + dest._matrix.set(this._matrix); 1.41708 + }, 1.41709 + append: function append(lhs) { 1.41710 + var ma = lhs._matrix, mb = this._matrix, m = this._matrix; 1.41711 + var ma11 = ma[0], ma12 = ma[4], ma13 = ma[8], ma14 = ma[12], ma21 = ma[1], ma22 = ma[5], ma23 = ma[9], ma24 = ma[13], ma31 = ma[2], ma32 = ma[6], ma33 = ma[10], ma34 = ma[14], ma41 = ma[3], ma42 = ma[7], ma43 = ma[11], ma44 = ma[15]; 1.41712 + var mb11 = mb[0], mb12 = mb[4], mb13 = mb[8], mb14 = mb[12], mb21 = mb[1], mb22 = mb[5], mb23 = mb[9], mb24 = mb[13], mb31 = mb[2], mb32 = mb[6], mb33 = mb[10], mb34 = mb[14], mb41 = mb[3], mb42 = mb[7], mb43 = mb[11], mb44 = mb[15]; 1.41713 + m[0] = ma11 * mb11 + ma12 * mb21 + ma13 * mb31 + ma14 * mb41; 1.41714 + m[1] = ma21 * mb11 + ma22 * mb21 + ma23 * mb31 + ma24 * mb41; 1.41715 + m[2] = ma31 * mb11 + ma32 * mb21 + ma33 * mb31 + ma34 * mb41; 1.41716 + m[3] = ma41 * mb11 + ma42 * mb21 + ma43 * mb31 + ma44 * mb41; 1.41717 + m[4] = ma11 * mb12 + ma12 * mb22 + ma13 * mb32 + ma14 * mb42; 1.41718 + m[5] = ma21 * mb12 + ma22 * mb22 + ma23 * mb32 + ma24 * mb42; 1.41719 + m[6] = ma31 * mb12 + ma32 * mb22 + ma33 * mb32 + ma34 * mb42; 1.41720 + m[7] = ma41 * mb12 + ma42 * mb22 + ma43 * mb32 + ma44 * mb42; 1.41721 + m[8] = ma11 * mb13 + ma12 * mb23 + ma13 * mb33 + ma14 * mb43; 1.41722 + m[9] = ma21 * mb13 + ma22 * mb23 + ma23 * mb33 + ma24 * mb43; 1.41723 + m[10] = ma31 * mb13 + ma32 * mb23 + ma33 * mb33 + ma34 * mb43; 1.41724 + m[11] = ma41 * mb13 + ma42 * mb23 + ma43 * mb33 + ma44 * mb43; 1.41725 + m[12] = ma11 * mb14 + ma12 * mb24 + ma13 * mb34 + ma14 * mb44; 1.41726 + m[13] = ma21 * mb14 + ma22 * mb24 + ma23 * mb34 + ma24 * mb44; 1.41727 + m[14] = ma31 * mb14 + ma32 * mb24 + ma33 * mb34 + ma34 * mb44; 1.41728 + m[15] = ma41 * mb14 + ma42 * mb24 + ma43 * mb34 + ma44 * mb44; 1.41729 + }, 1.41730 + prepend: function prepend(rhs) { 1.41731 + var ma = this._matrix, mb = rhs._matrix, m = this._matrix; 1.41732 + var ma11 = ma[0], ma12 = ma[4], ma13 = ma[8], ma14 = ma[12], ma21 = ma[1], ma22 = ma[5], ma23 = ma[9], ma24 = ma[13], ma31 = ma[2], ma32 = ma[6], ma33 = ma[10], ma34 = ma[14], ma41 = ma[3], ma42 = ma[7], ma43 = ma[11], ma44 = ma[15]; 1.41733 + var mb11 = mb[0], mb12 = mb[4], mb13 = mb[8], mb14 = mb[12], mb21 = mb[1], mb22 = mb[5], mb23 = mb[9], mb24 = mb[13], mb31 = mb[2], mb32 = mb[6], mb33 = mb[10], mb34 = mb[14], mb41 = mb[3], mb42 = mb[7], mb43 = mb[11], mb44 = mb[15]; 1.41734 + m[0] = ma11 * mb11 + ma12 * mb21 + ma13 * mb31 + ma14 * mb41; 1.41735 + m[1] = ma21 * mb11 + ma22 * mb21 + ma23 * mb31 + ma24 * mb41; 1.41736 + m[2] = ma31 * mb11 + ma32 * mb21 + ma33 * mb31 + ma34 * mb41; 1.41737 + m[3] = ma41 * mb11 + ma42 * mb21 + ma43 * mb31 + ma44 * mb41; 1.41738 + m[4] = ma11 * mb12 + ma12 * mb22 + ma13 * mb32 + ma14 * mb42; 1.41739 + m[5] = ma21 * mb12 + ma22 * mb22 + ma23 * mb32 + ma24 * mb42; 1.41740 + m[6] = ma31 * mb12 + ma32 * mb22 + ma33 * mb32 + ma34 * mb42; 1.41741 + m[7] = ma41 * mb12 + ma42 * mb22 + ma43 * mb32 + ma44 * mb42; 1.41742 + m[8] = ma11 * mb13 + ma12 * mb23 + ma13 * mb33 + ma14 * mb43; 1.41743 + m[9] = ma21 * mb13 + ma22 * mb23 + ma23 * mb33 + ma24 * mb43; 1.41744 + m[10] = ma31 * mb13 + ma32 * mb23 + ma33 * mb33 + ma34 * mb43; 1.41745 + m[11] = ma41 * mb13 + ma42 * mb23 + ma43 * mb33 + ma44 * mb43; 1.41746 + m[12] = ma11 * mb14 + ma12 * mb24 + ma13 * mb34 + ma14 * mb44; 1.41747 + m[13] = ma21 * mb14 + ma22 * mb24 + ma23 * mb34 + ma24 * mb44; 1.41748 + m[14] = ma31 * mb14 + ma32 * mb24 + ma33 * mb34 + ma34 * mb44; 1.41749 + m[15] = ma41 * mb14 + ma42 * mb24 + ma43 * mb34 + ma44 * mb44; 1.41750 + }, 1.41751 + invert: function invert() { 1.41752 + var d = this.determinant; 1.41753 + if (Math.abs(d) < precision) { 1.41754 + return false; 1.41755 + } 1.41756 + d = 1 / d; 1.41757 + var m = this._matrix; 1.41758 + var m11 = m[0], m12 = m[1], m13 = m[2], m14 = m[3], m21 = m[4], m22 = m[5], m23 = m[6], m24 = m[7], m31 = m[8], m32 = m[9], m33 = m[10], m34 = m[11], m41 = m[12], m42 = m[13], m43 = m[14], m44 = m[15]; 1.41759 + m[0] = d * (m22 * (m33 * m44 - m43 * m34) - m32 * (m23 * m44 - m43 * m24) + m42 * (m23 * m34 - m33 * m24)); 1.41760 + m[1] = -d * (m12 * (m33 * m44 - m43 * m34) - m32 * (m13 * m44 - m43 * m14) + m42 * (m13 * m34 - m33 * m14)); 1.41761 + m[2] = d * (m12 * (m23 * m44 - m43 * m24) - m22 * (m13 * m44 - m43 * m14) + m42 * (m13 * m24 - m23 * m14)); 1.41762 + m[3] = -d * (m12 * (m23 * m34 - m33 * m24) - m22 * (m13 * m34 - m33 * m14) + m32 * (m13 * m24 - m23 * m14)); 1.41763 + m[4] = -d * (m21 * (m33 * m44 - m43 * m34) - m31 * (m23 * m44 - m43 * m24) + m41 * (m23 * m34 - m33 * m24)); 1.41764 + m[5] = d * (m11 * (m33 * m44 - m43 * m34) - m31 * (m13 * m44 - m43 * m14) + m41 * (m13 * m34 - m33 * m14)); 1.41765 + m[6] = -d * (m11 * (m23 * m44 - m43 * m24) - m21 * (m13 * m44 - m43 * m14) + m41 * (m13 * m24 - m23 * m14)); 1.41766 + m[7] = d * (m11 * (m23 * m34 - m33 * m24) - m21 * (m13 * m34 - m33 * m14) + m31 * (m13 * m24 - m23 * m14)); 1.41767 + m[8] = d * (m21 * (m32 * m44 - m42 * m34) - m31 * (m22 * m44 - m42 * m24) + m41 * (m22 * m34 - m32 * m24)); 1.41768 + m[9] = -d * (m11 * (m32 * m44 - m42 * m34) - m31 * (m12 * m44 - m42 * m14) + m41 * (m12 * m34 - m32 * m14)); 1.41769 + m[10] = d * (m11 * (m22 * m44 - m42 * m24) - m21 * (m12 * m44 - m42 * m14) + m41 * (m12 * m24 - m22 * m14)); 1.41770 + m[11] = -d * (m11 * (m22 * m34 - m32 * m24) - m21 * (m12 * m34 - m32 * m14) + m31 * (m12 * m24 - m22 * m14)); 1.41771 + m[12] = -d * (m21 * (m32 * m43 - m42 * m33) - m31 * (m22 * m43 - m42 * m23) + m41 * (m22 * m33 - m32 * m23)); 1.41772 + m[13] = d * (m11 * (m32 * m43 - m42 * m33) - m31 * (m12 * m43 - m42 * m13) + m41 * (m12 * m33 - m32 * m13)); 1.41773 + m[14] = -d * (m11 * (m22 * m43 - m42 * m23) - m21 * (m12 * m43 - m42 * m13) + m41 * (m12 * m23 - m22 * m13)); 1.41774 + m[15] = d * (m11 * (m22 * m33 - m32 * m23) - m21 * (m12 * m33 - m32 * m13) + m31 * (m12 * m23 - m22 * m13)); 1.41775 + return true; 1.41776 + }, 1.41777 + identity: function identity() { 1.41778 + var m = this._matrix; 1.41779 + m[0] = m[5] = m[10] = m[15] = 1; 1.41780 + m[1] = m[2] = m[3] = m[4] = m[6] = m[7] = m[8] = m[9] = m[11] = m[12] = m[13] = m[14] = 0; 1.41781 + }, 1.41782 + decompose: function decompose(orientationStyle) { 1.41783 + notImplemented('Matrix3D.decompose'); 1.41784 + }, 1.41785 + recompose: function recompose(components, orientationStyle) { 1.41786 + notImplemented('Matrix3D.recompose'); 1.41787 + }, 1.41788 + appendTranslation: function appendTranslation(x, y, z) { 1.41789 + var m = this._matrix; 1.41790 + var m41 = m[3], m42 = m[7], m43 = m[11], m44 = m[15]; 1.41791 + m[0] += x * m41; 1.41792 + m[1] += y * m41; 1.41793 + m[2] += z * m41; 1.41794 + m[4] += x * m42; 1.41795 + m[5] += y * m42; 1.41796 + m[6] += z * m42; 1.41797 + m[8] += x * m43; 1.41798 + m[9] += y * m43; 1.41799 + m[10] += z * m43; 1.41800 + m[12] += x * m44; 1.41801 + m[13] += y * m44; 1.41802 + m[14] += z * m44; 1.41803 + }, 1.41804 + appendRotation: function appendRotation(degrees, axis, pivotPoint) { 1.41805 + this.append(getRotationMatrix(degrees / 180 * Math.PI, axis.x, axis.y, axis.z, pivotPoint ? pivotPoint.x : 0, pivotPoint ? pivotPoint.y : 0, pivotPoint ? pivotPoint.z : 0)); 1.41806 + }, 1.41807 + appendScale: function appendScale(xScale, yScale, zScale) { 1.41808 + var m = this._matrix; 1.41809 + m[0] *= xScale; 1.41810 + m[1] *= yScale; 1.41811 + m[2] *= zScale; 1.41812 + m[4] *= xScale; 1.41813 + m[5] *= yScale; 1.41814 + m[6] *= zScale; 1.41815 + m[8] *= xScale; 1.41816 + m[9] *= yScale; 1.41817 + m[10] *= zScale; 1.41818 + m[12] *= xScale; 1.41819 + m[13] *= yScale; 1.41820 + m[14] *= zScale; 1.41821 + }, 1.41822 + prependTranslation: function prependTranslation(x, y, z) { 1.41823 + var m = this._matrix; 1.41824 + var m11 = m[0], m12 = m[4], m13 = m[8], m14 = m[12], m21 = m[1], m22 = m[5], m23 = m[9], m24 = m[13], m31 = m[2], m32 = m[6], m33 = m[10], m34 = m[14], m41 = m[3], m42 = m[7], m43 = m[11], m44 = m[15]; 1.41825 + m[12] += m11 * x + m12 * y + m13 * z; 1.41826 + m[13] += m21 * x + m22 * y + m23 * z; 1.41827 + m[14] += m31 * x + m32 * y + m33 * z; 1.41828 + m[15] += m41 * x + m42 * y + m43 * z; 1.41829 + }, 1.41830 + prependRotation: function prependRotation(degrees, axis, pivotPoint) { 1.41831 + this.prepend(getRotationMatrix(degrees / 180 * Math.PI, axis.x, axis.y, axis.z, pivotPoint ? pivotPoint.x : 0, pivotPoint ? pivotPoint.y : 0, pivotPoint ? pivotPoint.z : 0)); 1.41832 + }, 1.41833 + prependScale: function prependScale(xScale, yScale, zScale) { 1.41834 + var m = this._matrix; 1.41835 + m[0] *= xScale; 1.41836 + m[1] *= xScale; 1.41837 + m[2] *= xScale; 1.41838 + m[3] *= xScale; 1.41839 + m[4] *= yScale; 1.41840 + m[5] *= yScale; 1.41841 + m[6] *= yScale; 1.41842 + m[7] *= yScale; 1.41843 + m[8] *= zScale; 1.41844 + m[9] *= zScale; 1.41845 + m[10] *= zScale; 1.41846 + m[11] *= zScale; 1.41847 + }, 1.41848 + transformVector: function transformVector(v) { 1.41849 + var m = this._matrix; 1.41850 + var x = v.x, y = v.y, z = v.z; 1.41851 + return new flash.geom.Vector3D(m[0] * x + m[4] * y + m[8] * z + m[12], m[1] * x + m[5] * y + m[9] * z + m[13], m[2] * x + m[6] * y + m[10] * z + m[14]); 1.41852 + }, 1.41853 + deltaTransformVector: function deltaTransformVector(v) { 1.41854 + var m = this._matrix; 1.41855 + var x = v.x, y = v.y, z = v.z; 1.41856 + return new flash.geom.Vector3D(m[0] * x + m[4] * y + m[8] * z, m[1] * x + m[5] * y + m[9] * z, m[2] * x + m[6] * y + m[10] * z); 1.41857 + }, 1.41858 + transformVectors: function transformVectors(vin, vout) { 1.41859 + var m = this._matrix; 1.41860 + var m11 = m[0], m12 = m[4], m13 = m[8], m14 = m[12], m21 = m[1], m22 = m[5], m23 = m[9], m24 = m[13], m31 = m[2], m32 = m[6], m33 = m[10], m34 = m[14], m41 = m[3], m42 = m[7], m43 = m[11], m44 = m[15]; 1.41861 + for (var i = 0; i < vin.length - 2; i += 3) { 1.41862 + var x = vin.asGetNumericProperty(i), y = vin.asGetNumericProperty(i + 1), z = vin.asGetNumericProperty(i + 2); 1.41863 + vout.push(m11 * x + m12 * y + m13 * z + m14); 1.41864 + vout.push(m21 * x + m22 * y + m23 * z + m24); 1.41865 + vout.push(m31 * x + m32 * y + m33 * z + m34); 1.41866 + } 1.41867 + }, 1.41868 + transpose: function transpose() { 1.41869 + var m = this._matrix; 1.41870 + var tmp; 1.41871 + tmp = m[1]; 1.41872 + m[1] = m[4]; 1.41873 + m[4] = tmp; 1.41874 + tmp = m[2]; 1.41875 + m[2] = m[8]; 1.41876 + m[5] = tmp; 1.41877 + tmp = m[3]; 1.41878 + m[3] = m[12]; 1.41879 + m[12] = tmp; 1.41880 + tmp = m[6]; 1.41881 + m[6] = m[9]; 1.41882 + m[9] = tmp; 1.41883 + tmp = m[7]; 1.41884 + m[7] = m[13]; 1.41885 + m[13] = tmp; 1.41886 + tmp = m[11]; 1.41887 + m[11] = m[14]; 1.41888 + m[14] = tmp; 1.41889 + }, 1.41890 + pointAt: function pointAt(pos, at, up) { 1.41891 + notImplemented('Matrix3D.pointAt'); 1.41892 + }, 1.41893 + interpolateTo: function interpolateTo(toMat, percent) { 1.41894 + notImplemented('Matrix3D.interpolateTo'); 1.41895 + }, 1.41896 + copyFrom: function copyFrom(sourceMatrix3D) { 1.41897 + this._matrix.set(sourceMatrix3D._matrix); 1.41898 + }, 1.41899 + copyRawDataTo: function copyRawDataTo(vector, index, transpose) { 1.41900 + var m = this._matrix; 1.41901 + if (transpose) { 1.41902 + for (var i = 0, j = index | 0; i < 16; i++, j++) { 1.41903 + vector.asSetNumericProperty(j, m[transposeTransform[i]]); 1.41904 + } 1.41905 + } else { 1.41906 + for (var i = 0, j = index | 0; i < 16; i++, j++) { 1.41907 + vector.asSetNumericProperty(j, m[i]); 1.41908 + } 1.41909 + } 1.41910 + }, 1.41911 + copyRawDataFrom: function copyRawDataFrom(vector, index, transpose) { 1.41912 + var m = this._matrix; 1.41913 + if (transpose) { 1.41914 + for (var i = 0, j = index | 0; i < 16; i++, j++) { 1.41915 + m[transposeTransform[i]] = vector.asGetNumericProperty(j) || 0; 1.41916 + } 1.41917 + } else { 1.41918 + for (var i = 0, j = index | 0; i < 16; i++, j++) { 1.41919 + m[i] = vector.asGetNumericProperty(j) || 0; 1.41920 + } 1.41921 + } 1.41922 + }, 1.41923 + copyRowTo: function copyRowTo(row, vector3D) { 1.41924 + var offset = row | 0; 1.41925 + var m = this._matrix; 1.41926 + vector3D.x = m[offset]; 1.41927 + vector3D.y = m[offset + 4]; 1.41928 + vector3D.z = m[offset + 8]; 1.41929 + vector3D.w = m[offset + 12]; 1.41930 + }, 1.41931 + copyColumnTo: function copyColumnTo(column, vector3D) { 1.41932 + var offset = column << 2; 1.41933 + var m = this._matrix; 1.41934 + vector3D.x = m[offset]; 1.41935 + vector3D.y = m[offset + 1]; 1.41936 + vector3D.z = m[offset + 2]; 1.41937 + vector3D.w = m[offset + 3]; 1.41938 + }, 1.41939 + copyRowFrom: function copyRowFrom(row, vector3D) { 1.41940 + var offset = row | 0; 1.41941 + var m = this._matrix; 1.41942 + m[offset] = vector3D.x; 1.41943 + m[offset + 4] = vector3D.y; 1.41944 + m[offset + 8] = vector3D.z; 1.41945 + m[offset + 12] = vector3D.w; 1.41946 + }, 1.41947 + copyColumnFrom: function copyColumnFrom(column, vector3D) { 1.41948 + var offset = column << 2; 1.41949 + var m = this._matrix; 1.41950 + m[offset] = vector3D.x; 1.41951 + m[offset + 1] = vector3D.y; 1.41952 + m[offset + 2] = vector3D.z; 1.41953 + m[offset + 3] = vector3D.w; 1.41954 + }, 1.41955 + rawData: { 1.41956 + get: function rawData() { 1.41957 + var result = new Float64Vector(); 1.41958 + this.copyRawDataTo(result, 0, false); 1.41959 + return result; 1.41960 + }, 1.41961 + set: function rawData(v) { 1.41962 + this.copyRawDataFrom(v, 0, false); 1.41963 + } 1.41964 + }, 1.41965 + position: { 1.41966 + get: function position() { 1.41967 + var m = this._matrix; 1.41968 + return new flash.geom.Vector3D(m[12], m[13], m[14]); 1.41969 + }, 1.41970 + set: function position(pos) { 1.41971 + var m = this._matrix; 1.41972 + m[12] = pos.x; 1.41973 + m[13] = pos.y; 1.41974 + m[14] = pos.z; 1.41975 + } 1.41976 + }, 1.41977 + determinant: { 1.41978 + get: function determinant() { 1.41979 + var m = this._matrix; 1.41980 + var m11 = m[0], m12 = m[4], m13 = m[8], m14 = m[12], m21 = m[1], m22 = m[5], m23 = m[9], m24 = m[13], m31 = m[2], m32 = m[6], m33 = m[10], m34 = m[14], m41 = m[3], m42 = m[7], m43 = m[11], m44 = m[15]; 1.41981 + var d; 1.41982 + d = m11 * (m22 * (m33 * m44 - m43 * m34) - m32 * (m23 * m44 - m43 * m24) + m42 * (m23 * m34 - m33 * m24)) - m21 * (m12 * (m33 * m44 - m43 * m34) - m32 * (m13 * m44 - m43 * m14) + m42 * (m13 * m34 - m33 * m14)) + m31 * (m12 * (m23 * m44 - m43 * m24) - m22 * (m13 * m44 - m43 * m14) + m42 * (m13 * m24 - m23 * m14)) - m41 * (m12 * (m23 * m34 - m33 * m24) - m22 * (m13 * m34 - m33 * m14) + m32 * (m13 * m24 - m23 * m14)); 1.41983 + return d; 1.41984 + } 1.41985 + } 1.41986 + } 1.41987 + }, 1.41988 + script: { 1.41989 + instance: Glue.ALL 1.41990 + } 1.41991 + } 1.41992 + }; 1.41993 + }.call(this); 1.41994 +var PointDefinition = function () { 1.41995 + return { 1.41996 + __class__: 'flash.geom.Point', 1.41997 + __glue__: { 1.41998 + script: { 1.41999 + static: Glue.ALL, 1.42000 + instance: Glue.ALL 1.42001 + } 1.42002 + } 1.42003 + }; 1.42004 + }.call(this); 1.42005 +var RectangleDefinition = function () { 1.42006 + return { 1.42007 + __class__: 'flash.geom.Rectangle', 1.42008 + __glue__: { 1.42009 + script: { 1.42010 + instance: Glue.ALL 1.42011 + } 1.42012 + } 1.42013 + }; 1.42014 + }.call(this); 1.42015 +var TransformDefinition = function () { 1.42016 + var def = { 1.42017 + __class__: 'flash.geom.Transform', 1.42018 + get colorTransform() { 1.42019 + var cxform = this._target._cxform; 1.42020 + if (cxform) { 1.42021 + return new flash.geom.ColorTransform(cxform.redMultiplier / 256, cxform.greenMultiplier / 256, cxform.blueMultiplier / 256, cxform.alphaMultiplier / 256, cxform.redOffset, cxform.greenOffset, cxform.blueOffset, cxform.alphaOffset); 1.42022 + } else { 1.42023 + return new flash.geom.ColorTransform(); 1.42024 + } 1.42025 + }, 1.42026 + set colorTransform(val) { 1.42027 + var CTClass = avm2.systemDomain.getClass('flash.geom.ColorTransform'); 1.42028 + if (!CTClass.isInstanceOf(val)) { 1.42029 + throwError('TypeError', Errors.CheckTypeFailedError, val, 'flash.geom.ColorTransform'); 1.42030 + } 1.42031 + this._target._cxform = { 1.42032 + redMultiplier: val.redMultiplier * 256, 1.42033 + greenMultiplier: val.greenMultiplier * 256, 1.42034 + blueMultiplier: val.blueMultiplier * 256, 1.42035 + alphaMultiplier: val.alphaMultiplier * 256, 1.42036 + redOffset: val.redOffset, 1.42037 + greenOffset: val.greenOffset, 1.42038 + blueOffset: val.blueOffset, 1.42039 + alphaOffset: val.alphaOffset 1.42040 + }; 1.42041 + this._target._invalidate(); 1.42042 + }, 1.42043 + get concatenatedColorTransform() { 1.42044 + var cxform = this.colorTransform; 1.42045 + cxform.concat(this._target.parent.transform.concatenatedColorTransform); 1.42046 + return cxform; 1.42047 + }, 1.42048 + get concatenatedMatrix() { 1.42049 + if (this._target._current3DTransform) { 1.42050 + return null; 1.42051 + } 1.42052 + var m = this._target._getConcatenatedTransform(null, false); 1.42053 + return new flash.geom.Matrix(m.a, m.b, m.c, m.d, m.tx / 20, m.ty / 20); 1.42054 + }, 1.42055 + get matrix() { 1.42056 + if (this._target._current3DTransform) { 1.42057 + return null; 1.42058 + } 1.42059 + var m = this._target._currentTransform; 1.42060 + return new flash.geom.Matrix(m.a, m.b, m.c, m.d, m.tx / 20, m.ty / 20); 1.42061 + }, 1.42062 + set matrix(val) { 1.42063 + if (!flash.geom.Matrix.class.isInstanceOf(val)) { 1.42064 + throwError('TypeError', Errors.CheckTypeFailedError, val, 'flash.geom.Matrix'); 1.42065 + } 1.42066 + var target = this._target; 1.42067 + target._invalidate(); 1.42068 + target._setTransformMatrix(val, true); 1.42069 + target._current3DTransform = null; 1.42070 + target._animated = false; 1.42071 + }, 1.42072 + get matrix3D() { 1.42073 + var m = this._target._current3DTransform; 1.42074 + return m && m.clone(); 1.42075 + }, 1.42076 + set matrix3D(val) { 1.42077 + var Matrix3DClass = avm2.systemDomain.getClass('flash.geom.Matrix3D'); 1.42078 + if (!Matrix3DClass.isInstanceOf(val)) { 1.42079 + throwError('TypeError', Errors.CheckTypeFailedError, val, 'flash.geom.Matrix3D'); 1.42080 + } 1.42081 + var raw = val.rawData; 1.42082 + this.matrix = new flash.geom.Matrix(raw.asGetPublicProperty(0), raw.asGetPublicProperty(1), raw.asGetPublicProperty(4), raw.asGetPublicProperty(5), raw.asGetPublicProperty(12), raw.asGetPublicProperty(13)); 1.42083 + this._target._current3DTransform = val; 1.42084 + }, 1.42085 + ctor: function (target) { 1.42086 + this._target = target; 1.42087 + } 1.42088 + }; 1.42089 + var desc = Object.getOwnPropertyDescriptor; 1.42090 + def.__glue__ = { 1.42091 + native: { 1.42092 + instance: { 1.42093 + colorTransform: desc(def, 'colorTransform'), 1.42094 + concatenatedColorTransform: desc(def, 'concatenatedColorTransform'), 1.42095 + concatenatedMatrix: desc(def, 'concatenatedMatrix'), 1.42096 + matrix: desc(def, 'matrix'), 1.42097 + matrix3D: desc(def, 'matrix3D'), 1.42098 + ctor: def.ctor 1.42099 + } 1.42100 + } 1.42101 + }; 1.42102 + return def; 1.42103 + }.call(this); 1.42104 +var Vector3DDefinition = function () { 1.42105 + return { 1.42106 + __class__: 'flash.geom.Vector3D', 1.42107 + initialize: function () { 1.42108 + }, 1.42109 + __glue__: { 1.42110 + script: { 1.42111 + instance: Glue.ALL 1.42112 + } 1.42113 + } 1.42114 + }; 1.42115 + }.call(this); 1.42116 +{ 1.42117 + var ID3InfoDefinition = function () { 1.42118 + return { 1.42119 + __glue__: { 1.42120 + script: { 1.42121 + instance: { 1.42122 + songName: 'public songName', 1.42123 + genre: 'public genre', 1.42124 + artist: 'public artist', 1.42125 + track: 'public track', 1.42126 + album: 'public album', 1.42127 + year: 'public year', 1.42128 + comment: 'public comment' 1.42129 + } 1.42130 + } 1.42131 + } 1.42132 + }; 1.42133 + }.call(this); 1.42134 +} 1.42135 +var MicrophoneDefinition = function () { 1.42136 + return { 1.42137 + __class__: 'flash.media.Microphone', 1.42138 + initialize: function () { 1.42139 + }, 1.42140 + __glue__: { 1.42141 + native: { 1.42142 + static: { 1.42143 + getMicrophone: function getMicrophone(index) { 1.42144 + notImplemented('Microphone.getMicrophone'); 1.42145 + }, 1.42146 + getEnhancedMicrophone: function getEnhancedMicrophone(index) { 1.42147 + notImplemented('Microphone.getEnhancedMicrophone'); 1.42148 + }, 1.42149 + names: { 1.42150 + get: function names() { 1.42151 + notImplemented('Microphone.names'); 1.42152 + } 1.42153 + }, 1.42154 + isSupported: { 1.42155 + get: function isSupported() { 1.42156 + notImplemented('Microphone.isSupported'); 1.42157 + } 1.42158 + } 1.42159 + }, 1.42160 + instance: { 1.42161 + setSilenceLevel: function setSilenceLevel(silenceLevel, timeout) { 1.42162 + notImplemented('Microphone.setSilenceLevel'); 1.42163 + }, 1.42164 + setUseEchoSuppression: function setUseEchoSuppression(useEchoSuppression) { 1.42165 + notImplemented('Microphone.setUseEchoSuppression'); 1.42166 + }, 1.42167 + setLoopBack: function setLoopBack(state) { 1.42168 + notImplemented('Microphone.setLoopBack'); 1.42169 + }, 1.42170 + gain: { 1.42171 + set: function gain(gain) { 1.42172 + notImplemented('Microphone.gain'); 1.42173 + this._gain = gain; 1.42174 + }, 1.42175 + get: function gain() { 1.42176 + notImplemented('Microphone.gain'); 1.42177 + return this._gain; 1.42178 + } 1.42179 + }, 1.42180 + rate: { 1.42181 + set: function rate(rate) { 1.42182 + notImplemented('Microphone.rate'); 1.42183 + this._rate = rate; 1.42184 + }, 1.42185 + get: function rate() { 1.42186 + notImplemented('Microphone.rate'); 1.42187 + return this._rate; 1.42188 + } 1.42189 + }, 1.42190 + codec: { 1.42191 + set: function codec(codec) { 1.42192 + notImplemented('Microphone.codec'); 1.42193 + this._codec = codec; 1.42194 + }, 1.42195 + get: function codec() { 1.42196 + notImplemented('Microphone.codec'); 1.42197 + return this._codec; 1.42198 + } 1.42199 + }, 1.42200 + framesPerPacket: { 1.42201 + get: function framesPerPacket() { 1.42202 + notImplemented('Microphone.framesPerPacket'); 1.42203 + return this._framesPerPacket; 1.42204 + }, 1.42205 + set: function framesPerPacket(frames) { 1.42206 + notImplemented('Microphone.framesPerPacket'); 1.42207 + this._framesPerPacket = frames; 1.42208 + } 1.42209 + }, 1.42210 + encodeQuality: { 1.42211 + get: function encodeQuality() { 1.42212 + notImplemented('Microphone.encodeQuality'); 1.42213 + return this._encodeQuality; 1.42214 + }, 1.42215 + set: function encodeQuality(quality) { 1.42216 + notImplemented('Microphone.encodeQuality'); 1.42217 + this._encodeQuality = quality; 1.42218 + } 1.42219 + }, 1.42220 + noiseSuppressionLevel: { 1.42221 + get: function noiseSuppressionLevel() { 1.42222 + notImplemented('Microphone.noiseSuppressionLevel'); 1.42223 + return this._noiseSuppressionLevel; 1.42224 + }, 1.42225 + set: function noiseSuppressionLevel(level) { 1.42226 + notImplemented('Microphone.noiseSuppressionLevel'); 1.42227 + this._noiseSuppressionLevel = level; 1.42228 + } 1.42229 + }, 1.42230 + enableVAD: { 1.42231 + get: function enableVAD() { 1.42232 + notImplemented('Microphone.enableVAD'); 1.42233 + return this._enableVAD; 1.42234 + }, 1.42235 + set: function enableVAD(enable) { 1.42236 + notImplemented('Microphone.enableVAD'); 1.42237 + this._enableVAD = enable; 1.42238 + } 1.42239 + }, 1.42240 + activityLevel: { 1.42241 + get: function activityLevel() { 1.42242 + notImplemented('Microphone.activityLevel'); 1.42243 + return this._activityLevel; 1.42244 + } 1.42245 + }, 1.42246 + index: { 1.42247 + get: function index() { 1.42248 + notImplemented('Microphone.index'); 1.42249 + return this._index; 1.42250 + } 1.42251 + }, 1.42252 + muted: { 1.42253 + get: function muted() { 1.42254 + notImplemented('Microphone.muted'); 1.42255 + return this._muted; 1.42256 + } 1.42257 + }, 1.42258 + name: { 1.42259 + get: function name() { 1.42260 + notImplemented('Microphone.name'); 1.42261 + return this._name; 1.42262 + } 1.42263 + }, 1.42264 + silenceLevel: { 1.42265 + get: function silenceLevel() { 1.42266 + notImplemented('Microphone.silenceLevel'); 1.42267 + return this._silenceLevel; 1.42268 + } 1.42269 + }, 1.42270 + silenceTimeout: { 1.42271 + get: function silenceTimeout() { 1.42272 + notImplemented('Microphone.silenceTimeout'); 1.42273 + return this._silenceTimeout; 1.42274 + } 1.42275 + }, 1.42276 + useEchoSuppression: { 1.42277 + get: function useEchoSuppression() { 1.42278 + notImplemented('Microphone.useEchoSuppression'); 1.42279 + return this._useEchoSuppression; 1.42280 + } 1.42281 + }, 1.42282 + soundTransform: { 1.42283 + get: function soundTransform() { 1.42284 + notImplemented('Microphone.soundTransform'); 1.42285 + return this._soundTransform; 1.42286 + }, 1.42287 + set: function soundTransform(sndTransform) { 1.42288 + notImplemented('Microphone.soundTransform'); 1.42289 + this._soundTransform = sndTransform; 1.42290 + } 1.42291 + }, 1.42292 + enhancedOptions: { 1.42293 + get: function enhancedOptions() { 1.42294 + notImplemented('Microphone.enhancedOptions'); 1.42295 + return this._enhancedOptions; 1.42296 + }, 1.42297 + set: function enhancedOptions(options) { 1.42298 + notImplemented('Microphone.enhancedOptions'); 1.42299 + this._enhancedOptions = options; 1.42300 + } 1.42301 + } 1.42302 + } 1.42303 + }, 1.42304 + script: { 1.42305 + instance: Glue.ALL 1.42306 + } 1.42307 + } 1.42308 + }; 1.42309 + }.call(this); 1.42310 +var PLAY_USING_AUDIO_TAG = true; 1.42311 +var SoundDefinition = function () { 1.42312 + function getAudioDescription(soundData, onComplete) { 1.42313 + var audioElement = document.createElement('audio'); 1.42314 + if (!audioElement.canPlayType(soundData.mimeType)) { 1.42315 + onComplete({ 1.42316 + duration: 0 1.42317 + }); 1.42318 + return; 1.42319 + } 1.42320 + audioElement.preload = 'metadata'; 1.42321 + var blob = new Blob([ 1.42322 + soundData.data 1.42323 + ], { 1.42324 + type: soundData.mimeType 1.42325 + }); 1.42326 + audioElement.src = URL.createObjectURL(blob); 1.42327 + audioElement.load(); 1.42328 + audioElement.addEventListener('loadedmetadata', function () { 1.42329 + onComplete({ 1.42330 + duration: this.duration * 1000 1.42331 + }); 1.42332 + }); 1.42333 + } 1.42334 + var def = { 1.42335 + initialize: function initialize() { 1.42336 + this._playQueue = []; 1.42337 + this._url = null; 1.42338 + this._length = 0; 1.42339 + this._bytesTotal = 0; 1.42340 + this._bytesLoaded = 0; 1.42341 + this._id3 = new flash.media.ID3Info(); 1.42342 + var s = this.symbol; 1.42343 + if (s) { 1.42344 + var soundData = {}; 1.42345 + if (s.pcm) { 1.42346 + soundData.sampleRate = s.sampleRate; 1.42347 + soundData.channels = s.channels; 1.42348 + soundData.pcm = s.pcm; 1.42349 + soundData.end = s.pcm.length; 1.42350 + } 1.42351 + soundData.completed = true; 1.42352 + if (s.packaged) { 1.42353 + soundData.data = s.packaged.data.buffer; 1.42354 + soundData.mimeType = s.packaged.mimeType; 1.42355 + } 1.42356 + var _this = this; 1.42357 + getAudioDescription(soundData, function (description) { 1.42358 + _this._length = description.duration; 1.42359 + }); 1.42360 + this._soundData = soundData; 1.42361 + } 1.42362 + TelemetryService.reportTelemetry({ 1.42363 + topic: 'feature', 1.42364 + feature: SOUND_FEATURE 1.42365 + }); 1.42366 + }, 1.42367 + close: function close() { 1.42368 + somewhatImplemented('Sound.close'); 1.42369 + }, 1.42370 + extract: function extract(target, length, startPosition) { 1.42371 + notImplemented('Sound.extract'); 1.42372 + }, 1.42373 + _load: function _load(request, checkPolicyFile, bufferTime) { 1.42374 + if (!request) { 1.42375 + return; 1.42376 + } 1.42377 + var _this = this; 1.42378 + var stream = this._stream = new flash.net.URLStream(); 1.42379 + var ByteArrayClass = avm2.systemDomain.getClass('flash.utils.ByteArray'); 1.42380 + var data = ByteArrayClass.createInstance(); 1.42381 + var dataPosition = 0; 1.42382 + var mp3DecodingSession = null; 1.42383 + var soundData = { 1.42384 + completed: false 1.42385 + }; 1.42386 + stream._addEventListener('progress', function (event) { 1.42387 + _this._bytesLoaded = event[Multiname.getPublicQualifiedName('bytesLoaded')]; 1.42388 + _this._bytesTotal = event[Multiname.getPublicQualifiedName('bytesTotal')]; 1.42389 + if (!PLAY_USING_AUDIO_TAG && !mp3DecodingSession) { 1.42390 + mp3DecodingSession = decodeMP3(soundData, function (duration, final) { 1.42391 + if (_this._length === 0) { 1.42392 + _this._soundData = soundData; 1.42393 + _this._playQueue.forEach(function (item) { 1.42394 + item.channel._playSoundDataViaChannel(soundData, item.startTime); 1.42395 + }); 1.42396 + } 1.42397 + _this._length = final ? duration * 1000 : Math.max(duration, mp3DecodingSession.estimateDuration(_this._bytesTotal)) * 1000; 1.42398 + }); 1.42399 + } 1.42400 + var bytesAvailable = stream.bytesAvailable; 1.42401 + stream.readBytes(data, dataPosition, bytesAvailable); 1.42402 + if (mp3DecodingSession) { 1.42403 + mp3DecodingSession.pushData(new Uint8Array(data.a, dataPosition, bytesAvailable)); 1.42404 + } 1.42405 + dataPosition += bytesAvailable; 1.42406 + _this._dispatchEvent(event); 1.42407 + }); 1.42408 + stream._addEventListener('complete', function (event) { 1.42409 + _this._dispatchEvent(event); 1.42410 + soundData.data = data.a; 1.42411 + soundData.mimeType = 'audio/mpeg'; 1.42412 + soundData.completed = true; 1.42413 + if (PLAY_USING_AUDIO_TAG) { 1.42414 + _this._soundData = soundData; 1.42415 + getAudioDescription(soundData, function (description) { 1.42416 + _this._length = description.duration; 1.42417 + }); 1.42418 + _this._playQueue.forEach(function (item) { 1.42419 + item.channel._playSoundDataViaAudio(soundData, item.startTime); 1.42420 + }); 1.42421 + } 1.42422 + if (mp3DecodingSession) { 1.42423 + mp3DecodingSession.close(); 1.42424 + } 1.42425 + }); 1.42426 + stream.load(request); 1.42427 + }, 1.42428 + loadCompressedDataFromByteArray: function loadCompressedDataFromByteArray(bytes, bytesLength) { 1.42429 + notImplemented('Sound#loadCompressedDataFromByteArray'); 1.42430 + }, 1.42431 + loadPCMFromByteArray: function loadPCMFromByteArray(bytes, samples, format, stereo, sampleRate) { 1.42432 + notImplemented('Sound#loadPCMFromByteArray'); 1.42433 + }, 1.42434 + play: function play(startTime, loops, soundTransform) { 1.42435 + startTime = startTime || 0; 1.42436 + loops = loops || 0; 1.42437 + var channel = new flash.media.SoundChannel(); 1.42438 + channel._sound = this; 1.42439 + channel._soundTransform = isNullOrUndefined(soundTransform) ? new flash.media.SoundTransform() : soundTransform; 1.42440 + this._playQueue.push({ 1.42441 + channel: channel, 1.42442 + startTime: startTime 1.42443 + }); 1.42444 + if (this._soundData) { 1.42445 + if (PLAY_USING_AUDIO_TAG) 1.42446 + channel._playSoundDataViaAudio(this._soundData, startTime, loops); 1.42447 + else 1.42448 + channel._playSoundDataViaChannel(this._soundData, startTime, loops); 1.42449 + } 1.42450 + return channel; 1.42451 + }, 1.42452 + get bytesLoaded() { 1.42453 + return this._bytesLoaded; 1.42454 + }, 1.42455 + get bytesTotal() { 1.42456 + return this._bytesTotal; 1.42457 + }, 1.42458 + get id3() { 1.42459 + return this._id3; 1.42460 + }, 1.42461 + get isBuffering() { 1.42462 + notImplemented('Sound#isBuffering'); 1.42463 + }, 1.42464 + get isURLInaccessible() { 1.42465 + notImplemented('Sound#isURLInaccessible'); 1.42466 + }, 1.42467 + get length() { 1.42468 + return this._length; 1.42469 + }, 1.42470 + get url() { 1.42471 + return this._url; 1.42472 + } 1.42473 + }; 1.42474 + function decodeMP3(soundData, ondurationchanged) { 1.42475 + var currentSize = 8000; 1.42476 + var pcm = new Float32Array(currentSize); 1.42477 + var position = 0; 1.42478 + var lastTimeRatio = 0; 1.42479 + var durationEstimationData = { 1.42480 + estimateBitRate: true, 1.42481 + bitRateSum: 0, 1.42482 + bitRateCount: 0, 1.42483 + metadataSize: 0, 1.42484 + averageBitRate: 0 1.42485 + }; 1.42486 + var mp3DecoderSession = new MP3DecoderSession(); 1.42487 + mp3DecoderSession.onframedata = function (frame, channels, sampleRate, bitRate) { 1.42488 + if (durationEstimationData.estimateBitRate) { 1.42489 + var FramesToEstimate = 200; 1.42490 + if (durationEstimationData.bitRateCount < FramesToEstimate) { 1.42491 + durationEstimationData.bitRateSum += bitRate; 1.42492 + durationEstimationData.bitRateCount++; 1.42493 + } else { 1.42494 + durationEstimationData.estimateBitRate = false; 1.42495 + } 1.42496 + this.averageBitRate = durationEstimationData.bitRateSum / durationEstimationData.bitRateCount; 1.42497 + } 1.42498 + if (frame.length === 0) 1.42499 + return; 1.42500 + if (!position) { 1.42501 + soundData.sampleRate = sampleRate, soundData.channels = channels; 1.42502 + soundData.pcm = pcm; 1.42503 + } 1.42504 + if (position + frame.length >= currentSize) { 1.42505 + do { 1.42506 + currentSize *= 2; 1.42507 + } while (position + frame.length >= currentSize); 1.42508 + var newPcm = new Float32Array(currentSize); 1.42509 + newPcm.set(pcm); 1.42510 + pcm = soundData.pcm = newPcm; 1.42511 + } 1.42512 + pcm.set(frame, position); 1.42513 + soundData.end = position += frame.length; 1.42514 + lastTimeRatio = 1 / soundData.sampleRate / soundData.channels; 1.42515 + ondurationchanged(position * lastTimeRatio, false); 1.42516 + }; 1.42517 + mp3DecoderSession.onid3tag = function (data) { 1.42518 + durationEstimationData.metadataSize += data.length; 1.42519 + }, mp3DecoderSession.onclosed = function () { 1.42520 + ondurationchanged(position * lastTimeRatio, true); 1.42521 + }; 1.42522 + var completed = false; 1.42523 + return { 1.42524 + pushData: function (data) { 1.42525 + mp3DecoderSession.pushAsync(data); 1.42526 + }, 1.42527 + estimateDuration: function (fileSize) { 1.42528 + return Math.max(0, (fileSize - durationEstimationData.metadataSize) * 8 / durationEstimationData.averageBitRate); 1.42529 + }, 1.42530 + close: function () { 1.42531 + mp3DecoderSession.close(); 1.42532 + } 1.42533 + }; 1.42534 + } 1.42535 + var desc = Object.getOwnPropertyDescriptor; 1.42536 + def.__glue__ = { 1.42537 + native: { 1.42538 + instance: { 1.42539 + close: def.close, 1.42540 + extract: def.extract, 1.42541 + _load: def._load, 1.42542 + loadCompressedDataFromByteArray: def.loadCompressedDataFromByteArray, 1.42543 + loadPCMFromByteArray: def.loadPCMFromByteArray, 1.42544 + play: def.play, 1.42545 + bytesLoaded: desc(def, 'bytesLoaded'), 1.42546 + bytesTotal: desc(def, 'bytesTotal'), 1.42547 + id3: desc(def, 'id3'), 1.42548 + isBuffering: desc(def, 'isBuffering'), 1.42549 + isURLInaccessible: desc(def, 'isURLInaccessible'), 1.42550 + length: desc(def, 'length'), 1.42551 + url: desc(def, 'url') 1.42552 + } 1.42553 + } 1.42554 + }; 1.42555 + return def; 1.42556 + }.call(this); 1.42557 +var SoundChannelDefinition = function () { 1.42558 + return { 1.42559 + initialize: function () { 1.42560 + this._element = null; 1.42561 + this._position = 0; 1.42562 + this._leftPeak = 0; 1.42563 + this._rightPeak = 0; 1.42564 + this._pcmData = null; 1.42565 + this._soundTransform = new flash.media.SoundTransform(); 1.42566 + this._soundMixerClass = avm2.systemDomain.getClass('flash.media.SoundMixer'); 1.42567 + var s = this.symbol; 1.42568 + if (s) { 1.42569 + this._element = s.element || null; 1.42570 + } 1.42571 + if (this._element) { 1.42572 + this._registerWithSoundMixer(); 1.42573 + } 1.42574 + }, 1.42575 + _registerWithSoundMixer: function () { 1.42576 + this._soundMixerClass.native.static._registerChannel(this); 1.42577 + }, 1.42578 + _unregisterWithSoundMixer: function () { 1.42579 + this._soundMixerClass.native.static._unregisterChannel(this); 1.42580 + }, 1.42581 + _applySoundTransform: function () { 1.42582 + var volume = this._soundTransform._volume; 1.42583 + if (this._soundMixerClass._soundTransform) { 1.42584 + volume *= this._soundMixerClass._soundTransform._volume; 1.42585 + } 1.42586 + volume *= this._soundMixerClass.native.static._getMasterVolume(); 1.42587 + if (this._element) { 1.42588 + this._element.volume = clamp(volume, 0, 1); 1.42589 + } 1.42590 + if (this._audioChannel) { 1.42591 + } 1.42592 + }, 1.42593 + _playSoundDataViaChannel: function (soundData, startTime, loops) { 1.42594 + this._registerWithSoundMixer(); 1.42595 + var self = this; 1.42596 + var startPosition = Math.round(startTime / 1000 * soundData.sampleRate) * soundData.channels; 1.42597 + var position = startPosition; 1.42598 + this._position = startTime; 1.42599 + this._audioChannel = createAudioChannel(soundData.sampleRate, soundData.channels); 1.42600 + this._audioChannel.ondatarequested = function (e) { 1.42601 + var end = soundData.end; 1.42602 + if (position >= end && soundData.completed) { 1.42603 + self._unregisterWithSoundMixer(); 1.42604 + self._audioChannel.stop(); 1.42605 + self._dispatchEvent(new flash.events.Event('soundComplete', false, false)); 1.42606 + return; 1.42607 + } 1.42608 + var left = e.count; 1.42609 + var data = e.data; 1.42610 + var source = soundData.pcm; 1.42611 + do { 1.42612 + var count = Math.min(end - position, left); 1.42613 + for (var j = 0; j < count; j++) { 1.42614 + data[j] = source[position++]; 1.42615 + } 1.42616 + left -= count; 1.42617 + if (position >= end) { 1.42618 + if (!loops) 1.42619 + break; 1.42620 + loops--; 1.42621 + position = startPosition; 1.42622 + } 1.42623 + } while (left > 0); 1.42624 + self._position = position / soundData.sampleRate / soundData.channels * 1000; 1.42625 + }; 1.42626 + this._audioChannel.start(); 1.42627 + this._applySoundTransform(); 1.42628 + }, 1.42629 + _playSoundDataViaAudio: function (soundData, startTime, loops) { 1.42630 + if (!soundData.mimeType) 1.42631 + return; 1.42632 + this._registerWithSoundMixer(); 1.42633 + this._position = startTime; 1.42634 + var self = this; 1.42635 + var lastCurrentTime = 0; 1.42636 + var element = document.createElement('audio'); 1.42637 + if (!element.canPlayType(soundData.mimeType)) { 1.42638 + console.error('ERROR: "' + soundData.mimeType + '" ' + 'type playback is not supported by the browser'); 1.42639 + return; 1.42640 + } 1.42641 + element.preload = 'metadata'; 1.42642 + element.loop = loops > 0; 1.42643 + var blob = new Blob([ 1.42644 + soundData.data 1.42645 + ], { 1.42646 + type: soundData.mimeType 1.42647 + }); 1.42648 + element.src = URL.createObjectURL(blob); 1.42649 + element.addEventListener('loadeddata', function loaded() { 1.42650 + element.currentTime = startTime / 1000; 1.42651 + element.play(); 1.42652 + }); 1.42653 + element.addEventListener('timeupdate', function timeupdate() { 1.42654 + var currentTime = element.currentTime; 1.42655 + if (loops && lastCurrentTime > currentTime) { 1.42656 + --loops; 1.42657 + if (!loops) 1.42658 + element.loop = false; 1.42659 + if (currentTime < startTime / 1000) 1.42660 + element.currentTime = startTime / 1000; 1.42661 + } 1.42662 + self._position = (lastCurrentTime = currentTime) * 1000; 1.42663 + }); 1.42664 + element.addEventListener('ended', function ended() { 1.42665 + self._unregisterWithSoundMixer(); 1.42666 + self._dispatchEvent(new flash.events.Event('soundComplete', false, false)); 1.42667 + self._element = null; 1.42668 + }); 1.42669 + this._element = element; 1.42670 + this._applySoundTransform(); 1.42671 + }, 1.42672 + __glue__: { 1.42673 + native: { 1.42674 + static: {}, 1.42675 + instance: { 1.42676 + stop: function stop() { 1.42677 + if (this._element) { 1.42678 + this._unregisterWithSoundMixer(); 1.42679 + this._element.pause(); 1.42680 + } 1.42681 + if (this._audioChannel) { 1.42682 + this._unregisterWithSoundMixer(); 1.42683 + this._audioChannel.stop(); 1.42684 + } 1.42685 + }, 1.42686 + 'position': { 1.42687 + get: function position() { 1.42688 + return this._position; 1.42689 + } 1.42690 + }, 1.42691 + 'leftPeak': { 1.42692 + get: function leftPeak() { 1.42693 + return this._leftPeak; 1.42694 + } 1.42695 + }, 1.42696 + 'rightPeak': { 1.42697 + get: function rightPeak() { 1.42698 + return this.rightPeak; 1.42699 + } 1.42700 + }, 1.42701 + 'soundTransform': { 1.42702 + get: function soundTransform() { 1.42703 + somewhatImplemented('SoundChannel.soundTransform'); 1.42704 + return new flash.media.SoundTransform(this._soundTransform._volume, this._soundTransform.pan); 1.42705 + }, 1.42706 + set: function soundTransform(soundTransform) { 1.42707 + somewhatImplemented('SoundChannel.soundTransform'); 1.42708 + this._soundTransform = isNullOrUndefined(soundTransform) ? new flash.media.SoundTransform() : soundTransform; 1.42709 + this._applySoundTransform(); 1.42710 + } 1.42711 + } 1.42712 + } 1.42713 + }, 1.42714 + script: { 1.42715 + instance: scriptProperties('public', [ 1.42716 + 'stop' 1.42717 + ]) 1.42718 + } 1.42719 + } 1.42720 + }; 1.42721 + }.call(this); 1.42722 +function createAudioChannel(sampleRate, channels) { 1.42723 + if (WebAudioChannel.isSupported) 1.42724 + return new WebAudioChannel(sampleRate, channels); 1.42725 + else 1.42726 + error('PCM data playback is not supported by the browser'); 1.42727 +} 1.42728 +function AudioResampler(sourceRate, targetRate) { 1.42729 + this.sourceRate = sourceRate; 1.42730 + this.targetRate = targetRate; 1.42731 + this.tail = []; 1.42732 + this.sourceOffset = 0; 1.42733 +} 1.42734 +AudioResampler.prototype = { 1.42735 + ondatarequested: function (e) { 1.42736 + }, 1.42737 + getData: function (channelsData, count) { 1.42738 + var k = this.sourceRate / this.targetRate; 1.42739 + var offset = this.sourceOffset; 1.42740 + var needed = Math.ceil((count - 1) * k + offset) + 1; 1.42741 + var sourceData = []; 1.42742 + for (var channel = 0; channel < channelsData.length; channel++) 1.42743 + sourceData.push(new Float32Array(needed)); 1.42744 + var e = { 1.42745 + data: sourceData, 1.42746 + count: needed 1.42747 + }; 1.42748 + this.ondatarequested(e); 1.42749 + for (var channel = 0; channel < channelsData.length; channel++) { 1.42750 + var data = channelsData[channel]; 1.42751 + var source = sourceData[channel]; 1.42752 + for (var j = 0; j < count; j++) { 1.42753 + var i = j * k + offset; 1.42754 + var i1 = i | 0, i2 = Math.ceil(i) | 0; 1.42755 + var source_i1 = i1 < 0 ? this.tail[channel] : source[i1]; 1.42756 + if (i1 === i2) { 1.42757 + data[j] = source_i1; 1.42758 + } else { 1.42759 + var alpha = i - i1; 1.42760 + data[j] = source_i1 * (1 - alpha) + source[i2] * alpha; 1.42761 + } 1.42762 + } 1.42763 + this.tail[channel] = source[needed - 1]; 1.42764 + } 1.42765 + this.sourceOffset = (count - 1) * k + offset - (needed - 1); 1.42766 + } 1.42767 +}; 1.42768 +function WebAudioChannel(sampleRate, channels) { 1.42769 + var context = WebAudioChannel.context; 1.42770 + if (!context) { 1.42771 + if (typeof AudioContext !== 'undefined') 1.42772 + context = new AudioContext(); 1.42773 + else 1.42774 + context = new webkitAudioContext(); 1.42775 + WebAudioChannel.context = context; 1.42776 + } 1.42777 + this.context = context; 1.42778 + this.contextSampleRate = context.sampleRate || 44100; 1.42779 + this.channels = channels; 1.42780 + this.sampleRate = sampleRate; 1.42781 + if (this.contextSampleRate != sampleRate) { 1.42782 + this.resampler = new AudioResampler(sampleRate, this.contextSampleRate); 1.42783 + this.resampler.ondatarequested = function (e) { 1.42784 + this.requestData(e.data, e.count); 1.42785 + }.bind(this); 1.42786 + } 1.42787 +} 1.42788 +WebAudioChannel.prototype = { 1.42789 + start: function () { 1.42790 + var source = this.context.createScriptProcessor ? this.context.createScriptProcessor(2048, 0, this.channels) : this.context.createJavaScriptNode(2048, 0, this.channels); 1.42791 + var self = this; 1.42792 + source.onaudioprocess = function (e) { 1.42793 + var channelsData = []; 1.42794 + for (var i = 0; i < self.channels; i++) 1.42795 + channelsData.push(e.outputBuffer.getChannelData(i)); 1.42796 + var count = channelsData[0].length; 1.42797 + if (self.resampler) { 1.42798 + self.resampler.getData(channelsData, count); 1.42799 + } else { 1.42800 + var e = { 1.42801 + data: channelsData, 1.42802 + count: count 1.42803 + }; 1.42804 + self.requestData(channelsData, count); 1.42805 + } 1.42806 + }; 1.42807 + source.connect(this.context.destination); 1.42808 + this.source = source; 1.42809 + }, 1.42810 + stop: function () { 1.42811 + this.source.disconnect(this.context.destination); 1.42812 + }, 1.42813 + requestData: function (channelsData, count) { 1.42814 + var channels = this.channels; 1.42815 + var buffer = new Float32Array(count * channels); 1.42816 + var e = { 1.42817 + data: buffer, 1.42818 + count: buffer.length 1.42819 + }; 1.42820 + this.ondatarequested(e); 1.42821 + for (var j = 0, p = 0; j < count; j++) { 1.42822 + for (var i = 0; i < channels; i++) 1.42823 + channelsData[i][j] = buffer[p++]; 1.42824 + } 1.42825 + } 1.42826 +}; 1.42827 +WebAudioChannel.isSupported = function () { 1.42828 + return typeof AudioContext !== 'undefined' || typeof webkitAudioContext != 'undefined'; 1.42829 +}(); 1.42830 +var SoundMixerDefinition = function () { 1.42831 + var masterVolume = 1; 1.42832 + var registeredChannels = []; 1.42833 + return { 1.42834 + __class__: 'flash.media.SoundMixer', 1.42835 + initialize: function () { 1.42836 + }, 1.42837 + __glue__: { 1.42838 + native: { 1.42839 + static: { 1.42840 + _registerChannel: function _registerChannel(channel) { 1.42841 + registeredChannels.push(channel); 1.42842 + }, 1.42843 + _unregisterChannel: function _unregisterChannel(channel) { 1.42844 + var index = registeredChannels.indexOf(channel); 1.42845 + if (index >= 0) 1.42846 + registeredChannels.splice(index, 1); 1.42847 + }, 1.42848 + _getMasterVolume: function _getMasterVolume() { 1.42849 + return masterVolume; 1.42850 + }, 1.42851 + _setMasterVolume: function _setMasterVolume(volume) { 1.42852 + masterVolume = volume; 1.42853 + registeredChannels.forEach(function (channel) { 1.42854 + channel._applySoundTransform(); 1.42855 + }); 1.42856 + }, 1.42857 + stopAll: function stopAll() { 1.42858 + registeredChannels.forEach(function (channel) { 1.42859 + channel.stop(); 1.42860 + }); 1.42861 + registeredChannels = []; 1.42862 + }, 1.42863 + computeSpectrum: function computeSpectrum(outputArray, FFTMode, stretchFactor) { 1.42864 + somewhatImplemented('SoundMixer.computeSpectrum'); 1.42865 + var data = new Float32Array(1024); 1.42866 + for (var i = 0; i < 1024; i++) { 1.42867 + data[i] = Math.random(); 1.42868 + } 1.42869 + outputArray.writeRawBytes(data); 1.42870 + outputArray.position = 0; 1.42871 + }, 1.42872 + areSoundsInaccessible: function areSoundsInaccessible() { 1.42873 + notImplemented('SoundMixer.areSoundsInaccessible'); 1.42874 + }, 1.42875 + bufferTime: { 1.42876 + get: function bufferTime() { 1.42877 + notImplemented('SoundMixer.bufferTime'); 1.42878 + }, 1.42879 + set: function bufferTime(pA) { 1.42880 + notImplemented('SoundMixer.bufferTime'); 1.42881 + } 1.42882 + }, 1.42883 + soundTransform: { 1.42884 + get: function soundTransform() { 1.42885 + somewhatImplemented('SoundMixer.soundTransform'); 1.42886 + return isNullOrUndefined(this._soundTransform) ? new flash.media.SoundTransform() : new flash.media.SoundTransform(this._soundTransform._volume, this._soundTransform.pan); 1.42887 + }, 1.42888 + set: function soundTransform(soundTransform) { 1.42889 + somewhatImplemented('SoundMixer.soundTransform'); 1.42890 + this._soundTransform = isNullOrUndefined(soundTransform) ? new flash.media.SoundTransform() : soundTransform; 1.42891 + registeredChannels.forEach(function (channel) { 1.42892 + channel._applySoundTransform(); 1.42893 + }); 1.42894 + } 1.42895 + }, 1.42896 + audioPlaybackMode: { 1.42897 + get: function audioPlaybackMode() { 1.42898 + notImplemented('SoundMixer.audioPlaybackMode'); 1.42899 + }, 1.42900 + set: function audioPlaybackMode(pA) { 1.42901 + notImplemented('SoundMixer.audioPlaybackMode'); 1.42902 + } 1.42903 + }, 1.42904 + useSpeakerphoneForVoice: { 1.42905 + get: function useSpeakerphoneForVoice() { 1.42906 + notImplemented('SoundMixer.useSpeakerphoneForVoice'); 1.42907 + }, 1.42908 + set: function useSpeakerphoneForVoice(pA) { 1.42909 + notImplemented('SoundMixer.useSpeakerphoneForVoice'); 1.42910 + } 1.42911 + } 1.42912 + }, 1.42913 + instance: {} 1.42914 + } 1.42915 + } 1.42916 + }; 1.42917 + }.call(this); 1.42918 +var SoundTransformDefinition = function () { 1.42919 + return { 1.42920 + __class__: 'flash.media.SoundTransform', 1.42921 + initialize: function () { 1.42922 + }, 1.42923 + _updateTransform: function () { 1.42924 + somewhatImplemented('SoundTransform._updateTransform'); 1.42925 + }, 1.42926 + __glue__: { 1.42927 + native: { 1.42928 + static: {}, 1.42929 + instance: { 1.42930 + volume: { 1.42931 + get: function volume() { 1.42932 + return this._volume; 1.42933 + }, 1.42934 + set: function volume(volume) { 1.42935 + this._volume = volume; 1.42936 + this._updateTransform(); 1.42937 + } 1.42938 + }, 1.42939 + leftToLeft: { 1.42940 + get: function leftToLeft() { 1.42941 + return this._leftToLeft; 1.42942 + }, 1.42943 + set: function leftToLeft(leftToLeft) { 1.42944 + this._leftToLeft = leftToLeft; 1.42945 + this._updateTransform(); 1.42946 + } 1.42947 + }, 1.42948 + leftToRight: { 1.42949 + get: function leftToRight() { 1.42950 + return this._leftToRight; 1.42951 + }, 1.42952 + set: function leftToRight(leftToRight) { 1.42953 + this._leftToRight = leftToRight; 1.42954 + this._updateTransform(); 1.42955 + } 1.42956 + }, 1.42957 + rightToRight: { 1.42958 + get: function rightToRight() { 1.42959 + return this._rightToRight; 1.42960 + }, 1.42961 + set: function rightToRight(rightToRight) { 1.42962 + this._rightToRight = rightToRight; 1.42963 + this._updateTransform(); 1.42964 + } 1.42965 + }, 1.42966 + rightToLeft: { 1.42967 + get: function rightToLeft() { 1.42968 + return this._rightToLeft; 1.42969 + }, 1.42970 + set: function rightToLeft(rightToLeft) { 1.42971 + this._rightToLeft = rightToLeft; 1.42972 + this._updateTransform(); 1.42973 + } 1.42974 + } 1.42975 + } 1.42976 + }, 1.42977 + script: { 1.42978 + instance: { 1.42979 + pan: 'public pan' 1.42980 + } 1.42981 + } 1.42982 + } 1.42983 + }; 1.42984 + }.call(this); 1.42985 +var StageVideoDefinition = function () { 1.42986 + return { 1.42987 + __class__: 'flash.media.StageVideo', 1.42988 + initialize: function () { 1.42989 + }, 1.42990 + __glue__: { 1.42991 + native: { 1.42992 + static: {}, 1.42993 + instance: { 1.42994 + attachNetStream: function attachNetStream(netStream) { 1.42995 + notImplemented('StageVideo.attachNetStream'); 1.42996 + }, 1.42997 + attachCamera: function attachCamera(theCamera) { 1.42998 + notImplemented('StageVideo.attachCamera'); 1.42999 + }, 1.43000 + viewPort: { 1.43001 + get: function viewPort() { 1.43002 + notImplemented('StageVideo.viewPort'); 1.43003 + return this._viewPort; 1.43004 + }, 1.43005 + set: function viewPort(rect) { 1.43006 + notImplemented('StageVideo.viewPort'); 1.43007 + this._viewPort = rect; 1.43008 + } 1.43009 + }, 1.43010 + pan: { 1.43011 + set: function pan(point) { 1.43012 + notImplemented('StageVideo.pan'); 1.43013 + this._pan = point; 1.43014 + }, 1.43015 + get: function pan() { 1.43016 + notImplemented('StageVideo.pan'); 1.43017 + return this._pan; 1.43018 + } 1.43019 + }, 1.43020 + zoom: { 1.43021 + set: function zoom(point) { 1.43022 + notImplemented('StageVideo.zoom'); 1.43023 + this._zoom = point; 1.43024 + }, 1.43025 + get: function zoom() { 1.43026 + notImplemented('StageVideo.zoom'); 1.43027 + return this._zoom; 1.43028 + } 1.43029 + }, 1.43030 + depth: { 1.43031 + set: function depth(depth) { 1.43032 + notImplemented('StageVideo.depth'); 1.43033 + this._depth = depth; 1.43034 + }, 1.43035 + get: function depth() { 1.43036 + notImplemented('StageVideo.depth'); 1.43037 + return this._depth; 1.43038 + } 1.43039 + }, 1.43040 + videoWidth: { 1.43041 + get: function videoWidth() { 1.43042 + notImplemented('StageVideo.videoWidth'); 1.43043 + return this._videoWidth; 1.43044 + } 1.43045 + }, 1.43046 + videoHeight: { 1.43047 + get: function videoHeight() { 1.43048 + notImplemented('StageVideo.videoHeight'); 1.43049 + return this._videoHeight; 1.43050 + } 1.43051 + }, 1.43052 + colorSpaces: { 1.43053 + get: function colorSpaces() { 1.43054 + notImplemented('StageVideo.colorSpaces'); 1.43055 + return this._colorSpaces; 1.43056 + } 1.43057 + } 1.43058 + } 1.43059 + } 1.43060 + } 1.43061 + }; 1.43062 + }.call(this); 1.43063 +var VideoDefinition = function () { 1.43064 + function burnHole(ctx, x, y, width, height) { 1.43065 + ctx.save(); 1.43066 + ctx.beginPath(); 1.43067 + ctx.rect(0, 0, width, height); 1.43068 + ctx.clip(); 1.43069 + ctx.clearRect(0, 0, width, height); 1.43070 + ctx.restore(); 1.43071 + } 1.43072 + var def = { 1.43073 + initialize: function initialize() { 1.43074 + TelemetryService.reportTelemetry({ 1.43075 + topic: 'feature', 1.43076 + feature: VIDEO_FEATURE 1.43077 + }); 1.43078 + }, 1.43079 + attachNetStream: function (netStream) { 1.43080 + if (this._netStream === netStream) { 1.43081 + return; 1.43082 + } 1.43083 + if (this._netStream) { 1.43084 + this._netStream._videoReady.then(function (element) { 1.43085 + this._element = null; 1.43086 + if (this._added) { 1.43087 + element.remove(); 1.43088 + this._added = false; 1.43089 + } 1.43090 + }.bind(this)); 1.43091 + } 1.43092 + this._netStream = netStream; 1.43093 + if (!netStream) { 1.43094 + return; 1.43095 + } 1.43096 + netStream._videoReady.then(function (element) { 1.43097 + this._element = element; 1.43098 + netStream._videoMetadataReady.then(function (url) { 1.43099 + this._element.width = this._videoWidth = this._element.videoWidth; 1.43100 + this._element.height = this._videoHeight = this._element.videoHeight; 1.43101 + if (this.stage) { 1.43102 + this.stage._invalid = true; 1.43103 + } 1.43104 + }.bind(this)); 1.43105 + }.bind(this)); 1.43106 + }, 1.43107 + ctor: function (width, height) { 1.43108 + if (!width || width < 0) 1.43109 + width = 320; 1.43110 + if (!height || height < 0) 1.43111 + height = 240; 1.43112 + this._bbox = { 1.43113 + xMin: 0, 1.43114 + yMin: 0, 1.43115 + xMax: width * 20, 1.43116 + yMax: height * 20 1.43117 + }; 1.43118 + this._initialWidth = this._videoWidth = width; 1.43119 + this._initialHeight = this._videoHeight = height; 1.43120 + this._netStream = null; 1.43121 + this._element = null; 1.43122 + this._added = false; 1.43123 + }, 1.43124 + draw: function (ctx, ratio, ct, parentCtxs) { 1.43125 + if (!this._element) { 1.43126 + return; 1.43127 + } 1.43128 + if (!this._added && this._stage) { 1.43129 + this._stage._domContainer.appendChild(this._element); 1.43130 + this._added = true; 1.43131 + } 1.43132 + var width = this._initialWidth; 1.43133 + var height = this._initialHeight; 1.43134 + var matrix = this._getConcatenatedTransform(null, true); 1.43135 + var scaleFactor = this.stage && this.stage._contentsScaleFactor || 1; 1.43136 + var a = matrix.a / scaleFactor; 1.43137 + var b = matrix.b / scaleFactor; 1.43138 + var c = matrix.c / scaleFactor; 1.43139 + var d = matrix.d / scaleFactor; 1.43140 + var e = matrix.tx / 20 / scaleFactor; 1.43141 + var f = matrix.ty / 20 / scaleFactor; 1.43142 + if (width > 0 && height > 0) { 1.43143 + burnHole(ctx, 0, 0, width, height); 1.43144 + parentCtxs.forEach(function (ctx) { 1.43145 + ctx.save(); 1.43146 + ctx.setTransform(a, b, c, d, e, f); 1.43147 + burnHole(ctx, 0, 0, width, height); 1.43148 + ctx.restore(); 1.43149 + }); 1.43150 + } 1.43151 + var sx = width / this._videoWidth; 1.43152 + var sy = height / this._videoHeight; 1.43153 + var cssTransform = 'transform: matrix(' + sx * a + ',' + sx * b + ',' + sy * c + ',' + sy * d + ',' + e + ',' + f + ');'; 1.43154 + if (this._currentCssTransform !== cssTransform) { 1.43155 + this._currentCssTransform = cssTransform; 1.43156 + this._element.setAttribute('style', 'position: absolute; top:0; left:0; z-index: -100;transform-origin: 0px 0px 0;' + cssTransform + '-webkit-transform-origin: 0px 0px 0; -webkit-' + cssTransform); 1.43157 + } 1.43158 + } 1.43159 + }; 1.43160 + def.__glue__ = { 1.43161 + native: { 1.43162 + instance: { 1.43163 + attachNetStream: def.attachNetStream, 1.43164 + ctor: def.ctor, 1.43165 + smoothing: { 1.43166 + get: function smoothing() { 1.43167 + return this._smoothing; 1.43168 + }, 1.43169 + set: function smoothing(value) { 1.43170 + somewhatImplemented('Video.smoothing'); 1.43171 + this._smoothing = value; 1.43172 + } 1.43173 + }, 1.43174 + videoHeight: { 1.43175 + get: function videoHeight() { 1.43176 + return this._videoHeight; 1.43177 + } 1.43178 + }, 1.43179 + videoWidth: { 1.43180 + get: function videoWidth() { 1.43181 + return this._videoWidth; 1.43182 + } 1.43183 + } 1.43184 + } 1.43185 + } 1.43186 + }; 1.43187 + return def; 1.43188 + }.call(this); 1.43189 +{ 1.43190 + var FileFilterDefinition = function () { 1.43191 + return { 1.43192 + __class__: 'flash.net.FileFilter', 1.43193 + initialize: function () { 1.43194 + this._description = null; 1.43195 + this._extension = null; 1.43196 + this._macType = null; 1.43197 + }, 1.43198 + __glue__: { 1.43199 + native: { 1.43200 + static: {}, 1.43201 + instance: { 1.43202 + description: { 1.43203 + get: function description() { 1.43204 + return this._description; 1.43205 + }, 1.43206 + set: function description(value) { 1.43207 + this._description = value; 1.43208 + } 1.43209 + }, 1.43210 + extension: { 1.43211 + get: function extension() { 1.43212 + return this._extension; 1.43213 + }, 1.43214 + set: function extension(value) { 1.43215 + this._extension = value; 1.43216 + } 1.43217 + }, 1.43218 + macType: { 1.43219 + get: function macType() { 1.43220 + return this._macType; 1.43221 + }, 1.43222 + set: function macType(value) { 1.43223 + this._macType = value; 1.43224 + } 1.43225 + } 1.43226 + } 1.43227 + } 1.43228 + } 1.43229 + }; 1.43230 + }.call(this); 1.43231 +} 1.43232 +var LocalConnectionDefinition = function () { 1.43233 + return { 1.43234 + __class__: 'flash.net.LocalConnection', 1.43235 + initialize: function () { 1.43236 + }, 1.43237 + __glue__: { 1.43238 + native: { 1.43239 + static: {}, 1.43240 + instance: { 1.43241 + close: function close() { 1.43242 + notImplemented('LocalConnection.close'); 1.43243 + }, 1.43244 + connect: function connect(connectionName) { 1.43245 + notImplemented('LocalConnection.connect'); 1.43246 + }, 1.43247 + send: function send(connectionName, methodName) { 1.43248 + notImplemented('LocalConnection.send'); 1.43249 + }, 1.43250 + allowDomain: function allowDomain() { 1.43251 + notImplemented('LocalConnection.allowDomain'); 1.43252 + }, 1.43253 + allowInsecureDomain: function allowInsecureDomain() { 1.43254 + notImplemented('LocalConnection.allowInsecureDomain'); 1.43255 + }, 1.43256 + domain: { 1.43257 + get: function domain() { 1.43258 + somewhatImplemented('LocalConnection.domain'); 1.43259 + var url = FileLoadingService.resolveUrl('/'); 1.43260 + var m = /:\/\/(.+?)[:?#\/]/.exec(url); 1.43261 + return m && m[1]; 1.43262 + } 1.43263 + }, 1.43264 + client: { 1.43265 + get: function client() { 1.43266 + notImplemented('LocalConnection.client'); 1.43267 + return this._client; 1.43268 + }, 1.43269 + set: function client(client) { 1.43270 + notImplemented('LocalConnection.client'); 1.43271 + this._client = client; 1.43272 + } 1.43273 + }, 1.43274 + isPerUser: { 1.43275 + get: function isPerUser() { 1.43276 + notImplemented('LocalConnection.isPerUser'); 1.43277 + return this._isPerUser; 1.43278 + }, 1.43279 + set: function isPerUser(newValue) { 1.43280 + notImplemented('LocalConnection.isPerUser'); 1.43281 + this._isPerUser = newValue; 1.43282 + } 1.43283 + } 1.43284 + } 1.43285 + } 1.43286 + } 1.43287 + }; 1.43288 + }.call(this); 1.43289 +var NetConnectionDefinition = function () { 1.43290 + var defaultObjectEncoding = 3; 1.43291 + return { 1.43292 + __class__: 'flash.net.NetConnection', 1.43293 + initialize: function () { 1.43294 + TelemetryService.reportTelemetry({ 1.43295 + topic: 'feature', 1.43296 + feature: NETCONNECTION_FEATURE 1.43297 + }); 1.43298 + }, 1.43299 + _invoke: function (index, args) { 1.43300 + var simulated = false, result; 1.43301 + switch (index) { 1.43302 + case 2: 1.43303 + simulated = true; 1.43304 + break; 1.43305 + } 1.43306 + (simulated ? somewhatImplemented : notImplemented)('NetConnection._invoke (' + index + ')'); 1.43307 + return result; 1.43308 + }, 1.43309 + __glue__: { 1.43310 + native: { 1.43311 + static: { 1.43312 + defaultObjectEncoding: { 1.43313 + get: function defaultObjectEncoding() { 1.43314 + return defaultObjectEncoding; 1.43315 + }, 1.43316 + set: function defaultObjectEncoding(version) { 1.43317 + somewhatImplemented('NetConnection.defaultObjectEncoding'); 1.43318 + return defaultObjectEncoding; 1.43319 + } 1.43320 + } 1.43321 + }, 1.43322 + instance: { 1.43323 + ctor: function ctor() { 1.43324 + this._uri = null; 1.43325 + this._connected = false; 1.43326 + this._client = null; 1.43327 + this._proxyType = 'none'; 1.43328 + this._objectEncoding = defaultObjectEncoding; 1.43329 + }, 1.43330 + connect: function connect(command) { 1.43331 + var NetStatusEvent = flash.events.NetStatusEvent; 1.43332 + somewhatImplemented('NetConnection.connect'); 1.43333 + this._uri = command; 1.43334 + if (!command) { 1.43335 + this._connected = true; 1.43336 + this._dispatchEvent(new NetStatusEvent(NetStatusEvent.class.NET_STATUS, false, false, wrapJSObject({ 1.43337 + level: 'status', 1.43338 + code: 'NetConnection.Connect.Success' 1.43339 + }))); 1.43340 + } else { 1.43341 + this._dispatchEvent(new NetStatusEvent(NetStatusEvent.class.NET_STATUS, false, false, wrapJSObject({ 1.43342 + level: 'status', 1.43343 + code: 'NetConnection.Connect.Failed' 1.43344 + }))); 1.43345 + } 1.43346 + }, 1.43347 + call: function call(command, responder) { 1.43348 + notImplemented('NetConnection.call'); 1.43349 + }, 1.43350 + connected: { 1.43351 + get: function connected() { 1.43352 + return this._connected; 1.43353 + } 1.43354 + }, 1.43355 + uri: { 1.43356 + get: function uri() { 1.43357 + return this._uri; 1.43358 + } 1.43359 + }, 1.43360 + client: { 1.43361 + get: function client() { 1.43362 + return this._client; 1.43363 + }, 1.43364 + set: function client(object) { 1.43365 + this._client = object; 1.43366 + } 1.43367 + }, 1.43368 + objectEncoding: { 1.43369 + get: function objectEncoding() { 1.43370 + return this._objectEncoding; 1.43371 + }, 1.43372 + set: function objectEncoding(version) { 1.43373 + somewhatImplemented('NetConnection.objectEncoding'); 1.43374 + this._objectEncoding = version; 1.43375 + } 1.43376 + }, 1.43377 + proxyType: { 1.43378 + get: function proxyType() { 1.43379 + return this._proxyType; 1.43380 + }, 1.43381 + set: function proxyType(ptype) { 1.43382 + notImplemented('NetConnection.proxyType'); 1.43383 + this._proxyType = ptype; 1.43384 + } 1.43385 + }, 1.43386 + connectedProxyType: { 1.43387 + get: function connectedProxyType() { 1.43388 + notImplemented('NetConnection.connectedProxyType'); 1.43389 + return this._connectedProxyType; 1.43390 + } 1.43391 + }, 1.43392 + usingTLS: { 1.43393 + get: function usingTLS() { 1.43394 + somewhatImplemented('NetConnection.usingTLS'); 1.43395 + return false; 1.43396 + } 1.43397 + }, 1.43398 + protocol: { 1.43399 + get: function protocol() { 1.43400 + notImplemented('NetConnection.protocol'); 1.43401 + return this._protocol; 1.43402 + } 1.43403 + }, 1.43404 + maxPeerConnections: { 1.43405 + get: function maxPeerConnections() { 1.43406 + notImplemented('NetConnection.maxPeerConnections'); 1.43407 + return this._maxPeerConnections; 1.43408 + }, 1.43409 + set: function maxPeerConnections(maxPeers) { 1.43410 + notImplemented('NetConnection.maxPeerConnections'); 1.43411 + this._maxPeerConnections = maxPeers; 1.43412 + } 1.43413 + }, 1.43414 + nearID: { 1.43415 + get: function nearID() { 1.43416 + notImplemented('NetConnection.nearID'); 1.43417 + return this._nearID; 1.43418 + } 1.43419 + }, 1.43420 + farID: { 1.43421 + get: function farID() { 1.43422 + notImplemented('NetConnection.farID'); 1.43423 + return this._farID; 1.43424 + } 1.43425 + }, 1.43426 + nearNonce: { 1.43427 + get: function nearNonce() { 1.43428 + notImplemented('NetConnection.nearNonce'); 1.43429 + return this._nearNonce; 1.43430 + } 1.43431 + }, 1.43432 + farNonce: { 1.43433 + get: function farNonce() { 1.43434 + notImplemented('NetConnection.farNonce'); 1.43435 + return this._farNonce; 1.43436 + } 1.43437 + }, 1.43438 + unconnectedPeerStreams: { 1.43439 + get: function unconnectedPeerStreams() { 1.43440 + notImplemented('NetConnection.unconnectedPeerStreams'); 1.43441 + return this._unconnectedPeerStreams; 1.43442 + } 1.43443 + }, 1.43444 + invoke: function invokeWithArgsArray(index) { 1.43445 + return this._invoke(index, Array.prototype.slice.call(arguments, 1)); 1.43446 + }, 1.43447 + invokeWithArgsArray: function invokeWithArgsArray(index, p_arguments) { 1.43448 + return this._invoke.call(this, index, p_arguments); 1.43449 + } 1.43450 + } 1.43451 + } 1.43452 + } 1.43453 + }; 1.43454 + }.call(this); 1.43455 +var USE_MEDIASOURCE_API = false; 1.43456 +var NetStreamDefinition = function () { 1.43457 + return { 1.43458 + __class__: 'flash.net.NetStream', 1.43459 + initialize: function () { 1.43460 + }, 1.43461 + _invoke: function (index, args) { 1.43462 + var simulated = false, result; 1.43463 + var videoElement = this._videoElement; 1.43464 + switch (index) { 1.43465 + case 4: 1.43466 + this._videoState.bufferTime = args[0]; 1.43467 + simulated = true; 1.43468 + break; 1.43469 + case 202: 1.43470 + switch (args[1]) { 1.43471 + case 'pause': 1.43472 + simulated = true; 1.43473 + if (videoElement) { 1.43474 + if (args[3] !== false && !videoElement.paused) { 1.43475 + videoElement.pause(); 1.43476 + } else if (args[3] !== true && videoElement.paused) { 1.43477 + videoElement.play(); 1.43478 + } 1.43479 + videoElement.currentTime = args[4] / 1000; 1.43480 + } 1.43481 + break; 1.43482 + case 'seek': 1.43483 + simulated = true; 1.43484 + if (videoElement && !videoElement.paused) { 1.43485 + videoElement.currentTime = args[3] / 1000; 1.43486 + } 1.43487 + break; 1.43488 + } 1.43489 + break; 1.43490 + case 300: 1.43491 + result = videoElement ? videoElement.currentTime : 0; 1.43492 + simulated = true; 1.43493 + break; 1.43494 + case 302: 1.43495 + result = this._videoState.bufferTime; 1.43496 + simulated = true; 1.43497 + break; 1.43498 + case 303: 1.43499 + result = videoElement ? videoElement.duration : 0; 1.43500 + simulated = true; 1.43501 + break; 1.43502 + case 305: 1.43503 + result = this._videoState.buffer === 'full' ? 100 : this._videoState.buffer === 'progress' ? 50 : 0; 1.43504 + simulated = true; 1.43505 + break; 1.43506 + case 306: 1.43507 + result = 100; 1.43508 + simulated = true; 1.43509 + break; 1.43510 + } 1.43511 + (simulated ? somewhatImplemented : notImplemented)('NetStream._invoke (' + index + ')'); 1.43512 + return result; 1.43513 + }, 1.43514 + _createVideoElement: function (url) { 1.43515 + function notifyPlayStart(e) { 1.43516 + if (netStream._videoState.started) { 1.43517 + return; 1.43518 + } 1.43519 + netStream._videoState.started = true; 1.43520 + netStream._dispatchEvent(new NetStatusEvent(NetStatusEvent.class.NET_STATUS, false, false, wrapJSObject({ 1.43521 + code: 'NetStream.Play.Start', 1.43522 + level: 'status' 1.43523 + }))); 1.43524 + } 1.43525 + function notifyPlayStop(e) { 1.43526 + netStream._videoState.started = false; 1.43527 + netStream._dispatchEvent(new NetStatusEvent(NetStatusEvent.class.NET_STATUS, false, false, wrapJSObject({ 1.43528 + code: 'NetStream.Play.Stop', 1.43529 + level: 'status' 1.43530 + }))); 1.43531 + } 1.43532 + function notifyBufferFull(e) { 1.43533 + netStream._videoState.buffer = 'full'; 1.43534 + netStream._dispatchEvent(new NetStatusEvent(NetStatusEvent.class.NET_STATUS, false, false, wrapJSObject({ 1.43535 + code: 'NetStream.Buffer.Full', 1.43536 + level: 'status' 1.43537 + }))); 1.43538 + } 1.43539 + function notifyProgress(e) { 1.43540 + netStream._videoState.buffer = 'progress'; 1.43541 + } 1.43542 + function notifyBufferEmpty(e) { 1.43543 + netStream._videoState.buffer = 'empty'; 1.43544 + netStream._dispatchEvent(new NetStatusEvent(NetStatusEvent.class.NET_STATUS, false, false, wrapJSObject({ 1.43545 + code: 'NetStream.Buffer.Empty', 1.43546 + level: 'status' 1.43547 + }))); 1.43548 + } 1.43549 + function notifyError(e) { 1.43550 + var code = e.target.error.code === 4 ? 'NetStream.Play.NoSupportedTrackFound' : e.target.error.code === 3 ? 'NetStream.Play.FileStructureInvalid' : 'NetStream.Play.StreamNotFound'; 1.43551 + netStream._dispatchEvent(new NetStatusEvent(NetStatusEvent.class.NET_STATUS, false, false, wrapJSObject({ 1.43552 + code: code, 1.43553 + level: 'error' 1.43554 + }))); 1.43555 + } 1.43556 + function notifyMetadata(e) { 1.43557 + netStream._videoMetadataReady.resolve({ 1.43558 + videoWidth: element.videoWidth, 1.43559 + videoHeight: element.videoHeight 1.43560 + }); 1.43561 + if (netStream._client) { 1.43562 + var data = {}; 1.43563 + data.asSetPublicProperty('width', element.videoWidth); 1.43564 + data.asSetPublicProperty('height', element.videoHeight); 1.43565 + data.asSetPublicProperty('duration', element.duration); 1.43566 + netStream._client.asCallPublicProperty('onMetaData', [ 1.43567 + data 1.43568 + ]); 1.43569 + } 1.43570 + } 1.43571 + var NetStatusEvent = flash.events.NetStatusEvent; 1.43572 + var netStream = this; 1.43573 + if (/\.mp4$/i.test(url) && /Intel Mac OS X.*?Firefox\/\d+/.test(window.navigator.userAgent)) { 1.43574 + url = 'http://videos-cdn.mozilla.net/brand/Mozilla_2011_Story.webm'; 1.43575 + } 1.43576 + var element = document.createElement('video'); 1.43577 + element.preload = 'metadata'; 1.43578 + element.src = url; 1.43579 + element.addEventListener('play', notifyPlayStart); 1.43580 + element.addEventListener('ended', notifyPlayStop); 1.43581 + element.addEventListener('loadeddata', notifyBufferFull); 1.43582 + element.addEventListener('progress', notifyProgress); 1.43583 + element.addEventListener('waiting', notifyBufferEmpty); 1.43584 + element.addEventListener('loadedmetadata', notifyMetadata); 1.43585 + element.addEventListener('error', notifyError); 1.43586 + element.play(); 1.43587 + this._videoElement = element; 1.43588 + this._videoReady.resolve(element); 1.43589 + }, 1.43590 + __glue__: { 1.43591 + script: { 1.43592 + instance: scriptProperties('public', [ 1.43593 + 'appendBytes', 1.43594 + 'appendBytesAction' 1.43595 + ]) 1.43596 + }, 1.43597 + native: { 1.43598 + static: {}, 1.43599 + instance: { 1.43600 + ctor: function ctor(connection, peerID) { 1.43601 + somewhatImplemented('NetStream.ctor'); 1.43602 + this._contentTypeHint = null; 1.43603 + this._mediaSource = null; 1.43604 + this._checkPolicyFile = true; 1.43605 + this._videoElement = null; 1.43606 + var videoReadyResolve, videoReadyReject; 1.43607 + this._videoReady = new Promise(function (resolve, reject) { 1.43608 + videoReadyResolve = resolve; 1.43609 + videoReadyReject = reject; 1.43610 + }); 1.43611 + this._videoReady.resolve = videoReadyResolve; 1.43612 + this._videoReady.reject = videoReadyReject; 1.43613 + var videoMetadataReadyResolve, videoMetadataReadyReject; 1.43614 + this._videoMetadataReady = new Promise(function (resolve, reject) { 1.43615 + videoMetadataReadyResolve = resolve; 1.43616 + videoMetadataReadyReject = reject; 1.43617 + }); 1.43618 + this._videoMetadataReady.resolve = videoMetadataReadyResolve; 1.43619 + this._videoMetadataReady.reject = videoMetadataReadyReject; 1.43620 + this._videoState = { 1.43621 + started: false, 1.43622 + buffer: 'empty', 1.43623 + bufferTime: 0.1 1.43624 + }; 1.43625 + }, 1.43626 + onResult: function onResult(streamId) { 1.43627 + notImplemented('NetStream.onResult'); 1.43628 + }, 1.43629 + dispose: function dispose() { 1.43630 + notImplemented('NetStream.dispose'); 1.43631 + }, 1.43632 + play: function play(url) { 1.43633 + var isMediaSourceEnabled = USE_MEDIASOURCE_API; 1.43634 + if (isMediaSourceEnabled && typeof MediaSource === 'undefined') { 1.43635 + console.warn('MediaSource API is not enabled, falling back to regular playback'); 1.43636 + isMediaSourceEnabled = false; 1.43637 + } 1.43638 + if (!isMediaSourceEnabled) { 1.43639 + somewhatImplemented('NetStream.play'); 1.43640 + this._createVideoElement(FileLoadingService.resolveUrl(url)); 1.43641 + return; 1.43642 + } 1.43643 + var mediaSource = new MediaSource(); 1.43644 + mediaSource.addEventListener('sourceopen', function (e) { 1.43645 + this._mediaSource = mediaSource; 1.43646 + }.bind(this)); 1.43647 + mediaSource.addEventListener('sourceend', function (e) { 1.43648 + this._mediaSource = null; 1.43649 + }.bind(this)); 1.43650 + this._createVideoElement(window.URL.createObjectURL(mediaSource)); 1.43651 + if (!url) { 1.43652 + return; 1.43653 + } 1.43654 + var request = new flash.net.URLRequest(url); 1.43655 + request._checkPolicyFile = this._checkPolicyFile; 1.43656 + var stream = new flash.net.URLStream(); 1.43657 + stream._addEventListener('httpStatus', function (e) { 1.43658 + var responseHeaders = e.asGetPublicProperty('responseHeaders'); 1.43659 + var contentTypeHeader = responseHeaders.filter(function (h) { 1.43660 + return h.asGetPublicProperty('name') === 'Content-Type'; 1.43661 + })[0]; 1.43662 + if (contentTypeHeader && contentTypeHeader.asGetPublicProperty('value') !== 'application/octet-stream') { 1.43663 + this._contentTypeHint = contentTypeHeader.asGetPublicProperty('value'); 1.43664 + } 1.43665 + }.bind(this)); 1.43666 + stream._addEventListener('progress', function (e) { 1.43667 + var available = stream.bytesAvailable; 1.43668 + var ByteArrayClass = avm2.systemDomain.getClass('flash.utils.ByteArray'); 1.43669 + var data = ByteArrayClass.createInstance(); 1.43670 + stream.readBytes(data, 0, available); 1.43671 + this.appendBytes(data); 1.43672 + }.bind(this)); 1.43673 + stream._addEventListener('complete', function (e) { 1.43674 + this.appendBytesAction('endSequence'); 1.43675 + }.bind(this)); 1.43676 + stream.load(request); 1.43677 + }, 1.43678 + play2: function play2(param) { 1.43679 + notImplemented('NetStream.play2'); 1.43680 + }, 1.43681 + invoke: function invoke(index) { 1.43682 + return this._invoke(index, Array.prototype.slice.call(arguments, 1)); 1.43683 + }, 1.43684 + invokeWithArgsArray: function invokeWithArgsArray(index, p_arguments) { 1.43685 + return this._invoke.call(this, index, p_arguments); 1.43686 + }, 1.43687 + appendBytes: function appendBytes(bytes) { 1.43688 + if (this._mediaSource) { 1.43689 + if (!this._mediaSourceBuffer) { 1.43690 + this._mediaSourceBuffer = this._mediaSource.addSourceBuffer(this._contentTypeHint); 1.43691 + } 1.43692 + this._mediaSourceBuffer.appendBuffer(new Uint8Array(bytes.a, 0, bytes.length)); 1.43693 + } 1.43694 + somewhatImplemented('NetStream.appendBytes'); 1.43695 + }, 1.43696 + appendBytesAction: function appendBytesAction(netStreamAppendBytesAction) { 1.43697 + if (netStreamAppendBytesAction === 'endSequence' && this._mediaSource) { 1.43698 + this._mediaSource.endOfStream(); 1.43699 + } 1.43700 + somewhatImplemented('NetStream.appendBytesAction'); 1.43701 + }, 1.43702 + info: { 1.43703 + get: function info() { 1.43704 + notImplemented('NetStream.info'); 1.43705 + return this._info; 1.43706 + } 1.43707 + }, 1.43708 + multicastInfo: { 1.43709 + get: function multicastInfo() { 1.43710 + notImplemented('NetStream.multicastInfo'); 1.43711 + return this._multicastInfo; 1.43712 + } 1.43713 + }, 1.43714 + soundTransform: { 1.43715 + get: function soundTransform() { 1.43716 + return this._soundTransform; 1.43717 + }, 1.43718 + set: function soundTransform(sndTransform) { 1.43719 + somewhatImplemented('NetStream.soundTransform'); 1.43720 + this._soundTransform = sndTransform; 1.43721 + } 1.43722 + }, 1.43723 + checkPolicyFile: { 1.43724 + get: function checkPolicyFile() { 1.43725 + return this._checkPolicyFile; 1.43726 + }, 1.43727 + set: function checkPolicyFile(state) { 1.43728 + this._checkPolicyFile = state; 1.43729 + } 1.43730 + }, 1.43731 + client: { 1.43732 + get: function client() { 1.43733 + somewhatImplemented('NetStream.client'); 1.43734 + return this._client; 1.43735 + }, 1.43736 + set: function client(object) { 1.43737 + somewhatImplemented('NetStream.client'); 1.43738 + this._client = object; 1.43739 + } 1.43740 + }, 1.43741 + objectEncoding: { 1.43742 + get: function objectEncoding() { 1.43743 + notImplemented('NetStream.objectEncoding'); 1.43744 + return this._objectEncoding; 1.43745 + } 1.43746 + }, 1.43747 + multicastPushNeighborLimit: { 1.43748 + get: function multicastPushNeighborLimit() { 1.43749 + notImplemented('NetStream.multicastPushNeighborLimit'); 1.43750 + return this._multicastPushNeighborLimit; 1.43751 + }, 1.43752 + set: function multicastPushNeighborLimit(neighbors) { 1.43753 + notImplemented('NetStream.multicastPushNeighborLimit'); 1.43754 + this._multicastPushNeighborLimit = neighbors; 1.43755 + } 1.43756 + }, 1.43757 + multicastWindowDuration: { 1.43758 + get: function multicastWindowDuration() { 1.43759 + notImplemented('NetStream.multicastWindowDuration'); 1.43760 + return this._multicastWindowDuration; 1.43761 + }, 1.43762 + set: function multicastWindowDuration(seconds) { 1.43763 + notImplemented('NetStream.multicastWindowDuration'); 1.43764 + this._multicastWindowDuration = seconds; 1.43765 + } 1.43766 + }, 1.43767 + multicastRelayMarginDuration: { 1.43768 + get: function multicastRelayMarginDuration() { 1.43769 + notImplemented('NetStream.multicastRelayMarginDuration'); 1.43770 + return this._multicastRelayMarginDuration; 1.43771 + }, 1.43772 + set: function multicastRelayMarginDuration(seconds) { 1.43773 + notImplemented('NetStream.multicastRelayMarginDuration'); 1.43774 + this._multicastRelayMarginDuration = seconds; 1.43775 + } 1.43776 + }, 1.43777 + multicastAvailabilityUpdatePeriod: { 1.43778 + get: function multicastAvailabilityUpdatePeriod() { 1.43779 + notImplemented('NetStream.multicastAvailabilityUpdatePeriod'); 1.43780 + return this._multicastAvailabilityUpdatePeriod; 1.43781 + }, 1.43782 + set: function multicastAvailabilityUpdatePeriod(seconds) { 1.43783 + notImplemented('NetStream.multicastAvailabilityUpdatePeriod'); 1.43784 + this._multicastAvailabilityUpdatePeriod = seconds; 1.43785 + } 1.43786 + }, 1.43787 + multicastFetchPeriod: { 1.43788 + get: function multicastFetchPeriod() { 1.43789 + notImplemented('NetStream.multicastFetchPeriod'); 1.43790 + return this._multicastFetchPeriod; 1.43791 + }, 1.43792 + set: function multicastFetchPeriod(seconds) { 1.43793 + notImplemented('NetStream.multicastFetchPeriod'); 1.43794 + this._multicastFetchPeriod = seconds; 1.43795 + } 1.43796 + }, 1.43797 + multicastAvailabilitySendToAll: { 1.43798 + get: function multicastAvailabilitySendToAll() { 1.43799 + notImplemented('NetStream.multicastAvailabilitySendToAll'); 1.43800 + return this._multicastAvailabilitySendToAll; 1.43801 + }, 1.43802 + set: function multicastAvailabilitySendToAll(value) { 1.43803 + notImplemented('NetStream.multicastAvailabilitySendToAll'); 1.43804 + this._multicastAvailabilitySendToAll = value; 1.43805 + } 1.43806 + }, 1.43807 + farID: { 1.43808 + get: function farID() { 1.43809 + notImplemented('NetStream.farID'); 1.43810 + return this._farID; 1.43811 + } 1.43812 + }, 1.43813 + nearNonce: { 1.43814 + get: function nearNonce() { 1.43815 + notImplemented('NetStream.nearNonce'); 1.43816 + return this._nearNonce; 1.43817 + } 1.43818 + }, 1.43819 + farNonce: { 1.43820 + get: function farNonce() { 1.43821 + notImplemented('NetStream.farNonce'); 1.43822 + return this._farNonce; 1.43823 + } 1.43824 + }, 1.43825 + peerStreams: { 1.43826 + get: function peerStreams() { 1.43827 + notImplemented('NetStream.peerStreams'); 1.43828 + return this._peerStreams; 1.43829 + } 1.43830 + }, 1.43831 + audioReliable: { 1.43832 + get: function audioReliable() { 1.43833 + notImplemented('NetStream.audioReliable'); 1.43834 + return this._audioReliable; 1.43835 + }, 1.43836 + set: function audioReliable(reliable) { 1.43837 + notImplemented('NetStream.audioReliable'); 1.43838 + this._audioReliable = reliable; 1.43839 + } 1.43840 + }, 1.43841 + videoReliable: { 1.43842 + get: function videoReliable() { 1.43843 + notImplemented('NetStream.videoReliable'); 1.43844 + return this._videoReliable; 1.43845 + }, 1.43846 + set: function videoReliable(reliable) { 1.43847 + notImplemented('NetStream.videoReliable'); 1.43848 + this._videoReliable = reliable; 1.43849 + } 1.43850 + }, 1.43851 + dataReliable: { 1.43852 + get: function dataReliable() { 1.43853 + notImplemented('NetStream.dataReliable'); 1.43854 + return this._dataReliable; 1.43855 + }, 1.43856 + set: function dataReliable(reliable) { 1.43857 + notImplemented('NetStream.dataReliable'); 1.43858 + this._dataReliable = reliable; 1.43859 + } 1.43860 + }, 1.43861 + audioSampleAccess: { 1.43862 + get: function audioSampleAccess() { 1.43863 + notImplemented('NetStream.audioSampleAccess'); 1.43864 + return this._audioSampleAccess; 1.43865 + }, 1.43866 + set: function audioSampleAccess(reliable) { 1.43867 + notImplemented('NetStream.audioSampleAccess'); 1.43868 + this._audioSampleAccess = reliable; 1.43869 + } 1.43870 + }, 1.43871 + videoSampleAccess: { 1.43872 + get: function videoSampleAccess() { 1.43873 + notImplemented('NetStream.videoSampleAccess'); 1.43874 + return this._videoSampleAccess; 1.43875 + }, 1.43876 + set: function videoSampleAccess(reliable) { 1.43877 + notImplemented('NetStream.videoSampleAccess'); 1.43878 + this._videoSampleAccess = reliable; 1.43879 + } 1.43880 + }, 1.43881 + useHardwareDecoder: { 1.43882 + get: function useHardwareDecoder() { 1.43883 + notImplemented('NetStream.useHardwareDecoder'); 1.43884 + return this._useHardwareDecoder; 1.43885 + }, 1.43886 + set: function useHardwareDecoder(v) { 1.43887 + notImplemented('NetStream.useHardwareDecoder'); 1.43888 + this._useHardwareDecoder = v; 1.43889 + } 1.43890 + }, 1.43891 + useJitterBuffer: { 1.43892 + get: function useJitterBuffer() { 1.43893 + notImplemented('NetStream.useJitterBuffer'); 1.43894 + return this._useJitterBuffer; 1.43895 + }, 1.43896 + set: function useJitterBuffer(value) { 1.43897 + notImplemented('NetStream.useJitterBuffer'); 1.43898 + this._useJitterBuffer = value; 1.43899 + } 1.43900 + }, 1.43901 + videoStreamSettings: { 1.43902 + get: function videoStreamSettings() { 1.43903 + notImplemented('NetStream.videoStreamSettings'); 1.43904 + return this._videoStreamSettings; 1.43905 + }, 1.43906 + set: function videoStreamSettings(settings) { 1.43907 + notImplemented('NetStream.videoStreamSettings'); 1.43908 + this._videoStreamSettings = settings; 1.43909 + } 1.43910 + } 1.43911 + } 1.43912 + } 1.43913 + } 1.43914 + }; 1.43915 + }.call(this); 1.43916 +var ObjectEncodingDefinition = function () { 1.43917 + return { 1.43918 + __class__: 'flash.net.ObjectEncoding', 1.43919 + initialize: function () { 1.43920 + }, 1.43921 + __glue__: { 1.43922 + native: { 1.43923 + static: { 1.43924 + dynamicPropertyWriter: { 1.43925 + get: function dynamicPropertyWriter() { 1.43926 + notImplemented('ObjectEncoding.dynamicPropertyWriter'); 1.43927 + }, 1.43928 + set: function dynamicPropertyWriter(object) { 1.43929 + notImplemented('ObjectEncoding.dynamicPropertyWriter'); 1.43930 + } 1.43931 + } 1.43932 + }, 1.43933 + instance: {} 1.43934 + } 1.43935 + } 1.43936 + }; 1.43937 + }.call(this); 1.43938 +var ResponderDefinition = function () { 1.43939 + var def = { 1.43940 + ctor: function (result, status) { 1.43941 + } 1.43942 + }; 1.43943 + def.__glue__ = { 1.43944 + native: { 1.43945 + instance: { 1.43946 + ctor: def.ctor 1.43947 + } 1.43948 + } 1.43949 + }; 1.43950 + return def; 1.43951 + }.call(this); 1.43952 +var SharedObjectDefinition = function () { 1.43953 + var _defaultObjectEncoding = 3; 1.43954 + var sharedObjects = createEmptyObject(); 1.43955 + function invokeWithArgsArray(index, args) { 1.43956 + var simulated = false, result; 1.43957 + switch (index) { 1.43958 + case 4: 1.43959 + result = JSON.stringify(this._data).length - 2; 1.43960 + simulated = true; 1.43961 + break; 1.43962 + case 6: 1.43963 + this._data = {}; 1.43964 + sessionStorage.removeItem(this._path); 1.43965 + simulated = true; 1.43966 + break; 1.43967 + case 2: 1.43968 + sessionStorage.setItem(this._path, JSON.stringify(this._data)); 1.43969 + simulated = true; 1.43970 + result = true; 1.43971 + break; 1.43972 + case 3: 1.43973 + simulated = true; 1.43974 + break; 1.43975 + } 1.43976 + (simulated ? somewhatImplemented : notImplemented)('SharedObject.invoke (' + index + ')'); 1.43977 + return result; 1.43978 + } 1.43979 + return { 1.43980 + __class__: 'flash.net.SharedObject', 1.43981 + initialize: function () { 1.43982 + this._path = null; 1.43983 + this._data = null; 1.43984 + this._objectEncoding = _defaultObjectEncoding; 1.43985 + TelemetryService.reportTelemetry({ 1.43986 + topic: 'feature', 1.43987 + feature: SHAREDOBJECT_FEATURE 1.43988 + }); 1.43989 + }, 1.43990 + __glue__: { 1.43991 + native: { 1.43992 + static: { 1.43993 + deleteAll: function deleteAll(url) { 1.43994 + notImplemented('SharedObject.deleteAll'); 1.43995 + }, 1.43996 + getDiskUsage: function getDiskUsage(url) { 1.43997 + notImplemented('SharedObject.getDiskUsage'); 1.43998 + }, 1.43999 + getLocal: function getLocal(name, localPath, secure) { 1.44000 + var path = (localPath || '') + '/' + name; 1.44001 + if (sharedObjects[path]) { 1.44002 + return sharedObjects[path]; 1.44003 + } 1.44004 + var so = new flash.net.SharedObject(); 1.44005 + so._path = path; 1.44006 + var data = sessionStorage.getItem(path); 1.44007 + so._data = data ? JSON.parse(data) : {}; 1.44008 + return so; 1.44009 + }, 1.44010 + getRemote: function getRemote(name, remotePath, persistence, secure) { 1.44011 + notImplemented('SharedObject.getRemote'); 1.44012 + }, 1.44013 + defaultObjectEncoding: { 1.44014 + get: function defaultObjectEncoding() { 1.44015 + return _defaultObjectEncoding; 1.44016 + }, 1.44017 + set: function defaultObjectEncoding(version) { 1.44018 + _defaultObjectEncoding = version; 1.44019 + } 1.44020 + } 1.44021 + }, 1.44022 + instance: { 1.44023 + setDirty: function setDirty(propertyName) { 1.44024 + somewhatImplemented('SharedObject.setDirty'); 1.44025 + }, 1.44026 + invoke: function invoke(index) { 1.44027 + return invokeWithArgsArray.call(this, index, Array.prototype.slice.call(arguments, 1)); 1.44028 + }, 1.44029 + invokeWithArgsArray: function invokeWithArgsArray(index, args) { 1.44030 + return invokeWithArgsArray.call(this, index, args); 1.44031 + }, 1.44032 + data: { 1.44033 + get: function data() { 1.44034 + return this._data; 1.44035 + } 1.44036 + }, 1.44037 + objectEncoding: { 1.44038 + get: function objectEncoding() { 1.44039 + return this._objectEncoding; 1.44040 + }, 1.44041 + set: function objectEncoding(version) { 1.44042 + this._objectEncoding = version; 1.44043 + } 1.44044 + }, 1.44045 + client: { 1.44046 + get: function client() { 1.44047 + notImplemented('SharedObject.client'); 1.44048 + return this._client; 1.44049 + }, 1.44050 + set: function client(object) { 1.44051 + notImplemented('SharedObject.client'); 1.44052 + this._client = object; 1.44053 + } 1.44054 + } 1.44055 + } 1.44056 + } 1.44057 + } 1.44058 + }; 1.44059 + }.call(this); 1.44060 +var SocketDefinition = function () { 1.44061 + return { 1.44062 + __class__: 'flash.net.Socket', 1.44063 + initialize: function () { 1.44064 + this._connected = false; 1.44065 + }, 1.44066 + __glue__: { 1.44067 + native: { 1.44068 + static: {}, 1.44069 + instance: { 1.44070 + internalGetSecurityErrorMessage: function internalGetSecurityErrorMessage(host, port) { 1.44071 + somewhatImplemented('Socket.internalGetSecurityErrorMessage'); 1.44072 + return 'SecurityErrorEvent'; 1.44073 + }, 1.44074 + internalConnect: function internalConnect(host, port) { 1.44075 + somewhatImplemented('Socket.internalConnect'); 1.44076 + throwError('SecurityError', Errors.SocketConnectError, host, port); 1.44077 + }, 1.44078 + didFailureOccur: function didFailureOccur() { 1.44079 + somewhatImplemented('Socket.didFailureOccur'); 1.44080 + return true; 1.44081 + }, 1.44082 + readBytes: function readBytes(bytes, offset, length) { 1.44083 + notImplemented('Socket.readBytes'); 1.44084 + }, 1.44085 + writeBytes: function writeBytes(bytes, offset, length) { 1.44086 + notImplemented('Socket.writeBytes'); 1.44087 + }, 1.44088 + writeBoolean: function writeBoolean(value) { 1.44089 + notImplemented('Socket.writeBoolean'); 1.44090 + }, 1.44091 + writeByte: function writeByte(value) { 1.44092 + notImplemented('Socket.writeByte'); 1.44093 + }, 1.44094 + writeShort: function writeShort(value) { 1.44095 + notImplemented('Socket.writeShort'); 1.44096 + }, 1.44097 + writeInt: function writeInt(value) { 1.44098 + notImplemented('Socket.writeInt'); 1.44099 + }, 1.44100 + writeUnsignedInt: function writeUnsignedInt(value) { 1.44101 + notImplemented('Socket.writeUnsignedInt'); 1.44102 + }, 1.44103 + writeFloat: function writeFloat(value) { 1.44104 + notImplemented('Socket.writeFloat'); 1.44105 + }, 1.44106 + writeDouble: function writeDouble(value) { 1.44107 + notImplemented('Socket.writeDouble'); 1.44108 + }, 1.44109 + writeMultiByte: function writeMultiByte(value, charSet) { 1.44110 + notImplemented('Socket.writeMultiByte'); 1.44111 + }, 1.44112 + writeUTF: function writeUTF(value) { 1.44113 + notImplemented('Socket.writeUTF'); 1.44114 + }, 1.44115 + writeUTFBytes: function writeUTFBytes(value) { 1.44116 + notImplemented('Socket.writeUTFBytes'); 1.44117 + }, 1.44118 + readBoolean: function readBoolean() { 1.44119 + notImplemented('Socket.readBoolean'); 1.44120 + }, 1.44121 + readByte: function readByte() { 1.44122 + notImplemented('Socket.readByte'); 1.44123 + }, 1.44124 + readUnsignedByte: function readUnsignedByte() { 1.44125 + notImplemented('Socket.readUnsignedByte'); 1.44126 + }, 1.44127 + readShort: function readShort() { 1.44128 + notImplemented('Socket.readShort'); 1.44129 + }, 1.44130 + readUnsignedShort: function readUnsignedShort() { 1.44131 + notImplemented('Socket.readUnsignedShort'); 1.44132 + }, 1.44133 + readInt: function readInt() { 1.44134 + notImplemented('Socket.readInt'); 1.44135 + }, 1.44136 + readUnsignedInt: function readUnsignedInt() { 1.44137 + notImplemented('Socket.readUnsignedInt'); 1.44138 + }, 1.44139 + readFloat: function readFloat() { 1.44140 + notImplemented('Socket.readFloat'); 1.44141 + }, 1.44142 + readDouble: function readDouble() { 1.44143 + notImplemented('Socket.readDouble'); 1.44144 + }, 1.44145 + readMultiByte: function readMultiByte(length, charSet) { 1.44146 + notImplemented('Socket.readMultiByte'); 1.44147 + }, 1.44148 + readUTF: function readUTF() { 1.44149 + notImplemented('Socket.readUTF'); 1.44150 + }, 1.44151 + readUTFBytes: function readUTFBytes(length) { 1.44152 + notImplemented('Socket.readUTFBytes'); 1.44153 + }, 1.44154 + internalClose: function internalClose() { 1.44155 + notImplemented('Socket.internalClose'); 1.44156 + }, 1.44157 + flush: function flush() { 1.44158 + notImplemented('Socket.flush'); 1.44159 + }, 1.44160 + writeObject: function writeObject(object) { 1.44161 + notImplemented('Socket.writeObject'); 1.44162 + }, 1.44163 + readObject: function readObject() { 1.44164 + notImplemented('Socket.readObject'); 1.44165 + }, 1.44166 + bytesAvailable: { 1.44167 + get: function bytesAvailable() { 1.44168 + notImplemented('Socket.bytesAvailable'); 1.44169 + return this._bytesAvailable; 1.44170 + } 1.44171 + }, 1.44172 + connected: { 1.44173 + get: function connected() { 1.44174 + somewhatImplemented('Socket.connected'); 1.44175 + return this._connected; 1.44176 + } 1.44177 + }, 1.44178 + objectEncoding: { 1.44179 + get: function objectEncoding() { 1.44180 + notImplemented('Socket.objectEncoding'); 1.44181 + return this._objectEncoding; 1.44182 + }, 1.44183 + set: function objectEncoding(version) { 1.44184 + notImplemented('Socket.objectEncoding'); 1.44185 + this._objectEncoding = version; 1.44186 + } 1.44187 + }, 1.44188 + endian: { 1.44189 + get: function endian() { 1.44190 + notImplemented('Socket.endian'); 1.44191 + return this._endian; 1.44192 + }, 1.44193 + set: function endian(type) { 1.44194 + notImplemented('Socket.endian'); 1.44195 + this._endian = type; 1.44196 + } 1.44197 + }, 1.44198 + bytesPending: { 1.44199 + get: function bytesPending() { 1.44200 + notImplemented('Socket.bytesPending'); 1.44201 + return this._bytesPending; 1.44202 + } 1.44203 + } 1.44204 + } 1.44205 + }, 1.44206 + script: { 1.44207 + instance: Glue.ALL 1.44208 + } 1.44209 + } 1.44210 + }; 1.44211 + }.call(this); 1.44212 +var URLLoaderDefinition = function () { 1.44213 + return { 1.44214 + initialize: function () { 1.44215 + }, 1.44216 + __glue__: { 1.44217 + native: { 1.44218 + static: {}, 1.44219 + instance: {} 1.44220 + }, 1.44221 + script: { 1.44222 + static: {}, 1.44223 + instance: { 1.44224 + data: 'public data', 1.44225 + dataFormat: 'public dataFormat', 1.44226 + bytesTotal: 'public bytesTotal', 1.44227 + bytesLoaded: 'public bytesLoaded', 1.44228 + load: 'public load' 1.44229 + } 1.44230 + } 1.44231 + } 1.44232 + }; 1.44233 + }.call(this); 1.44234 +var URLRequestDefinition = function () { 1.44235 + function toFileLoadingServiceRequest() { 1.44236 + var obj = {}; 1.44237 + obj.url = this._url; 1.44238 + obj.method = this._method; 1.44239 + obj.checkPolicyFile = this._checkPolicyFile; 1.44240 + if (this._data) { 1.44241 + obj.mimeType = this._contentType; 1.44242 + var ByteArrayClass = avm2.systemDomain.getClass('flash.utils.ByteArray'); 1.44243 + if (ByteArrayClass.isInstanceOf(this._data)) { 1.44244 + obj.data = new Uint8Array(this._data.a, 0, this._data.length); 1.44245 + } else { 1.44246 + var data = this._data.asGetPublicProperty('toString').call(this._data); 1.44247 + if (this._method === 'GET') { 1.44248 + var i = obj.url.lastIndexOf('?'); 1.44249 + obj.url = (i < 0 ? obj.url : obj.url.substring(0, i)) + '?' + data; 1.44250 + } else { 1.44251 + obj.data = data; 1.44252 + } 1.44253 + } 1.44254 + } 1.44255 + return obj; 1.44256 + } 1.44257 + var def = { 1.44258 + initialize: function () { 1.44259 + this._url = null; 1.44260 + this._method = 'GET'; 1.44261 + this._data = null; 1.44262 + this._digest = null; 1.44263 + this._contentType = 'application/x-www-form-urlencoded'; 1.44264 + this._requestHeaders = null; 1.44265 + this._checkPolicyFile = true; 1.44266 + this._toFileRequest = toFileLoadingServiceRequest; 1.44267 + }, 1.44268 + setMethod: function (val) { 1.44269 + this._method = val; 1.44270 + }, 1.44271 + setRequestHeaders: function (val) { 1.44272 + this._requestHeaders = val; 1.44273 + }, 1.44274 + get contentType() { 1.44275 + return this._contentType; 1.44276 + }, 1.44277 + set contentType(val) { 1.44278 + this._contentType = val; 1.44279 + }, 1.44280 + get data() { 1.44281 + return this._data; 1.44282 + }, 1.44283 + set data(val) { 1.44284 + this._data = val; 1.44285 + }, 1.44286 + get digest() { 1.44287 + return this._digest; 1.44288 + }, 1.44289 + set digest(val) { 1.44290 + this._digest = val; 1.44291 + }, 1.44292 + get method() { 1.44293 + return this._method; 1.44294 + }, 1.44295 + set method(method) { 1.44296 + this._method = method; 1.44297 + }, 1.44298 + get requestHeaders() { 1.44299 + return this._requestHeaders; 1.44300 + }, 1.44301 + set requestHeaders(requestHeaders) { 1.44302 + this._requestHeaders = requestHeaders; 1.44303 + }, 1.44304 + get url() { 1.44305 + return this._url; 1.44306 + }, 1.44307 + set url(val) { 1.44308 + this._url = val; 1.44309 + } 1.44310 + }; 1.44311 + var desc = Object.getOwnPropertyDescriptor; 1.44312 + def.__glue__ = { 1.44313 + native: { 1.44314 + instance: { 1.44315 + setMethod: def.setMethod, 1.44316 + setRequestHeaders: def.setRequestHeaders, 1.44317 + contentType: desc(def, 'contentType'), 1.44318 + data: desc(def, 'data'), 1.44319 + digest: desc(def, 'digest'), 1.44320 + method: desc(def, 'method'), 1.44321 + requestHeaders: desc(def, 'requestHeaders'), 1.44322 + url: desc(def, 'url') 1.44323 + } 1.44324 + } 1.44325 + }; 1.44326 + return def; 1.44327 + }.call(this); 1.44328 +var URLStreamDefinition = function () { 1.44329 + var def = { 1.44330 + initialize: function () { 1.44331 + this._stream = null; 1.44332 + this._connected = false; 1.44333 + this._littleEndian = false; 1.44334 + }, 1.44335 + close: function close() { 1.44336 + this._session.close(); 1.44337 + }, 1.44338 + load: function load(request) { 1.44339 + var session = FileLoadingService.createSession(); 1.44340 + var self = this; 1.44341 + var initStream = true; 1.44342 + session.onprogress = function (data, progressState) { 1.44343 + if (initStream) { 1.44344 + initStream = false; 1.44345 + var length = Math.max(progressState.bytesTotal, data.length); 1.44346 + var buffer = new ArrayBuffer(length); 1.44347 + self._stream = new Stream(buffer, 0, 0, length); 1.44348 + } else if (self._stream.end + data.length > self._stream.bytes.length) { 1.44349 + var length = self._stream.end + data.length; 1.44350 + var buffer = new ArrayBuffer(length); 1.44351 + var newStream = new Stream(buffer, 0, 0, length); 1.44352 + newStream.push(self._stream.bytes.subarray(0, self._stream.end)); 1.44353 + self._stream = newStream; 1.44354 + } 1.44355 + self._stream.push(data); 1.44356 + var ProgressEventClass = avm2.systemDomain.getClass('flash.events.ProgressEvent'); 1.44357 + self._dispatchEvent(ProgressEventClass.createInstance([ 1.44358 + 'progress', 1.44359 + false, 1.44360 + false, 1.44361 + progressState.bytesLoaded, 1.44362 + progressState.bytesTotal 1.44363 + ])); 1.44364 + }; 1.44365 + session.onerror = function (error) { 1.44366 + self._connected = false; 1.44367 + if (!self._stream) { 1.44368 + self._stream = new Stream(new ArrayBuffer(0), 0, 0, 0); 1.44369 + } 1.44370 + self._dispatchEvent(new flash.events.IOErrorEvent(flash.events.IOErrorEvent.class.IO_ERROR, false, false, error)); 1.44371 + }; 1.44372 + session.onopen = function () { 1.44373 + self._connected = true; 1.44374 + self._dispatchEvent(new flash.events.Event('open', false, false)); 1.44375 + }; 1.44376 + session.onhttpstatus = function (location, httpStatus, httpHeaders) { 1.44377 + var HTTPStatusEventClass = avm2.systemDomain.getClass('flash.events.HTTPStatusEvent'); 1.44378 + var URLRequestHeaderClass = avm2.systemDomain.getClass('flash.net.URLRequestHeader'); 1.44379 + var httpStatusEvent = HTTPStatusEventClass.createInstance([ 1.44380 + 'httpStatus', 1.44381 + false, 1.44382 + false, 1.44383 + httpStatus 1.44384 + ]); 1.44385 + var headers = []; 1.44386 + httpHeaders.split(/(?:\n|\r?\n)/g).forEach(function (h) { 1.44387 + var m = /^([^:]+): (.*)$/.exec(h); 1.44388 + if (m) { 1.44389 + headers.push(URLRequestHeaderClass.createInstance([ 1.44390 + m[1], 1.44391 + m[2] 1.44392 + ])); 1.44393 + if (m[1] === 'Location') { 1.44394 + location = m[2]; 1.44395 + } 1.44396 + } 1.44397 + }); 1.44398 + httpStatusEvent.asSetPublicProperty('responseHeaders', headers); 1.44399 + httpStatusEvent.asSetPublicProperty('responseURL', location); 1.44400 + self._dispatchEvent(httpStatusEvent); 1.44401 + }; 1.44402 + session.onclose = function () { 1.44403 + self._connected = false; 1.44404 + if (!self._stream) { 1.44405 + self._stream = new Stream(new ArrayBuffer(0), 0, 0, 0); 1.44406 + } 1.44407 + self._dispatchEvent(new flash.events.Event('complete', false, false)); 1.44408 + }; 1.44409 + session.open(request._toFileRequest()); 1.44410 + this._session = session; 1.44411 + }, 1.44412 + readBoolean: function readBoolean() { 1.44413 + notImplemented('URLStream.readBoolean'); 1.44414 + }, 1.44415 + readByte: function readByte() { 1.44416 + var stream = this._stream; 1.44417 + stream.ensure(1); 1.44418 + return stream.bytes[stream.pos++]; 1.44419 + }, 1.44420 + readBytes: function readBytes(bytes, offset, length) { 1.44421 + if (length < 0) 1.44422 + throw 'Invalid length argument'; 1.44423 + var stream = this._stream; 1.44424 + if (!length) 1.44425 + length = stream.remaining(); 1.44426 + else 1.44427 + stream.ensure(length); 1.44428 + bytes.writeRawBytes(stream.bytes.subarray(stream.pos, stream.pos + length), offset, length); 1.44429 + stream.pos += length; 1.44430 + }, 1.44431 + readDouble: function readDouble() { 1.44432 + notImplemented('URLStream.readDouble'); 1.44433 + }, 1.44434 + readFloat: function readFloat() { 1.44435 + notImplemented('URLStream.readFloat'); 1.44436 + }, 1.44437 + readInt: function readInt() { 1.44438 + notImplemented('URLStream.readInt'); 1.44439 + }, 1.44440 + readMultiByte: function readMultiByte(length, charSet) { 1.44441 + notImplemented('URLStream.readMultiByte'); 1.44442 + }, 1.44443 + readObject: function readObject() { 1.44444 + notImplemented('URLStream.readObject'); 1.44445 + }, 1.44446 + readShort: function readShort() { 1.44447 + notImplemented('URLStream.readShort'); 1.44448 + }, 1.44449 + readUTF: function readUTF() { 1.44450 + return this.readUTFBytes(this.readUnsignedShort()); 1.44451 + }, 1.44452 + readUTFBytes: function readUTFBytes(length) { 1.44453 + if (length < 0) 1.44454 + throw 'Invalid length argument'; 1.44455 + var stream = this._stream; 1.44456 + stream.ensure(length); 1.44457 + var str = utf8encode(stream.bytes.subarray(stream.pos, stream.pos + length)); 1.44458 + stream.pos += length; 1.44459 + return str; 1.44460 + }, 1.44461 + readUnsignedByte: function readUnsignedByte() { 1.44462 + notImplemented('URLStream.readUnsignedByte'); 1.44463 + }, 1.44464 + readUnsignedInt: function readUnsignedInt() { 1.44465 + notImplemented('URLStream.readUnsignedInt'); 1.44466 + }, 1.44467 + readUnsignedShort: function readUnsignedShort() { 1.44468 + var stream = this._stream; 1.44469 + stream.ensure(2); 1.44470 + var result = stream.getUint16(stream.pos, this._littleEndian); 1.44471 + stream.pos += 2; 1.44472 + return result; 1.44473 + }, 1.44474 + get bytesAvailable() { 1.44475 + return this._stream.remaining(); 1.44476 + }, 1.44477 + get connected() { 1.44478 + return this._connected; 1.44479 + }, 1.44480 + get endian() { 1.44481 + return this._littleEndian ? 'littleEndian' : 'bigEndian'; 1.44482 + }, 1.44483 + set endian(val) { 1.44484 + this._littleEndian = val == 'littleEndian'; 1.44485 + }, 1.44486 + get objectEncoding() { 1.44487 + notImplemented('URLStream.objectEncoding'); 1.44488 + }, 1.44489 + set objectEncoding(val) { 1.44490 + notImplemented('URLStream.objectEncoding'); 1.44491 + } 1.44492 + }; 1.44493 + var desc = Object.getOwnPropertyDescriptor; 1.44494 + def.__glue__ = { 1.44495 + native: { 1.44496 + instance: { 1.44497 + close: def.close, 1.44498 + load: def.load, 1.44499 + readBoolean: def.readBoolean, 1.44500 + readByte: def.readByte, 1.44501 + readBytes: def.readBytes, 1.44502 + readDouble: def.readDouble, 1.44503 + readFloat: def.readFloat, 1.44504 + readInt: def.readInt, 1.44505 + readMultiByte: def.readMultiByte, 1.44506 + readObject: def.readObject, 1.44507 + readShort: def.readShort, 1.44508 + readUTF: def.readUTF, 1.44509 + readUTFBytes: def.readUTFBytes, 1.44510 + readUnsignedByte: def.readUnsignedByte, 1.44511 + readUnsignedInt: def.readUnsignedInt, 1.44512 + readUnsignedShort: def.readUnsignedShort, 1.44513 + bytesAvailable: desc(def, 'bytesAvailable'), 1.44514 + connected: desc(def, 'connected'), 1.44515 + endian: desc(def, 'endian'), 1.44516 + objectEncoding: desc(def, 'objectEncoding') 1.44517 + } 1.44518 + } 1.44519 + }; 1.44520 + return def; 1.44521 + }.call(this); 1.44522 +{ 1.44523 + var ApplicationDomainDefinition = function () { 1.44524 + return { 1.44525 + __class__: 'flash.system.ApplicationDomain', 1.44526 + initialize: function () { 1.44527 + }, 1.44528 + __glue__: { 1.44529 + native: { 1.44530 + static: { 1.44531 + currentDomain: { 1.44532 + get: function currentDomain() { 1.44533 + return new flash.system.ApplicationDomain(AVM2.currentDomain()); 1.44534 + } 1.44535 + }, 1.44536 + MIN_DOMAIN_MEMORY_LENGTH: { 1.44537 + get: function MIN_DOMAIN_MEMORY_LENGTH() { 1.44538 + notImplemented('ApplicationDomain.MIN_DOMAIN_MEMORY_LENGTH'); 1.44539 + } 1.44540 + } 1.44541 + }, 1.44542 + instance: { 1.44543 + ctor: function ctor(parentDomainOrNativeObject) { 1.44544 + if (parentDomainOrNativeObject instanceof ApplicationDomain) { 1.44545 + this.nativeObject = parentDomainOrNativeObject; 1.44546 + return; 1.44547 + } 1.44548 + var parentNativeObject = parentDomainOrNativeObject ? parentDomainOrNativeObject.nativeObject : AVM2.currentDomain().system; 1.44549 + this.nativeObject = new ApplicationDomain(parentNativeObject.vm, parentNativeObject); 1.44550 + }, 1.44551 + getDefinition: function getDefinition(name) { 1.44552 + var simpleName = name.replace('::', '.'); 1.44553 + return this.nativeObject.getProperty(Multiname.fromSimpleName(simpleName), true, true); 1.44554 + }, 1.44555 + hasDefinition: function hasDefinition(name) { 1.44556 + if (name === undefined) { 1.44557 + return false; 1.44558 + } 1.44559 + var simpleName = name.replace('::', '.'); 1.44560 + return !(!this.nativeObject.findDomainProperty(Multiname.fromSimpleName(simpleName), false, false)); 1.44561 + }, 1.44562 + getQualifiedDefinitionNames: function getQualifiedDefinitionNames() { 1.44563 + notImplemented('ApplicationDomain.getQualifiedDefinitionNames'); 1.44564 + }, 1.44565 + parentDomain: { 1.44566 + get: function parentDomain() { 1.44567 + var base = this.nativeObject.base; 1.44568 + if (!base) { 1.44569 + return undefined; 1.44570 + } 1.44571 + return new flash.system.ApplicationDomain(base); 1.44572 + } 1.44573 + }, 1.44574 + domainMemory: { 1.44575 + get: function domainMemory() { 1.44576 + notImplemented('ApplicationDomain.domainMemory'); 1.44577 + return this._domainMemory; 1.44578 + }, 1.44579 + set: function domainMemory(mem) { 1.44580 + notImplemented('ApplicationDomain.domainMemory'); 1.44581 + this._domainMemory = mem; 1.44582 + } 1.44583 + } 1.44584 + } 1.44585 + }, 1.44586 + script: { 1.44587 + static: Glue.ALL, 1.44588 + instance: Glue.ALL 1.44589 + } 1.44590 + } 1.44591 + }; 1.44592 + }.call(this); 1.44593 +} 1.44594 +var CapabilitiesDefinition = function () { 1.44595 + var def = {}; 1.44596 + var os; 1.44597 + var userAgent = window.navigator.userAgent; 1.44598 + if (userAgent.indexOf('Macintosh') > 0) { 1.44599 + os = 'Mac OS 10.5.2'; 1.44600 + } else if (userAgent.indexOf('Windows') > 0) { 1.44601 + os = 'Windows XP'; 1.44602 + } else if (userAgent.indexOf('Linux') > 0) { 1.44603 + os = 'Linux'; 1.44604 + } else if (/(iPad|iPhone|iPod|Android)/.test(userAgent)) { 1.44605 + os = 'iPhone3,1'; 1.44606 + } else { 1.44607 + notImplemented(); 1.44608 + } 1.44609 + def.__glue__ = { 1.44610 + native: { 1.44611 + static: { 1.44612 + version: { 1.44613 + get: function version() { 1.44614 + return 'SHUMWAY 10,0,0,0'; 1.44615 + }, 1.44616 + enumerable: true 1.44617 + }, 1.44618 + os: { 1.44619 + get: function () { 1.44620 + return os; 1.44621 + }, 1.44622 + enumerable: true 1.44623 + }, 1.44624 + serverString: { 1.44625 + get: function () { 1.44626 + var str = toKeyValueArray({ 1.44627 + OS: os 1.44628 + }).map(function (pair) { 1.44629 + return pair[0] + '=' + encodeURIComponent(pair[1]); 1.44630 + }).join('&'); 1.44631 + somewhatImplemented('Capabilities.serverString: ' + str); 1.44632 + return str; 1.44633 + } 1.44634 + }, 1.44635 + hasAccessibility: { 1.44636 + get: function hasAccessibility() { 1.44637 + somewhatImplemented('Capabilities.hasAccessibility'); 1.44638 + return false; 1.44639 + } 1.44640 + }, 1.44641 + isDebugger: { 1.44642 + get: function isDebugger() { 1.44643 + return false; 1.44644 + } 1.44645 + }, 1.44646 + screenResolutionX: { 1.44647 + get: function screenResolutionX() { 1.44648 + return window.screen.width; 1.44649 + } 1.44650 + }, 1.44651 + screenResolutionY: { 1.44652 + get: function screenResolutionY() { 1.44653 + return window.screen.height; 1.44654 + } 1.44655 + }, 1.44656 + manufacturer: { 1.44657 + get: function manufacturer() { 1.44658 + somewhatImplemented('Capabilities.manufacturer'); 1.44659 + return 'Mozilla Research'; 1.44660 + } 1.44661 + }, 1.44662 + language: { 1.44663 + get: function language() { 1.44664 + somewhatImplemented('Capabilities.language'); 1.44665 + return 'en'; 1.44666 + } 1.44667 + }, 1.44668 + playerType: { 1.44669 + get: function playerType() { 1.44670 + somewhatImplemented('Capabilities.playerType'); 1.44671 + return 'PlugIn'; 1.44672 + } 1.44673 + } 1.44674 + } 1.44675 + }, 1.44676 + script: { 1.44677 + static: scriptProperties('public', [ 1.44678 + 'version', 1.44679 + 'os' 1.44680 + ]) 1.44681 + } 1.44682 + }; 1.44683 + return def; 1.44684 + }.call(this); 1.44685 +var FSCommandDefinition = function () { 1.44686 + var def = {}; 1.44687 + function fscommand(command, parameters) { 1.44688 + console.log('FSCommand: ' + command + '; ' + parameters); 1.44689 + switch (command.toLowerCase()) { 1.44690 + case 'quit': 1.44691 + renderingTerminated = true; 1.44692 + return; 1.44693 + case 'debugger': 1.44694 + debugger; 1.44695 + return; 1.44696 + default: 1.44697 + break; 1.44698 + } 1.44699 + } 1.44700 + def.__glue__ = { 1.44701 + native: { 1.44702 + static: { 1.44703 + _fscommand: fscommand 1.44704 + } 1.44705 + } 1.44706 + }; 1.44707 + return def; 1.44708 + }.call(this); 1.44709 +var SecurityDefinition = function () { 1.44710 + var _exactSettings; 1.44711 + return { 1.44712 + __class__: 'flash.system.Security', 1.44713 + initialize: function () { 1.44714 + }, 1.44715 + __glue__: { 1.44716 + native: { 1.44717 + static: { 1.44718 + allowDomain: function allowDomain() { 1.44719 + somewhatImplemented('Security.allowDomain ["' + Array.prototype.join.call(arguments, '", "') + '"]'); 1.44720 + }, 1.44721 + allowInsecureDomain: function allowInsecureDomain() { 1.44722 + somewhatImplemented('Security.allowInsecureDomain'); 1.44723 + }, 1.44724 + loadPolicyFile: function loadPolicyFile(url) { 1.44725 + somewhatImplemented('Security.loadPolicyFile'); 1.44726 + }, 1.44727 + duplicateSandboxBridgeInputArguments: function duplicateSandboxBridgeInputArguments(toplevel, args) { 1.44728 + notImplemented('Security.duplicateSandboxBridgeInputArguments'); 1.44729 + }, 1.44730 + duplicateSandboxBridgeOutputArgument: function duplicateSandboxBridgeOutputArgument(toplevel, arg) { 1.44731 + notImplemented('Security.duplicateSandboxBridgeOutputArgument'); 1.44732 + }, 1.44733 + showSettings: function showSettings(panel) { 1.44734 + notImplemented('Security.showSettings'); 1.44735 + }, 1.44736 + exactSettings: { 1.44737 + get: function () { 1.44738 + return _exactSettings; 1.44739 + }, 1.44740 + set: function (value) { 1.44741 + _exactSettings = value; 1.44742 + } 1.44743 + }, 1.44744 + disableAVM1Loading: { 1.44745 + get: function disableAVM1Loading() { 1.44746 + notImplemented('Security.disableAVM1Loading'); 1.44747 + }, 1.44748 + set: function disableAVM1Loading(value) { 1.44749 + notImplemented('Security.disableAVM1Loading'); 1.44750 + } 1.44751 + }, 1.44752 + sandboxType: { 1.44753 + get: function () { 1.44754 + somewhatImplemented('Security.sandboxType'); 1.44755 + return 'remote'; 1.44756 + } 1.44757 + }, 1.44758 + pageDomain: { 1.44759 + get: function pageDomain() { 1.44760 + somewhatImplemented('Security.pageDomain'); 1.44761 + var pageHost = FileLoadingService.resolveUrl('/'); 1.44762 + var parts = pageHost.split('/'); 1.44763 + parts.pop(); 1.44764 + return parts.pop(); 1.44765 + } 1.44766 + } 1.44767 + } 1.44768 + } 1.44769 + } 1.44770 + }; 1.44771 + }.call(this); 1.44772 +var SecurityDomainDefinition = function () { 1.44773 + return { 1.44774 + __class__: 'flash.system.SecurityDomain', 1.44775 + initialize: function () { 1.44776 + }, 1.44777 + _currentDomain: null, 1.44778 + __glue__: { 1.44779 + native: { 1.44780 + static: { 1.44781 + currentDomain: { 1.44782 + get: function () { 1.44783 + return this._currentDomain; 1.44784 + } 1.44785 + } 1.44786 + }, 1.44787 + instance: { 1.44788 + ctor_impl: function ctor_impl() { 1.44789 + notImplemented('SecurityDomain.ctor_impl'); 1.44790 + }, 1.44791 + domainID: { 1.44792 + get: function domainID() { 1.44793 + notImplemented('SecurityDomain.domainID'); 1.44794 + return this._domainID; 1.44795 + } 1.44796 + } 1.44797 + } 1.44798 + } 1.44799 + } 1.44800 + }; 1.44801 + }.call(this); 1.44802 +var SystemDefinition = function () { 1.44803 + return { 1.44804 + __class__: 'flash.system.System', 1.44805 + initialize: function () { 1.44806 + }, 1.44807 + __glue__: { 1.44808 + native: { 1.44809 + static: { 1.44810 + setClipboard: function setClipboard(string) { 1.44811 + FirefoxCom.request('setClipboard', string); 1.44812 + TelemetryService.reportTelemetry({ 1.44813 + topic: 'feature', 1.44814 + feature: CLIPBOARD_FEATURE 1.44815 + }); 1.44816 + }, 1.44817 + pause: function pause() { 1.44818 + somewhatImplemented('System.pause'); 1.44819 + }, 1.44820 + resume: function resume() { 1.44821 + somewhatImplemented('System.resume'); 1.44822 + }, 1.44823 + exit: function exit(code) { 1.44824 + somewhatImplemented('System.exit'); 1.44825 + renderingTerminated = true; 1.44826 + }, 1.44827 + gc: function gc() { 1.44828 + somewhatImplemented('System.gc'); 1.44829 + }, 1.44830 + pauseForGCIfCollectionImminent: function pauseForGCIfCollectionImminent(imminence) { 1.44831 + notImplemented('System.pauseForGCIfCollectionImminent'); 1.44832 + }, 1.44833 + disposeXML: function disposeXML(node) { 1.44834 + notImplemented('System.disposeXML'); 1.44835 + }, 1.44836 + ime: { 1.44837 + get: function ime() { 1.44838 + notImplemented('System.ime'); 1.44839 + } 1.44840 + }, 1.44841 + totalMemoryNumber: { 1.44842 + get: function totalMemoryNumber() { 1.44843 + if (performance.memory) { 1.44844 + return performance.memory.usedJSHeapSize; 1.44845 + } 1.44846 + return 0; 1.44847 + } 1.44848 + }, 1.44849 + freeMemory: { 1.44850 + get: function freeMemory() { 1.44851 + notImplemented('System.freeMemory'); 1.44852 + } 1.44853 + }, 1.44854 + privateMemory: { 1.44855 + get: function privateMemory() { 1.44856 + return 0; 1.44857 + } 1.44858 + }, 1.44859 + processCPUUsage: { 1.44860 + get: function processCPUUsage() { 1.44861 + notImplemented('System.processCPUUsage'); 1.44862 + } 1.44863 + }, 1.44864 + useCodePage: { 1.44865 + get: function useCodePage() { 1.44866 + somewhatImplemented('System.useCodePage'); 1.44867 + return false; 1.44868 + }, 1.44869 + set: function useCodePage(value) { 1.44870 + notImplemented('System.useCodePage'); 1.44871 + } 1.44872 + }, 1.44873 + vmVersion: { 1.44874 + get: function vmVersion() { 1.44875 + somewhatImplemented('System.vmVersion'); 1.44876 + return '1.0 shumway'; 1.44877 + } 1.44878 + }, 1.44879 + swfVersion: { 1.44880 + get: function () { 1.44881 + return 19; 1.44882 + } 1.44883 + }, 1.44884 + apiVersion: { 1.44885 + get: function () { 1.44886 + return 26; 1.44887 + } 1.44888 + }, 1.44889 + getArgv: function () { 1.44890 + return []; 1.44891 + }, 1.44892 + getRunmode: function () { 1.44893 + return 'mixed'; 1.44894 + } 1.44895 + }, 1.44896 + instance: {} 1.44897 + } 1.44898 + } 1.44899 + }; 1.44900 + }.call(this); 1.44901 +{ 1.44902 + var FontDefinition = function () { 1.44903 + var fonts = []; 1.44904 + var fontsByUniqueName = Object.create(null); 1.44905 + var fontsByNameStyleType = Object.create(null); 1.44906 + var _deviceFontMetrics; 1.44907 + var def = { 1.44908 + __class__: 'flash.text.Font', 1.44909 + initialize: function () { 1.44910 + var s = this.symbol; 1.44911 + if (s) { 1.44912 + this._fontName = s.name || null; 1.44913 + this._uniqueName = s.uniqueName; 1.44914 + if (s.bold) { 1.44915 + if (s.italic) { 1.44916 + this._fontStyle = 'boldItalic'; 1.44917 + } else { 1.44918 + this._fontStyle = 'bold'; 1.44919 + } 1.44920 + } else if (s.italic) { 1.44921 + this._fontStyle = 'italic'; 1.44922 + } else { 1.44923 + this._fontStyle = 'regular'; 1.44924 + } 1.44925 + var metrics = s.metrics; 1.44926 + metrics.height = metrics.ascent + metrics.descent + metrics.leading; 1.44927 + this._metrics = metrics; 1.44928 + this._fontType = 'embedded'; 1.44929 + fonts.push(this); 1.44930 + fontsByUniqueName[this._uniqueName] = this; 1.44931 + var ident = this._fontName.toLowerCase() + '_' + this._fontStyle + '_embedded'; 1.44932 + fontsByNameStyleType[ident] = this; 1.44933 + } 1.44934 + }, 1.44935 + get fontName() { 1.44936 + return this._fontName; 1.44937 + }, 1.44938 + get fontStyle() { 1.44939 + return this._fontStyle; 1.44940 + }, 1.44941 + get fontType() { 1.44942 + return this._fontType; 1.44943 + }, 1.44944 + hasGlyphs: function hasGlyphs(str) { 1.44945 + return true; 1.44946 + }, 1.44947 + getFont: function (name, style, embedded) { 1.44948 + var ident = name.toLowerCase() + '_' + style + (embedded ? '_embedded' : '_device'); 1.44949 + var font = fontsByNameStyleType[ident]; 1.44950 + if (font) { 1.44951 + return font; 1.44952 + } 1.44953 + font = new flash.text.Font(); 1.44954 + font._fontName = font._uniqueName = name; 1.44955 + font._fontStyle = style; 1.44956 + font._fontType = 'device'; 1.44957 + var metrics = deviceFontMetrics()[name]; 1.44958 + if (!metrics) { 1.44959 + metrics = deviceFontMetrics().serif; 1.44960 + font._fontName = font._uniqueName = 'serif'; 1.44961 + } 1.44962 + font._metrics = { 1.44963 + ascent: metrics[0], 1.44964 + descent: metrics[1], 1.44965 + leading: metrics[2] 1.44966 + }; 1.44967 + font._metrics.height = metrics[0] + metrics[1] + metrics[2]; 1.44968 + fontsByNameStyleType[ident] = font; 1.44969 + return font; 1.44970 + }, 1.44971 + getFontByUniqueName: function (name) { 1.44972 + return fontsByUniqueName[name]; 1.44973 + } 1.44974 + }; 1.44975 + function enumerateFonts(device) { 1.44976 + return fonts.slice(); 1.44977 + } 1.44978 + function registerFont(font) { 1.44979 + somewhatImplemented('Font.registerFont'); 1.44980 + } 1.44981 + function deviceFontMetrics() { 1.44982 + if (_deviceFontMetrics) { 1.44983 + return _deviceFontMetrics; 1.44984 + } 1.44985 + var userAgent = window.navigator.userAgent; 1.44986 + if (userAgent.indexOf('Windows') > -1) { 1.44987 + _deviceFontMetrics = DEVICE_FONT_METRICS_WIN; 1.44988 + } else if (/(Macintosh|iPad|iPhone|iPod|Android)/.test(userAgent)) { 1.44989 + _deviceFontMetrics = DEVICE_FONT_METRICS_MAC; 1.44990 + } else { 1.44991 + _deviceFontMetrics = DEVICE_FONT_METRICS_LINUX; 1.44992 + } 1.44993 + return _deviceFontMetrics; 1.44994 + } 1.44995 + var desc = Object.getOwnPropertyDescriptor; 1.44996 + def.__glue__ = { 1.44997 + native: { 1.44998 + instance: { 1.44999 + fontName: desc(def, 'fontName'), 1.45000 + fontStyle: desc(def, 'fontStyle'), 1.45001 + fontType: desc(def, 'fontType'), 1.45002 + hasGlyphs: def.hasGlyphs 1.45003 + }, 1.45004 + static: { 1.45005 + enumerateFonts: enumerateFonts, 1.45006 + registerFont: registerFont 1.45007 + } 1.45008 + } 1.45009 + }; 1.45010 + return def; 1.45011 + }.call(this); 1.45012 + var DEVICE_FONT_METRICS_WIN = { 1.45013 + 'serif': [ 1.45014 + 1, 1.45015 + 0.25, 1.45016 + 0 1.45017 + ], 1.45018 + 'sans-serif': [ 1.45019 + 1, 1.45020 + 0.25, 1.45021 + 0 1.45022 + ], 1.45023 + 'monospace': [ 1.45024 + 1, 1.45025 + 0.25, 1.45026 + 0 1.45027 + ], 1.45028 + 'birch std': [ 1.45029 + 0.9167, 1.45030 + 0.25, 1.45031 + 0 1.45032 + ], 1.45033 + 'blackoak std': [ 1.45034 + 1, 1.45035 + 0.3333, 1.45036 + 0 1.45037 + ], 1.45038 + 'chaparral pro': [ 1.45039 + 0.8333, 1.45040 + 0.3333, 1.45041 + 0 1.45042 + ], 1.45043 + 'chaparral pro light': [ 1.45044 + 0.8333, 1.45045 + 0.3333, 1.45046 + 0 1.45047 + ], 1.45048 + 'charlemagne std': [ 1.45049 + 0.9167, 1.45050 + 0.25, 1.45051 + 0 1.45052 + ], 1.45053 + 'cooper std black': [ 1.45054 + 0.9167, 1.45055 + 0.25, 1.45056 + 0 1.45057 + ], 1.45058 + 'giddyup std': [ 1.45059 + 0.8333, 1.45060 + 0.3333, 1.45061 + 0 1.45062 + ], 1.45063 + 'hobo std': [ 1.45064 + 1.0833, 1.45065 + 0.3333, 1.45066 + 0 1.45067 + ], 1.45068 + 'kozuka gothic pro b': [ 1.45069 + 1, 1.45070 + 0.4167, 1.45071 + 0 1.45072 + ], 1.45073 + 'kozuka gothic pro el': [ 1.45074 + 1.0833, 1.45075 + 0.25, 1.45076 + 0 1.45077 + ], 1.45078 + 'kozuka gothic pro h': [ 1.45079 + 1, 1.45080 + 0.4167, 1.45081 + 0 1.45082 + ], 1.45083 + 'kozuka gothic pro l': [ 1.45084 + 1, 1.45085 + 0.3333, 1.45086 + 0 1.45087 + ], 1.45088 + 'kozuka gothic pro m': [ 1.45089 + 1.0833, 1.45090 + 0.3333, 1.45091 + 0 1.45092 + ], 1.45093 + 'kozuka gothic pro r': [ 1.45094 + 1, 1.45095 + 0.3333, 1.45096 + 0 1.45097 + ], 1.45098 + 'kozuka mincho pro b': [ 1.45099 + 1.0833, 1.45100 + 0.25, 1.45101 + 0 1.45102 + ], 1.45103 + 'kozuka mincho pro el': [ 1.45104 + 1.0833, 1.45105 + 0.25, 1.45106 + 0 1.45107 + ], 1.45108 + 'kozuka mincho pro h': [ 1.45109 + 1.1667, 1.45110 + 0.25, 1.45111 + 0 1.45112 + ], 1.45113 + 'kozuka mincho pro l': [ 1.45114 + 1.0833, 1.45115 + 0.25, 1.45116 + 0 1.45117 + ], 1.45118 + 'kozuka mincho pro m': [ 1.45119 + 1.0833, 1.45120 + 0.25, 1.45121 + 0 1.45122 + ], 1.45123 + 'kozuka mincho pro r': [ 1.45124 + 1.0833, 1.45125 + 0.25, 1.45126 + 0 1.45127 + ], 1.45128 + 'mesquite std': [ 1.45129 + 0.9167, 1.45130 + 0.25, 1.45131 + 0 1.45132 + ], 1.45133 + 'minion pro cond': [ 1.45134 + 1, 1.45135 + 0.3333, 1.45136 + 0 1.45137 + ], 1.45138 + 'minion pro med': [ 1.45139 + 1, 1.45140 + 0.3333, 1.45141 + 0 1.45142 + ], 1.45143 + 'minion pro smbd': [ 1.45144 + 1, 1.45145 + 0.3333, 1.45146 + 0 1.45147 + ], 1.45148 + 'myriad arabic': [ 1.45149 + 1, 1.45150 + 0.4167, 1.45151 + 0 1.45152 + ], 1.45153 + 'nueva std': [ 1.45154 + 0.75, 1.45155 + 0.25, 1.45156 + 0 1.45157 + ], 1.45158 + 'nueva std cond': [ 1.45159 + 0.75, 1.45160 + 0.25, 1.45161 + 0 1.45162 + ], 1.45163 + 'ocr a std': [ 1.45164 + 0.8333, 1.45165 + 0.25, 1.45166 + 0 1.45167 + ], 1.45168 + 'orator std': [ 1.45169 + 1.0833, 1.45170 + 0.25, 1.45171 + 0 1.45172 + ], 1.45173 + 'poplar std': [ 1.45174 + 0.9167, 1.45175 + 0.25, 1.45176 + 0 1.45177 + ], 1.45178 + 'prestige elite std': [ 1.45179 + 0.9167, 1.45180 + 0.25, 1.45181 + 0 1.45182 + ], 1.45183 + 'rosewood std regular': [ 1.45184 + 0.8333, 1.45185 + 0.3333, 1.45186 + 0 1.45187 + ], 1.45188 + 'stencil std': [ 1.45189 + 1, 1.45190 + 0.3333, 1.45191 + 0 1.45192 + ], 1.45193 + 'trajan pro': [ 1.45194 + 1, 1.45195 + 0.25, 1.45196 + 0 1.45197 + ], 1.45198 + 'kozuka gothic pr6n b': [ 1.45199 + 1.4167, 1.45200 + 0.4167, 1.45201 + 0 1.45202 + ], 1.45203 + 'kozuka gothic pr6n el': [ 1.45204 + 1.4167, 1.45205 + 0.3333, 1.45206 + 0 1.45207 + ], 1.45208 + 'kozuka gothic pr6n h': [ 1.45209 + 1.4167, 1.45210 + 0.4167, 1.45211 + 0 1.45212 + ], 1.45213 + 'kozuka gothic pr6n l': [ 1.45214 + 1.4167, 1.45215 + 0.3333, 1.45216 + 0 1.45217 + ], 1.45218 + 'kozuka gothic pr6n m': [ 1.45219 + 1.5, 1.45220 + 0.3333, 1.45221 + 0 1.45222 + ], 1.45223 + 'kozuka gothic pr6n r': [ 1.45224 + 1.4167, 1.45225 + 0.3333, 1.45226 + 0 1.45227 + ], 1.45228 + 'kozuka mincho pr6n b': [ 1.45229 + 1.3333, 1.45230 + 0.3333, 1.45231 + 0 1.45232 + ], 1.45233 + 'kozuka mincho pr6n el': [ 1.45234 + 1.3333, 1.45235 + 0.3333, 1.45236 + 0 1.45237 + ], 1.45238 + 'kozuka mincho pr6n h': [ 1.45239 + 1.4167, 1.45240 + 0.3333, 1.45241 + 0 1.45242 + ], 1.45243 + 'kozuka mincho pr6n l': [ 1.45244 + 1.3333, 1.45245 + 0.3333, 1.45246 + 0 1.45247 + ], 1.45248 + 'kozuka mincho pr6n m': [ 1.45249 + 1.3333, 1.45250 + 0.3333, 1.45251 + 0 1.45252 + ], 1.45253 + 'kozuka mincho pr6n r': [ 1.45254 + 1.3333, 1.45255 + 0.3333, 1.45256 + 0 1.45257 + ], 1.45258 + 'letter gothic std': [ 1.45259 + 1, 1.45260 + 0.25, 1.45261 + 0 1.45262 + ], 1.45263 + 'minion pro': [ 1.45264 + 1, 1.45265 + 0.3333, 1.45266 + 0 1.45267 + ], 1.45268 + 'myriad hebrew': [ 1.45269 + 0.8333, 1.45270 + 0.3333, 1.45271 + 0 1.45272 + ], 1.45273 + 'myriad pro': [ 1.45274 + 0.9167, 1.45275 + 0.25, 1.45276 + 0 1.45277 + ], 1.45278 + 'myriad pro cond': [ 1.45279 + 0.9167, 1.45280 + 0.25, 1.45281 + 0 1.45282 + ], 1.45283 + 'myriad pro light': [ 1.45284 + 1, 1.45285 + 0.25, 1.45286 + 0 1.45287 + ], 1.45288 + 'marlett': [ 1.45289 + 1, 1.45290 + 0, 1.45291 + 0 1.45292 + ], 1.45293 + 'arial': [ 1.45294 + 1, 1.45295 + 0.25, 1.45296 + 0 1.45297 + ], 1.45298 + 'arabic transparent': [ 1.45299 + 1, 1.45300 + 0.25, 1.45301 + 0 1.45302 + ], 1.45303 + 'arial baltic': [ 1.45304 + 1, 1.45305 + 0.25, 1.45306 + 0 1.45307 + ], 1.45308 + 'arial ce': [ 1.45309 + 1, 1.45310 + 0.25, 1.45311 + 0 1.45312 + ], 1.45313 + 'arial cyr': [ 1.45314 + 1, 1.45315 + 0.25, 1.45316 + 0 1.45317 + ], 1.45318 + 'arial greek': [ 1.45319 + 1, 1.45320 + 0.25, 1.45321 + 0 1.45322 + ], 1.45323 + 'arial tur': [ 1.45324 + 1, 1.45325 + 0.25, 1.45326 + 0 1.45327 + ], 1.45328 + 'batang': [ 1.45329 + 0.8333, 1.45330 + 0.1667, 1.45331 + 0 1.45332 + ], 1.45333 + 'batangche': [ 1.45334 + 0.8333, 1.45335 + 0.1667, 1.45336 + 0 1.45337 + ], 1.45338 + 'gungsuh': [ 1.45339 + 0.8333, 1.45340 + 0.1667, 1.45341 + 0 1.45342 + ], 1.45343 + 'gungsuhche': [ 1.45344 + 0.8333, 1.45345 + 0.1667, 1.45346 + 0 1.45347 + ], 1.45348 + 'courier new': [ 1.45349 + 1, 1.45350 + 0.25, 1.45351 + 0 1.45352 + ], 1.45353 + 'courier new baltic': [ 1.45354 + 1, 1.45355 + 0.25, 1.45356 + 0 1.45357 + ], 1.45358 + 'courier new ce': [ 1.45359 + 1, 1.45360 + 0.25, 1.45361 + 0 1.45362 + ], 1.45363 + 'courier new cyr': [ 1.45364 + 1, 1.45365 + 0.25, 1.45366 + 0 1.45367 + ], 1.45368 + 'courier new greek': [ 1.45369 + 1, 1.45370 + 0.25, 1.45371 + 0 1.45372 + ], 1.45373 + 'courier new tur': [ 1.45374 + 1, 1.45375 + 0.25, 1.45376 + 0 1.45377 + ], 1.45378 + 'daunpenh': [ 1.45379 + 0.6667, 1.45380 + 0.6667, 1.45381 + 0 1.45382 + ], 1.45383 + 'dokchampa': [ 1.45384 + 1.4167, 1.45385 + 0.5833, 1.45386 + 0 1.45387 + ], 1.45388 + 'estrangelo edessa': [ 1.45389 + 0.75, 1.45390 + 0.3333, 1.45391 + 0 1.45392 + ], 1.45393 + 'euphemia': [ 1.45394 + 1.0833, 1.45395 + 0.3333, 1.45396 + 0 1.45397 + ], 1.45398 + 'gautami': [ 1.45399 + 1.1667, 1.45400 + 0.8333, 1.45401 + 0 1.45402 + ], 1.45403 + 'vani': [ 1.45404 + 1.0833, 1.45405 + 0.75, 1.45406 + 0 1.45407 + ], 1.45408 + 'gulim': [ 1.45409 + 0.8333, 1.45410 + 0.1667, 1.45411 + 0 1.45412 + ], 1.45413 + 'gulimche': [ 1.45414 + 0.8333, 1.45415 + 0.1667, 1.45416 + 0 1.45417 + ], 1.45418 + 'dotum': [ 1.45419 + 0.8333, 1.45420 + 0.1667, 1.45421 + 0 1.45422 + ], 1.45423 + 'dotumche': [ 1.45424 + 0.8333, 1.45425 + 0.1667, 1.45426 + 0 1.45427 + ], 1.45428 + 'impact': [ 1.45429 + 1.0833, 1.45430 + 0.25, 1.45431 + 0 1.45432 + ], 1.45433 + 'iskoola pota': [ 1.45434 + 1, 1.45435 + 0.3333, 1.45436 + 0 1.45437 + ], 1.45438 + 'kalinga': [ 1.45439 + 1.0833, 1.45440 + 0.5, 1.45441 + 0 1.45442 + ], 1.45443 + 'kartika': [ 1.45444 + 1, 1.45445 + 0.4167, 1.45446 + 0 1.45447 + ], 1.45448 + 'khmer ui': [ 1.45449 + 1.0833, 1.45450 + 0.3333, 1.45451 + 0 1.45452 + ], 1.45453 + 'lao ui': [ 1.45454 + 1, 1.45455 + 0.25, 1.45456 + 0 1.45457 + ], 1.45458 + 'latha': [ 1.45459 + 1.0833, 1.45460 + 0.4167, 1.45461 + 0 1.45462 + ], 1.45463 + 'lucida console': [ 1.45464 + 0.75, 1.45465 + 0.25, 1.45466 + 0 1.45467 + ], 1.45468 + 'malgun gothic': [ 1.45469 + 1, 1.45470 + 0.25, 1.45471 + 0 1.45472 + ], 1.45473 + 'mangal': [ 1.45474 + 1.0833, 1.45475 + 0.3333, 1.45476 + 0 1.45477 + ], 1.45478 + 'meiryo': [ 1.45479 + 1.0833, 1.45480 + 0.4167, 1.45481 + 0 1.45482 + ], 1.45483 + 'meiryo ui': [ 1.45484 + 1, 1.45485 + 0.25, 1.45486 + 0 1.45487 + ], 1.45488 + 'microsoft himalaya': [ 1.45489 + 0.5833, 1.45490 + 0.4167, 1.45491 + 0 1.45492 + ], 1.45493 + 'microsoft jhenghei': [ 1.45494 + 1, 1.45495 + 0.3333, 1.45496 + 0 1.45497 + ], 1.45498 + 'microsoft yahei': [ 1.45499 + 1.0833, 1.45500 + 0.3333, 1.45501 + 0 1.45502 + ], 1.45503 + 'mingliu': [ 1.45504 + 0.8333, 1.45505 + 0.1667, 1.45506 + 0 1.45507 + ], 1.45508 + 'pmingliu': [ 1.45509 + 0.8333, 1.45510 + 0.1667, 1.45511 + 0 1.45512 + ], 1.45513 + 'mingliu_hkscs': [ 1.45514 + 0.8333, 1.45515 + 0.1667, 1.45516 + 0 1.45517 + ], 1.45518 + 'mingliu-extb': [ 1.45519 + 0.8333, 1.45520 + 0.1667, 1.45521 + 0 1.45522 + ], 1.45523 + 'pmingliu-extb': [ 1.45524 + 0.8333, 1.45525 + 0.1667, 1.45526 + 0 1.45527 + ], 1.45528 + 'mingliu_hkscs-extb': [ 1.45529 + 0.8333, 1.45530 + 0.1667, 1.45531 + 0 1.45532 + ], 1.45533 + 'mongolian baiti': [ 1.45534 + 0.8333, 1.45535 + 0.25, 1.45536 + 0 1.45537 + ], 1.45538 + 'ms gothic': [ 1.45539 + 0.8333, 1.45540 + 0.1667, 1.45541 + 0 1.45542 + ], 1.45543 + 'ms pgothic': [ 1.45544 + 0.8333, 1.45545 + 0.1667, 1.45546 + 0 1.45547 + ], 1.45548 + 'ms ui gothic': [ 1.45549 + 0.8333, 1.45550 + 0.1667, 1.45551 + 0 1.45552 + ], 1.45553 + 'ms mincho': [ 1.45554 + 0.8333, 1.45555 + 0.1667, 1.45556 + 0 1.45557 + ], 1.45558 + 'ms pmincho': [ 1.45559 + 0.8333, 1.45560 + 0.1667, 1.45561 + 0 1.45562 + ], 1.45563 + 'mv boli': [ 1.45564 + 1.1667, 1.45565 + 0.25, 1.45566 + 0 1.45567 + ], 1.45568 + 'microsoft new tai lue': [ 1.45569 + 1, 1.45570 + 0.4167, 1.45571 + 0 1.45572 + ], 1.45573 + 'nyala': [ 1.45574 + 0.9167, 1.45575 + 0.3333, 1.45576 + 0 1.45577 + ], 1.45578 + 'microsoft phagspa': [ 1.45579 + 1.0833, 1.45580 + 0.25, 1.45581 + 0 1.45582 + ], 1.45583 + 'plantagenet cherokee': [ 1.45584 + 1, 1.45585 + 0.4167, 1.45586 + 0 1.45587 + ], 1.45588 + 'raavi': [ 1.45589 + 1.0833, 1.45590 + 0.6667, 1.45591 + 0 1.45592 + ], 1.45593 + 'segoe script': [ 1.45594 + 1.0833, 1.45595 + 0.5, 1.45596 + 0 1.45597 + ], 1.45598 + 'segoe ui': [ 1.45599 + 1, 1.45600 + 0.25, 1.45601 + 0 1.45602 + ], 1.45603 + 'segoe ui semibold': [ 1.45604 + 1, 1.45605 + 0.25, 1.45606 + 0 1.45607 + ], 1.45608 + 'segoe ui light': [ 1.45609 + 1, 1.45610 + 0.25, 1.45611 + 0 1.45612 + ], 1.45613 + 'segoe ui symbol': [ 1.45614 + 1, 1.45615 + 0.25, 1.45616 + 0 1.45617 + ], 1.45618 + 'shruti': [ 1.45619 + 1.0833, 1.45620 + 0.5, 1.45621 + 0 1.45622 + ], 1.45623 + 'simsun': [ 1.45624 + 0.8333, 1.45625 + 0.1667, 1.45626 + 0 1.45627 + ], 1.45628 + 'nsimsun': [ 1.45629 + 0.8333, 1.45630 + 0.1667, 1.45631 + 0 1.45632 + ], 1.45633 + 'simsun-extb': [ 1.45634 + 0.8333, 1.45635 + 0.1667, 1.45636 + 0 1.45637 + ], 1.45638 + 'sylfaen': [ 1.45639 + 1, 1.45640 + 0.3333, 1.45641 + 0 1.45642 + ], 1.45643 + 'microsoft tai le': [ 1.45644 + 1, 1.45645 + 0.3333, 1.45646 + 0 1.45647 + ], 1.45648 + 'times new roman': [ 1.45649 + 1, 1.45650 + 0.25, 1.45651 + 0 1.45652 + ], 1.45653 + 'times new roman baltic': [ 1.45654 + 1, 1.45655 + 0.25, 1.45656 + 0 1.45657 + ], 1.45658 + 'times new roman ce': [ 1.45659 + 1, 1.45660 + 0.25, 1.45661 + 0 1.45662 + ], 1.45663 + 'times new roman cyr': [ 1.45664 + 1, 1.45665 + 0.25, 1.45666 + 0 1.45667 + ], 1.45668 + 'times new roman greek': [ 1.45669 + 1, 1.45670 + 0.25, 1.45671 + 0 1.45672 + ], 1.45673 + 'times new roman tur': [ 1.45674 + 1, 1.45675 + 0.25, 1.45676 + 0 1.45677 + ], 1.45678 + 'tunga': [ 1.45679 + 1.0833, 1.45680 + 0.75, 1.45681 + 0 1.45682 + ], 1.45683 + 'vrinda': [ 1.45684 + 1, 1.45685 + 0.4167, 1.45686 + 0 1.45687 + ], 1.45688 + 'shonar bangla': [ 1.45689 + 0.8333, 1.45690 + 0.5, 1.45691 + 0 1.45692 + ], 1.45693 + 'microsoft yi baiti': [ 1.45694 + 0.8333, 1.45695 + 0.1667, 1.45696 + 0 1.45697 + ], 1.45698 + 'tahoma': [ 1.45699 + 1, 1.45700 + 0.1667, 1.45701 + 0 1.45702 + ], 1.45703 + 'microsoft sans serif': [ 1.45704 + 1.0833, 1.45705 + 0.1667, 1.45706 + 0 1.45707 + ], 1.45708 + 'angsana new': [ 1.45709 + 0.9167, 1.45710 + 0.4167, 1.45711 + 0 1.45712 + ], 1.45713 + 'aparajita': [ 1.45714 + 0.75, 1.45715 + 0.4167, 1.45716 + 0 1.45717 + ], 1.45718 + 'cordia new': [ 1.45719 + 0.9167, 1.45720 + 0.5, 1.45721 + 0 1.45722 + ], 1.45723 + 'ebrima': [ 1.45724 + 1.0833, 1.45725 + 0.5, 1.45726 + 0 1.45727 + ], 1.45728 + 'gisha': [ 1.45729 + 0.9167, 1.45730 + 0.25, 1.45731 + 0 1.45732 + ], 1.45733 + 'kokila': [ 1.45734 + 0.8333, 1.45735 + 0.3333, 1.45736 + 0 1.45737 + ], 1.45738 + 'leelawadee': [ 1.45739 + 0.9167, 1.45740 + 0.25, 1.45741 + 0 1.45742 + ], 1.45743 + 'microsoft uighur': [ 1.45744 + 1.0833, 1.45745 + 0.5, 1.45746 + 0 1.45747 + ], 1.45748 + 'moolboran': [ 1.45749 + 0.6667, 1.45750 + 0.6667, 1.45751 + 0 1.45752 + ], 1.45753 + 'symbol': [ 1.45754 + 1, 1.45755 + 0.25, 1.45756 + 0 1.45757 + ], 1.45758 + 'utsaah': [ 1.45759 + 0.8333, 1.45760 + 0.4167, 1.45761 + 0 1.45762 + ], 1.45763 + 'vijaya': [ 1.45764 + 1.0833, 1.45765 + 0.25, 1.45766 + 0 1.45767 + ], 1.45768 + 'wingdings': [ 1.45769 + 0.9167, 1.45770 + 0.25, 1.45771 + 0 1.45772 + ], 1.45773 + 'andalus': [ 1.45774 + 1.3333, 1.45775 + 0.4167, 1.45776 + 0 1.45777 + ], 1.45778 + 'arabic typesetting': [ 1.45779 + 0.8333, 1.45780 + 0.5, 1.45781 + 0 1.45782 + ], 1.45783 + 'simplified arabic': [ 1.45784 + 1.3333, 1.45785 + 0.5, 1.45786 + 0 1.45787 + ], 1.45788 + 'simplified arabic fixed': [ 1.45789 + 1, 1.45790 + 0.4167, 1.45791 + 0 1.45792 + ], 1.45793 + 'sakkal majalla': [ 1.45794 + 0.9167, 1.45795 + 0.5, 1.45796 + 0 1.45797 + ], 1.45798 + 'traditional arabic': [ 1.45799 + 1.3333, 1.45800 + 0.5, 1.45801 + 0 1.45802 + ], 1.45803 + 'aharoni': [ 1.45804 + 0.75, 1.45805 + 0.25, 1.45806 + 0 1.45807 + ], 1.45808 + 'david': [ 1.45809 + 0.75, 1.45810 + 0.25, 1.45811 + 0 1.45812 + ], 1.45813 + 'frankruehl': [ 1.45814 + 0.75, 1.45815 + 0.25, 1.45816 + 0 1.45817 + ], 1.45818 + 'fangsong': [ 1.45819 + 0.8333, 1.45820 + 0.1667, 1.45821 + 0 1.45822 + ], 1.45823 + 'simhei': [ 1.45824 + 0.8333, 1.45825 + 0.1667, 1.45826 + 0 1.45827 + ], 1.45828 + 'kaiti': [ 1.45829 + 0.8333, 1.45830 + 0.1667, 1.45831 + 0 1.45832 + ], 1.45833 + 'browallia new': [ 1.45834 + 0.8333, 1.45835 + 0.4167, 1.45836 + 0 1.45837 + ], 1.45838 + 'lucida sans unicode': [ 1.45839 + 1.0833, 1.45840 + 0.25, 1.45841 + 0 1.45842 + ], 1.45843 + 'arial black': [ 1.45844 + 1.0833, 1.45845 + 0.3333, 1.45846 + 0 1.45847 + ], 1.45848 + 'calibri': [ 1.45849 + 0.9167, 1.45850 + 0.25, 1.45851 + 0 1.45852 + ], 1.45853 + 'cambria': [ 1.45854 + 0.9167, 1.45855 + 0.25, 1.45856 + 0 1.45857 + ], 1.45858 + 'cambria math': [ 1.45859 + 3.0833, 1.45860 + 2.5, 1.45861 + 0 1.45862 + ], 1.45863 + 'candara': [ 1.45864 + 0.9167, 1.45865 + 0.25, 1.45866 + 0 1.45867 + ], 1.45868 + 'comic sans ms': [ 1.45869 + 1.0833, 1.45870 + 0.3333, 1.45871 + 0 1.45872 + ], 1.45873 + 'consolas': [ 1.45874 + 0.9167, 1.45875 + 0.25, 1.45876 + 0 1.45877 + ], 1.45878 + 'constantia': [ 1.45879 + 0.9167, 1.45880 + 0.25, 1.45881 + 0 1.45882 + ], 1.45883 + 'corbel': [ 1.45884 + 0.9167, 1.45885 + 0.25, 1.45886 + 0 1.45887 + ], 1.45888 + 'franklin gothic medium': [ 1.45889 + 1, 1.45890 + 0.3333, 1.45891 + 0 1.45892 + ], 1.45893 + 'gabriola': [ 1.45894 + 1.1667, 1.45895 + 0.6667, 1.45896 + 0 1.45897 + ], 1.45898 + 'georgia': [ 1.45899 + 1, 1.45900 + 0.25, 1.45901 + 0 1.45902 + ], 1.45903 + 'palatino linotype': [ 1.45904 + 1.0833, 1.45905 + 0.3333, 1.45906 + 0 1.45907 + ], 1.45908 + 'segoe print': [ 1.45909 + 1.25, 1.45910 + 0.5, 1.45911 + 0 1.45912 + ], 1.45913 + 'trebuchet ms': [ 1.45914 + 1.0833, 1.45915 + 0.4167, 1.45916 + 0 1.45917 + ], 1.45918 + 'verdana': [ 1.45919 + 1, 1.45920 + 0.1667, 1.45921 + 0 1.45922 + ], 1.45923 + 'webdings': [ 1.45924 + 1.0833, 1.45925 + 0.5, 1.45926 + 0 1.45927 + ], 1.45928 + 'lucida bright': [ 1.45929 + 0.9167, 1.45930 + 0.25, 1.45931 + 0 1.45932 + ], 1.45933 + 'lucida sans': [ 1.45934 + 0.9167, 1.45935 + 0.25, 1.45936 + 0 1.45937 + ], 1.45938 + 'lucida sans typewriter': [ 1.45939 + 0.9167, 1.45940 + 0.25, 1.45941 + 0 1.45942 + ], 1.45943 + 'gentium basic': [ 1.45944 + 0.8333, 1.45945 + 0.25, 1.45946 + 0 1.45947 + ], 1.45948 + 'dejavu serif condensed': [ 1.45949 + 0.9167, 1.45950 + 0.25, 1.45951 + 0 1.45952 + ], 1.45953 + 'arimo': [ 1.45954 + 1, 1.45955 + 0.25, 1.45956 + 0 1.45957 + ], 1.45958 + 'dejavu sans condensed': [ 1.45959 + 0.9167, 1.45960 + 0.25, 1.45961 + 0 1.45962 + ], 1.45963 + 'dejavu sans': [ 1.45964 + 0.9167, 1.45965 + 0.25, 1.45966 + 0 1.45967 + ], 1.45968 + 'dejavu sans light': [ 1.45969 + 0.9167, 1.45970 + 0.25, 1.45971 + 0 1.45972 + ], 1.45973 + 'opensymbol': [ 1.45974 + 0.8333, 1.45975 + 0.1667, 1.45976 + 0 1.45977 + ], 1.45978 + 'gentium book basic': [ 1.45979 + 0.8333, 1.45980 + 0.25, 1.45981 + 0 1.45982 + ], 1.45983 + 'dejavu sans mono': [ 1.45984 + 0.9167, 1.45985 + 0.25, 1.45986 + 0 1.45987 + ], 1.45988 + 'dejavu serif': [ 1.45989 + 0.9167, 1.45990 + 0.25, 1.45991 + 0 1.45992 + ], 1.45993 + 'calibri light': [ 1.45994 + 0.9167, 1.45995 + 0.25, 1.45996 + 0 1.45997 + ] 1.45998 + }; 1.45999 + var DEVICE_FONT_METRICS_MAC = { 1.46000 + 'al bayan plain': [ 1.46001 + 1, 1.46002 + 0.5, 1.46003 + 0 1.46004 + ], 1.46005 + 'al bayan bold': [ 1.46006 + 1, 1.46007 + 0.5833, 1.46008 + 0 1.46009 + ], 1.46010 + 'american typewriter': [ 1.46011 + 0.9167, 1.46012 + 0.25, 1.46013 + 0 1.46014 + ], 1.46015 + 'american typewriter bold': [ 1.46016 + 0.9167, 1.46017 + 0.25, 1.46018 + 0 1.46019 + ], 1.46020 + 'american typewriter condensed': [ 1.46021 + 0.9167, 1.46022 + 0.25, 1.46023 + 0 1.46024 + ], 1.46025 + 'american typewriter condensed bold': [ 1.46026 + 0.9167, 1.46027 + 0.25, 1.46028 + 0 1.46029 + ], 1.46030 + 'american typewriter condensed light': [ 1.46031 + 0.8333, 1.46032 + 0.25, 1.46033 + 0 1.46034 + ], 1.46035 + 'american typewriter light': [ 1.46036 + 0.9167, 1.46037 + 0.25, 1.46038 + 0 1.46039 + ], 1.46040 + 'andale mono': [ 1.46041 + 0.9167, 1.46042 + 0.25, 1.46043 + 0 1.46044 + ], 1.46045 + 'apple symbols': [ 1.46046 + 0.6667, 1.46047 + 0.25, 1.46048 + 0 1.46049 + ], 1.46050 + 'arial bold italic': [ 1.46051 + 0.9167, 1.46052 + 0.25, 1.46053 + 0 1.46054 + ], 1.46055 + 'arial bold': [ 1.46056 + 0.9167, 1.46057 + 0.25, 1.46058 + 0 1.46059 + ], 1.46060 + 'arial italic': [ 1.46061 + 0.9167, 1.46062 + 0.25, 1.46063 + 0 1.46064 + ], 1.46065 + 'arial hebrew': [ 1.46066 + 0.75, 1.46067 + 0.3333, 1.46068 + 0 1.46069 + ], 1.46070 + 'arial hebrew bold': [ 1.46071 + 0.75, 1.46072 + 0.3333, 1.46073 + 0 1.46074 + ], 1.46075 + 'arial': [ 1.46076 + 0.9167, 1.46077 + 0.25, 1.46078 + 0 1.46079 + ], 1.46080 + 'arial narrow': [ 1.46081 + 0.9167, 1.46082 + 0.25, 1.46083 + 0 1.46084 + ], 1.46085 + 'arial narrow bold': [ 1.46086 + 0.9167, 1.46087 + 0.25, 1.46088 + 0 1.46089 + ], 1.46090 + 'arial narrow bold italic': [ 1.46091 + 0.9167, 1.46092 + 0.25, 1.46093 + 0 1.46094 + ], 1.46095 + 'arial narrow italic': [ 1.46096 + 0.9167, 1.46097 + 0.25, 1.46098 + 0 1.46099 + ], 1.46100 + 'arial rounded mt bold': [ 1.46101 + 0.9167, 1.46102 + 0.25, 1.46103 + 0 1.46104 + ], 1.46105 + 'arial unicode ms': [ 1.46106 + 1.0833, 1.46107 + 0.25, 1.46108 + 0 1.46109 + ], 1.46110 + 'avenir black': [ 1.46111 + 1, 1.46112 + 0.3333, 1.46113 + 0 1.46114 + ], 1.46115 + 'avenir black oblique': [ 1.46116 + 1, 1.46117 + 0.3333, 1.46118 + 0 1.46119 + ], 1.46120 + 'avenir book': [ 1.46121 + 1, 1.46122 + 0.3333, 1.46123 + 0 1.46124 + ], 1.46125 + 'avenir book oblique': [ 1.46126 + 1, 1.46127 + 0.3333, 1.46128 + 0 1.46129 + ], 1.46130 + 'avenir heavy': [ 1.46131 + 1, 1.46132 + 0.3333, 1.46133 + 0 1.46134 + ], 1.46135 + 'avenir heavy oblique': [ 1.46136 + 1, 1.46137 + 0.3333, 1.46138 + 0 1.46139 + ], 1.46140 + 'avenir light': [ 1.46141 + 1, 1.46142 + 0.3333, 1.46143 + 0 1.46144 + ], 1.46145 + 'avenir light oblique': [ 1.46146 + 1, 1.46147 + 0.3333, 1.46148 + 0 1.46149 + ], 1.46150 + 'avenir medium': [ 1.46151 + 1, 1.46152 + 0.3333, 1.46153 + 0 1.46154 + ], 1.46155 + 'avenir medium oblique': [ 1.46156 + 1, 1.46157 + 0.3333, 1.46158 + 0 1.46159 + ], 1.46160 + 'avenir oblique': [ 1.46161 + 1, 1.46162 + 0.3333, 1.46163 + 0 1.46164 + ], 1.46165 + 'avenir roman': [ 1.46166 + 1, 1.46167 + 0.3333, 1.46168 + 0 1.46169 + ], 1.46170 + 'avenir next bold': [ 1.46171 + 1, 1.46172 + 0.3333, 1.46173 + 0 1.46174 + ], 1.46175 + 'avenir next bold italic': [ 1.46176 + 1, 1.46177 + 0.3333, 1.46178 + 0 1.46179 + ], 1.46180 + 'avenir next demi bold': [ 1.46181 + 1, 1.46182 + 0.3333, 1.46183 + 0 1.46184 + ], 1.46185 + 'avenir next demi bold italic': [ 1.46186 + 1, 1.46187 + 0.3333, 1.46188 + 0 1.46189 + ], 1.46190 + 'avenir next heavy': [ 1.46191 + 1, 1.46192 + 0.3333, 1.46193 + 0 1.46194 + ], 1.46195 + 'avenir next heavy italic': [ 1.46196 + 1, 1.46197 + 0.3333, 1.46198 + 0 1.46199 + ], 1.46200 + 'avenir next italic': [ 1.46201 + 1, 1.46202 + 0.3333, 1.46203 + 0 1.46204 + ], 1.46205 + 'avenir next medium': [ 1.46206 + 1, 1.46207 + 0.3333, 1.46208 + 0 1.46209 + ], 1.46210 + 'avenir next medium italic': [ 1.46211 + 1, 1.46212 + 0.3333, 1.46213 + 0 1.46214 + ], 1.46215 + 'avenir next regular': [ 1.46216 + 1, 1.46217 + 0.3333, 1.46218 + 0 1.46219 + ], 1.46220 + 'avenir next ultra light': [ 1.46221 + 1, 1.46222 + 0.3333, 1.46223 + 0 1.46224 + ], 1.46225 + 'avenir next ultra light italic': [ 1.46226 + 1, 1.46227 + 0.3333, 1.46228 + 0 1.46229 + ], 1.46230 + 'avenir next condensed bold': [ 1.46231 + 1, 1.46232 + 0.3333, 1.46233 + 0 1.46234 + ], 1.46235 + 'avenir next condensed bold italic': [ 1.46236 + 1, 1.46237 + 0.3333, 1.46238 + 0 1.46239 + ], 1.46240 + 'avenir next condensed demi bold': [ 1.46241 + 1, 1.46242 + 0.3333, 1.46243 + 0 1.46244 + ], 1.46245 + 'avenir next condensed demi bold italic': [ 1.46246 + 1, 1.46247 + 0.3333, 1.46248 + 0 1.46249 + ], 1.46250 + 'avenir next condensed heavy': [ 1.46251 + 1, 1.46252 + 0.3333, 1.46253 + 0 1.46254 + ], 1.46255 + 'avenir next condensed heavy italic': [ 1.46256 + 1, 1.46257 + 0.3333, 1.46258 + 0 1.46259 + ], 1.46260 + 'avenir next condensed italic': [ 1.46261 + 1, 1.46262 + 0.3333, 1.46263 + 0 1.46264 + ], 1.46265 + 'avenir next condensed medium': [ 1.46266 + 1, 1.46267 + 0.3333, 1.46268 + 0 1.46269 + ], 1.46270 + 'avenir next condensed medium italic': [ 1.46271 + 1, 1.46272 + 0.3333, 1.46273 + 0 1.46274 + ], 1.46275 + 'avenir next condensed regular': [ 1.46276 + 1, 1.46277 + 0.3333, 1.46278 + 0 1.46279 + ], 1.46280 + 'avenir next condensed ultra light': [ 1.46281 + 1, 1.46282 + 0.3333, 1.46283 + 0 1.46284 + ], 1.46285 + 'avenir next condensed ultra light italic': [ 1.46286 + 1, 1.46287 + 0.3333, 1.46288 + 0 1.46289 + ], 1.46290 + 'ayuthaya': [ 1.46291 + 1.0833, 1.46292 + 0.3333, 1.46293 + 0 1.46294 + ], 1.46295 + 'baghdad': [ 1.46296 + 0.9167, 1.46297 + 0.4167, 1.46298 + 0 1.46299 + ], 1.46300 + 'bangla mn': [ 1.46301 + 0.9167, 1.46302 + 0.6667, 1.46303 + 0 1.46304 + ], 1.46305 + 'bangla mn bold': [ 1.46306 + 0.9167, 1.46307 + 0.6667, 1.46308 + 0 1.46309 + ], 1.46310 + 'bangla sangam mn': [ 1.46311 + 0.9167, 1.46312 + 0.4167, 1.46313 + 0 1.46314 + ], 1.46315 + 'bangla sangam mn bold': [ 1.46316 + 0.9167, 1.46317 + 0.4167, 1.46318 + 0 1.46319 + ], 1.46320 + 'baskerville': [ 1.46321 + 0.9167, 1.46322 + 0.25, 1.46323 + 0 1.46324 + ], 1.46325 + 'baskerville bold': [ 1.46326 + 0.9167, 1.46327 + 0.25, 1.46328 + 0 1.46329 + ], 1.46330 + 'baskerville bold italic': [ 1.46331 + 0.9167, 1.46332 + 0.25, 1.46333 + 0 1.46334 + ], 1.46335 + 'baskerville italic': [ 1.46336 + 0.9167, 1.46337 + 0.25, 1.46338 + 0 1.46339 + ], 1.46340 + 'baskerville semibold': [ 1.46341 + 0.9167, 1.46342 + 0.25, 1.46343 + 0 1.46344 + ], 1.46345 + 'baskerville semibold italic': [ 1.46346 + 0.9167, 1.46347 + 0.25, 1.46348 + 0 1.46349 + ], 1.46350 + 'big caslon medium': [ 1.46351 + 0.9167, 1.46352 + 0.25, 1.46353 + 0 1.46354 + ], 1.46355 + 'brush script mt italic': [ 1.46356 + 0.9167, 1.46357 + 0.3333, 1.46358 + 0 1.46359 + ], 1.46360 + 'chalkboard': [ 1.46361 + 1, 1.46362 + 0.25, 1.46363 + 0 1.46364 + ], 1.46365 + 'chalkboard bold': [ 1.46366 + 1, 1.46367 + 0.25, 1.46368 + 0 1.46369 + ], 1.46370 + 'chalkboard se bold': [ 1.46371 + 1.1667, 1.46372 + 0.25, 1.46373 + 0 1.46374 + ], 1.46375 + 'chalkboard se light': [ 1.46376 + 1.1667, 1.46377 + 0.25, 1.46378 + 0 1.46379 + ], 1.46380 + 'chalkboard se regular': [ 1.46381 + 1.1667, 1.46382 + 0.25, 1.46383 + 0 1.46384 + ], 1.46385 + 'chalkduster': [ 1.46386 + 1, 1.46387 + 0.25, 1.46388 + 0 1.46389 + ], 1.46390 + 'charcoal cy': [ 1.46391 + 1, 1.46392 + 0.25, 1.46393 + 0 1.46394 + ], 1.46395 + 'cochin': [ 1.46396 + 0.9167, 1.46397 + 0.25, 1.46398 + 0 1.46399 + ], 1.46400 + 'cochin bold': [ 1.46401 + 0.9167, 1.46402 + 0.25, 1.46403 + 0 1.46404 + ], 1.46405 + 'cochin bold italic': [ 1.46406 + 0.9167, 1.46407 + 0.25, 1.46408 + 0 1.46409 + ], 1.46410 + 'cochin italic': [ 1.46411 + 0.9167, 1.46412 + 0.25, 1.46413 + 0 1.46414 + ], 1.46415 + 'comic sans ms': [ 1.46416 + 1.0833, 1.46417 + 0.25, 1.46418 + 0 1.46419 + ], 1.46420 + 'comic sans ms bold': [ 1.46421 + 1.0833, 1.46422 + 0.25, 1.46423 + 0 1.46424 + ], 1.46425 + 'copperplate': [ 1.46426 + 0.75, 1.46427 + 0.25, 1.46428 + 0 1.46429 + ], 1.46430 + 'copperplate bold': [ 1.46431 + 0.75, 1.46432 + 0.25, 1.46433 + 0 1.46434 + ], 1.46435 + 'copperplate light': [ 1.46436 + 0.75, 1.46437 + 0.25, 1.46438 + 0 1.46439 + ], 1.46440 + 'corsiva hebrew': [ 1.46441 + 0.6667, 1.46442 + 0.3333, 1.46443 + 0 1.46444 + ], 1.46445 + 'corsiva hebrew bold': [ 1.46446 + 0.6667, 1.46447 + 0.3333, 1.46448 + 0 1.46449 + ], 1.46450 + 'courier': [ 1.46451 + 0.75, 1.46452 + 0.25, 1.46453 + 0 1.46454 + ], 1.46455 + 'courier bold': [ 1.46456 + 0.75, 1.46457 + 0.25, 1.46458 + 0 1.46459 + ], 1.46460 + 'courier bold oblique': [ 1.46461 + 0.75, 1.46462 + 0.25, 1.46463 + 0 1.46464 + ], 1.46465 + 'courier oblique': [ 1.46466 + 0.75, 1.46467 + 0.25, 1.46468 + 0 1.46469 + ], 1.46470 + 'courier new bold italic': [ 1.46471 + 0.8333, 1.46472 + 0.3333, 1.46473 + 0 1.46474 + ], 1.46475 + 'courier new bold': [ 1.46476 + 0.8333, 1.46477 + 0.3333, 1.46478 + 0 1.46479 + ], 1.46480 + 'courier new italic': [ 1.46481 + 0.8333, 1.46482 + 0.3333, 1.46483 + 0 1.46484 + ], 1.46485 + 'courier new': [ 1.46486 + 0.8333, 1.46487 + 0.3333, 1.46488 + 0 1.46489 + ], 1.46490 + 'biaukai': [ 1.46491 + 0.8333, 1.46492 + 0.1667, 1.46493 + 0 1.46494 + ], 1.46495 + 'damascus': [ 1.46496 + 0.5833, 1.46497 + 0.4167, 1.46498 + 0 1.46499 + ], 1.46500 + 'damascus bold': [ 1.46501 + 0.5833, 1.46502 + 0.4167, 1.46503 + 0 1.46504 + ], 1.46505 + 'decotype naskh': [ 1.46506 + 1.1667, 1.46507 + 0.6667, 1.46508 + 0 1.46509 + ], 1.46510 + 'devanagari mt': [ 1.46511 + 0.9167, 1.46512 + 0.6667, 1.46513 + 0 1.46514 + ], 1.46515 + 'devanagari mt bold': [ 1.46516 + 0.9167, 1.46517 + 0.6667, 1.46518 + 0 1.46519 + ], 1.46520 + 'devanagari sangam mn': [ 1.46521 + 0.9167, 1.46522 + 0.4167, 1.46523 + 0 1.46524 + ], 1.46525 + 'devanagari sangam mn bold': [ 1.46526 + 0.9167, 1.46527 + 0.4167, 1.46528 + 0 1.46529 + ], 1.46530 + 'didot': [ 1.46531 + 0.9167, 1.46532 + 0.3333, 1.46533 + 0 1.46534 + ], 1.46535 + 'didot bold': [ 1.46536 + 1, 1.46537 + 0.3333, 1.46538 + 0 1.46539 + ], 1.46540 + 'didot italic': [ 1.46541 + 0.9167, 1.46542 + 0.25, 1.46543 + 0 1.46544 + ], 1.46545 + 'euphemia ucas': [ 1.46546 + 1.0833, 1.46547 + 0.25, 1.46548 + 0 1.46549 + ], 1.46550 + 'euphemia ucas bold': [ 1.46551 + 1.0833, 1.46552 + 0.25, 1.46553 + 0 1.46554 + ], 1.46555 + 'euphemia ucas italic': [ 1.46556 + 1.0833, 1.46557 + 0.25, 1.46558 + 0 1.46559 + ], 1.46560 + 'futura condensed extrabold': [ 1.46561 + 1, 1.46562 + 0.25, 1.46563 + 0 1.46564 + ], 1.46565 + 'futura condensed medium': [ 1.46566 + 1, 1.46567 + 0.25, 1.46568 + 0 1.46569 + ], 1.46570 + 'futura medium': [ 1.46571 + 1, 1.46572 + 0.25, 1.46573 + 0 1.46574 + ], 1.46575 + 'futura medium italic': [ 1.46576 + 1, 1.46577 + 0.25, 1.46578 + 0 1.46579 + ], 1.46580 + 'gb18030 bitmap': [ 1.46581 + 1, 1.46582 + 0.6667, 1.46583 + 0 1.46584 + ], 1.46585 + 'geeza pro': [ 1.46586 + 0.9167, 1.46587 + 0.3333, 1.46588 + 0 1.46589 + ], 1.46590 + 'geeza pro bold': [ 1.46591 + 0.9167, 1.46592 + 0.3333, 1.46593 + 0 1.46594 + ], 1.46595 + 'geneva': [ 1.46596 + 1, 1.46597 + 0.25, 1.46598 + 0 1.46599 + ], 1.46600 + 'geneva cy': [ 1.46601 + 1, 1.46602 + 0.25, 1.46603 + 0 1.46604 + ], 1.46605 + 'georgia': [ 1.46606 + 0.9167, 1.46607 + 0.25, 1.46608 + 0 1.46609 + ], 1.46610 + 'georgia bold': [ 1.46611 + 0.9167, 1.46612 + 0.25, 1.46613 + 0 1.46614 + ], 1.46615 + 'georgia bold italic': [ 1.46616 + 0.9167, 1.46617 + 0.25, 1.46618 + 0 1.46619 + ], 1.46620 + 'georgia italic': [ 1.46621 + 0.9167, 1.46622 + 0.25, 1.46623 + 0 1.46624 + ], 1.46625 + 'gill sans': [ 1.46626 + 0.9167, 1.46627 + 0.25, 1.46628 + 0 1.46629 + ], 1.46630 + 'gill sans bold': [ 1.46631 + 0.9167, 1.46632 + 0.25, 1.46633 + 0 1.46634 + ], 1.46635 + 'gill sans bold italic': [ 1.46636 + 0.9167, 1.46637 + 0.25, 1.46638 + 0 1.46639 + ], 1.46640 + 'gill sans italic': [ 1.46641 + 0.9167, 1.46642 + 0.25, 1.46643 + 0 1.46644 + ], 1.46645 + 'gill sans light': [ 1.46646 + 0.9167, 1.46647 + 0.25, 1.46648 + 0 1.46649 + ], 1.46650 + 'gill sans light italic': [ 1.46651 + 0.9167, 1.46652 + 0.25, 1.46653 + 0 1.46654 + ], 1.46655 + 'gujarati mt': [ 1.46656 + 0.9167, 1.46657 + 0.6667, 1.46658 + 0 1.46659 + ], 1.46660 + 'gujarati mt bold': [ 1.46661 + 0.9167, 1.46662 + 0.6667, 1.46663 + 0 1.46664 + ], 1.46665 + 'gujarati sangam mn': [ 1.46666 + 0.8333, 1.46667 + 0.4167, 1.46668 + 0 1.46669 + ], 1.46670 + 'gujarati sangam mn bold': [ 1.46671 + 0.8333, 1.46672 + 0.4167, 1.46673 + 0 1.46674 + ], 1.46675 + 'gurmukhi mn': [ 1.46676 + 0.9167, 1.46677 + 0.25, 1.46678 + 0 1.46679 + ], 1.46680 + 'gurmukhi mn bold': [ 1.46681 + 0.9167, 1.46682 + 0.25, 1.46683 + 0 1.46684 + ], 1.46685 + 'gurmukhi sangam mn': [ 1.46686 + 0.9167, 1.46687 + 0.3333, 1.46688 + 0 1.46689 + ], 1.46690 + 'gurmukhi sangam mn bold': [ 1.46691 + 0.9167, 1.46692 + 0.3333, 1.46693 + 0 1.46694 + ], 1.46695 + 'helvetica': [ 1.46696 + 0.75, 1.46697 + 0.25, 1.46698 + 0 1.46699 + ], 1.46700 + 'helvetica bold': [ 1.46701 + 0.75, 1.46702 + 0.25, 1.46703 + 0 1.46704 + ], 1.46705 + 'helvetica bold oblique': [ 1.46706 + 0.75, 1.46707 + 0.25, 1.46708 + 0 1.46709 + ], 1.46710 + 'helvetica light': [ 1.46711 + 0.75, 1.46712 + 0.25, 1.46713 + 0 1.46714 + ], 1.46715 + 'helvetica light oblique': [ 1.46716 + 0.75, 1.46717 + 0.25, 1.46718 + 0 1.46719 + ], 1.46720 + 'helvetica oblique': [ 1.46721 + 0.75, 1.46722 + 0.25, 1.46723 + 0 1.46724 + ], 1.46725 + 'helvetica neue': [ 1.46726 + 0.9167, 1.46727 + 0.25, 1.46728 + 0 1.46729 + ], 1.46730 + 'helvetica neue bold': [ 1.46731 + 1, 1.46732 + 0.25, 1.46733 + 0 1.46734 + ], 1.46735 + 'helvetica neue bold italic': [ 1.46736 + 1, 1.46737 + 0.25, 1.46738 + 0 1.46739 + ], 1.46740 + 'helvetica neue condensed black': [ 1.46741 + 1, 1.46742 + 0.25, 1.46743 + 0 1.46744 + ], 1.46745 + 'helvetica neue condensed bold': [ 1.46746 + 1, 1.46747 + 0.25, 1.46748 + 0 1.46749 + ], 1.46750 + 'helvetica neue italic': [ 1.46751 + 0.9167, 1.46752 + 0.25, 1.46753 + 0 1.46754 + ], 1.46755 + 'helvetica neue light': [ 1.46756 + 1, 1.46757 + 0.25, 1.46758 + 0 1.46759 + ], 1.46760 + 'helvetica neue light italic': [ 1.46761 + 0.9167, 1.46762 + 0.25, 1.46763 + 0 1.46764 + ], 1.46765 + 'helvetica neue medium': [ 1.46766 + 1, 1.46767 + 0.25, 1.46768 + 0 1.46769 + ], 1.46770 + 'helvetica neue ultralight': [ 1.46771 + 0.9167, 1.46772 + 0.25, 1.46773 + 0 1.46774 + ], 1.46775 + 'helvetica neue ultralight italic': [ 1.46776 + 0.9167, 1.46777 + 0.25, 1.46778 + 0 1.46779 + ], 1.46780 + 'herculanum': [ 1.46781 + 0.8333, 1.46782 + 0.1667, 1.46783 + 0 1.46784 + ], 1.46785 + 'hiragino kaku gothic pro w3': [ 1.46786 + 0.9167, 1.46787 + 0.0833, 1.46788 + 0 1.46789 + ], 1.46790 + 'hiragino kaku gothic pro w6': [ 1.46791 + 0.9167, 1.46792 + 0.0833, 1.46793 + 0 1.46794 + ], 1.46795 + 'hiragino kaku gothic pron w3': [ 1.46796 + 0.9167, 1.46797 + 0.0833, 1.46798 + 0 1.46799 + ], 1.46800 + 'hiragino kaku gothic pron w6': [ 1.46801 + 0.9167, 1.46802 + 0.0833, 1.46803 + 0 1.46804 + ], 1.46805 + 'hiragino kaku gothic std w8': [ 1.46806 + 0.9167, 1.46807 + 0.0833, 1.46808 + 0 1.46809 + ], 1.46810 + 'hiragino kaku gothic stdn w8': [ 1.46811 + 0.9167, 1.46812 + 0.0833, 1.46813 + 0 1.46814 + ], 1.46815 + 'hiragino maru gothic pro w4': [ 1.46816 + 0.9167, 1.46817 + 0.0833, 1.46818 + 0 1.46819 + ], 1.46820 + 'hiragino maru gothic pron w4': [ 1.46821 + 0.9167, 1.46822 + 0.0833, 1.46823 + 0 1.46824 + ], 1.46825 + 'hiragino mincho pro w3': [ 1.46826 + 0.9167, 1.46827 + 0.0833, 1.46828 + 0 1.46829 + ], 1.46830 + 'hiragino mincho pro w6': [ 1.46831 + 0.9167, 1.46832 + 0.0833, 1.46833 + 0 1.46834 + ], 1.46835 + 'hiragino mincho pron w3': [ 1.46836 + 0.9167, 1.46837 + 0.0833, 1.46838 + 0 1.46839 + ], 1.46840 + 'hiragino mincho pron w6': [ 1.46841 + 0.9167, 1.46842 + 0.0833, 1.46843 + 0 1.46844 + ], 1.46845 + 'hiragino sans gb w3': [ 1.46846 + 0.9167, 1.46847 + 0.0833, 1.46848 + 0 1.46849 + ], 1.46850 + 'hiragino sans gb w6': [ 1.46851 + 0.9167, 1.46852 + 0.0833, 1.46853 + 0 1.46854 + ], 1.46855 + 'hoefler text black': [ 1.46856 + 0.75, 1.46857 + 0.25, 1.46858 + 0 1.46859 + ], 1.46860 + 'hoefler text black italic': [ 1.46861 + 0.75, 1.46862 + 0.25, 1.46863 + 0 1.46864 + ], 1.46865 + 'hoefler text italic': [ 1.46866 + 0.75, 1.46867 + 0.25, 1.46868 + 0 1.46869 + ], 1.46870 + 'hoefler text ornaments': [ 1.46871 + 0.8333, 1.46872 + 0.1667, 1.46873 + 0 1.46874 + ], 1.46875 + 'hoefler text': [ 1.46876 + 0.75, 1.46877 + 0.25, 1.46878 + 0 1.46879 + ], 1.46880 + 'impact': [ 1.46881 + 1, 1.46882 + 0.25, 1.46883 + 0 1.46884 + ], 1.46885 + 'inaimathi': [ 1.46886 + 0.8333, 1.46887 + 0.4167, 1.46888 + 0 1.46889 + ], 1.46890 + 'headlinea regular': [ 1.46891 + 0.8333, 1.46892 + 0.1667, 1.46893 + 0 1.46894 + ], 1.46895 + 'pilgi regular': [ 1.46896 + 0.8333, 1.46897 + 0.25, 1.46898 + 0 1.46899 + ], 1.46900 + 'gungseo regular': [ 1.46901 + 0.8333, 1.46902 + 0.25, 1.46903 + 0 1.46904 + ], 1.46905 + 'pcmyungjo regular': [ 1.46906 + 0.8333, 1.46907 + 0.25, 1.46908 + 0 1.46909 + ], 1.46910 + 'kailasa regular': [ 1.46911 + 1.0833, 1.46912 + 0.5833, 1.46913 + 0 1.46914 + ], 1.46915 + 'kannada mn': [ 1.46916 + 0.9167, 1.46917 + 0.25, 1.46918 + 0 1.46919 + ], 1.46920 + 'kannada mn bold': [ 1.46921 + 0.9167, 1.46922 + 0.25, 1.46923 + 0 1.46924 + ], 1.46925 + 'kannada sangam mn': [ 1.46926 + 1, 1.46927 + 0.5833, 1.46928 + 0 1.46929 + ], 1.46930 + 'kannada sangam mn bold': [ 1.46931 + 1, 1.46932 + 0.5833, 1.46933 + 0 1.46934 + ], 1.46935 + 'kefa bold': [ 1.46936 + 0.9167, 1.46937 + 0.25, 1.46938 + 0 1.46939 + ], 1.46940 + 'kefa regular': [ 1.46941 + 0.9167, 1.46942 + 0.25, 1.46943 + 0 1.46944 + ], 1.46945 + 'khmer mn': [ 1.46946 + 1, 1.46947 + 0.6667, 1.46948 + 0 1.46949 + ], 1.46950 + 'khmer mn bold': [ 1.46951 + 1, 1.46952 + 0.6667, 1.46953 + 0 1.46954 + ], 1.46955 + 'khmer sangam mn': [ 1.46956 + 1.0833, 1.46957 + 0.6667, 1.46958 + 0 1.46959 + ], 1.46960 + 'kokonor regular': [ 1.46961 + 1.0833, 1.46962 + 0.5833, 1.46963 + 0 1.46964 + ], 1.46965 + 'krungthep': [ 1.46966 + 1, 1.46967 + 0.25, 1.46968 + 0 1.46969 + ], 1.46970 + 'kufistandardgk': [ 1.46971 + 0.9167, 1.46972 + 0.5, 1.46973 + 0 1.46974 + ], 1.46975 + 'lao mn': [ 1.46976 + 0.9167, 1.46977 + 0.4167, 1.46978 + 0 1.46979 + ], 1.46980 + 'lao mn bold': [ 1.46981 + 0.9167, 1.46982 + 0.4167, 1.46983 + 0 1.46984 + ], 1.46985 + 'lao sangam mn': [ 1.46986 + 1, 1.46987 + 0.3333, 1.46988 + 0 1.46989 + ], 1.46990 + 'apple ligothic medium': [ 1.46991 + 0.8333, 1.46992 + 0.1667, 1.46993 + 0 1.46994 + ], 1.46995 + 'lihei pro': [ 1.46996 + 0.8333, 1.46997 + 0.1667, 1.46998 + 0 1.46999 + ], 1.47000 + 'lisong pro': [ 1.47001 + 0.8333, 1.47002 + 0.1667, 1.47003 + 0 1.47004 + ], 1.47005 + 'lucida grande': [ 1.47006 + 1, 1.47007 + 0.25, 1.47008 + 0 1.47009 + ], 1.47010 + 'lucida grande bold': [ 1.47011 + 1, 1.47012 + 0.25, 1.47013 + 0 1.47014 + ], 1.47015 + 'malayalam mn': [ 1.47016 + 1, 1.47017 + 0.4167, 1.47018 + 0 1.47019 + ], 1.47020 + 'malayalam mn bold': [ 1.47021 + 1, 1.47022 + 0.4167, 1.47023 + 0 1.47024 + ], 1.47025 + 'malayalam sangam mn': [ 1.47026 + 0.8333, 1.47027 + 0.4167, 1.47028 + 0 1.47029 + ], 1.47030 + 'malayalam sangam mn bold': [ 1.47031 + 0.8333, 1.47032 + 0.4167, 1.47033 + 0 1.47034 + ], 1.47035 + 'marion bold': [ 1.47036 + 0.6667, 1.47037 + 0.3333, 1.47038 + 0 1.47039 + ], 1.47040 + 'marion italic': [ 1.47041 + 0.6667, 1.47042 + 0.3333, 1.47043 + 0 1.47044 + ], 1.47045 + 'marion regular': [ 1.47046 + 0.6667, 1.47047 + 0.3333, 1.47048 + 0 1.47049 + ], 1.47050 + 'marker felt thin': [ 1.47051 + 0.8333, 1.47052 + 0.25, 1.47053 + 0 1.47054 + ], 1.47055 + 'marker felt wide': [ 1.47056 + 0.9167, 1.47057 + 0.25, 1.47058 + 0 1.47059 + ], 1.47060 + 'menlo bold': [ 1.47061 + 0.9167, 1.47062 + 0.25, 1.47063 + 0 1.47064 + ], 1.47065 + 'menlo bold italic': [ 1.47066 + 0.9167, 1.47067 + 0.25, 1.47068 + 0 1.47069 + ], 1.47070 + 'menlo italic': [ 1.47071 + 0.9167, 1.47072 + 0.25, 1.47073 + 0 1.47074 + ], 1.47075 + 'menlo regular': [ 1.47076 + 0.9167, 1.47077 + 0.25, 1.47078 + 0 1.47079 + ], 1.47080 + 'microsoft sans serif': [ 1.47081 + 0.9167, 1.47082 + 0.25, 1.47083 + 0 1.47084 + ], 1.47085 + 'monaco': [ 1.47086 + 1, 1.47087 + 0.25, 1.47088 + 0 1.47089 + ], 1.47090 + 'gurmukhi mt': [ 1.47091 + 0.8333, 1.47092 + 0.4167, 1.47093 + 0 1.47094 + ], 1.47095 + 'mshtakan': [ 1.47096 + 0.9167, 1.47097 + 0.25, 1.47098 + 0 1.47099 + ], 1.47100 + 'mshtakan bold': [ 1.47101 + 0.9167, 1.47102 + 0.25, 1.47103 + 0 1.47104 + ], 1.47105 + 'mshtakan boldoblique': [ 1.47106 + 0.9167, 1.47107 + 0.25, 1.47108 + 0 1.47109 + ], 1.47110 + 'mshtakan oblique': [ 1.47111 + 0.9167, 1.47112 + 0.25, 1.47113 + 0 1.47114 + ], 1.47115 + 'myanmar mn': [ 1.47116 + 1, 1.47117 + 0.4167, 1.47118 + 0 1.47119 + ], 1.47120 + 'myanmar mn bold': [ 1.47121 + 1, 1.47122 + 0.4167, 1.47123 + 0 1.47124 + ], 1.47125 + 'myanmar sangam mn': [ 1.47126 + 0.9167, 1.47127 + 0.4167, 1.47128 + 0 1.47129 + ], 1.47130 + 'nadeem': [ 1.47131 + 0.9167, 1.47132 + 0.4167, 1.47133 + 0 1.47134 + ], 1.47135 + 'nanum brush script': [ 1.47136 + 0.9167, 1.47137 + 0.25, 1.47138 + 0 1.47139 + ], 1.47140 + 'nanumgothic': [ 1.47141 + 0.9167, 1.47142 + 0.25, 1.47143 + 0 1.47144 + ], 1.47145 + 'nanumgothic bold': [ 1.47146 + 0.9167, 1.47147 + 0.25, 1.47148 + 0 1.47149 + ], 1.47150 + 'nanumgothic extrabold': [ 1.47151 + 0.9167, 1.47152 + 0.25, 1.47153 + 0 1.47154 + ], 1.47155 + 'nanummyeongjo': [ 1.47156 + 0.9167, 1.47157 + 0.25, 1.47158 + 0 1.47159 + ], 1.47160 + 'nanummyeongjo bold': [ 1.47161 + 0.9167, 1.47162 + 0.25, 1.47163 + 0 1.47164 + ], 1.47165 + 'nanummyeongjo extrabold': [ 1.47166 + 0.9167, 1.47167 + 0.25, 1.47168 + 0 1.47169 + ], 1.47170 + 'nanum pen script': [ 1.47171 + 0.9167, 1.47172 + 0.25, 1.47173 + 0 1.47174 + ], 1.47175 + 'optima bold': [ 1.47176 + 0.9167, 1.47177 + 0.25, 1.47178 + 0 1.47179 + ], 1.47180 + 'optima bold italic': [ 1.47181 + 0.9167, 1.47182 + 0.25, 1.47183 + 0 1.47184 + ], 1.47185 + 'optima extrablack': [ 1.47186 + 1, 1.47187 + 0.25, 1.47188 + 0 1.47189 + ], 1.47190 + 'optima italic': [ 1.47191 + 0.9167, 1.47192 + 0.25, 1.47193 + 0 1.47194 + ], 1.47195 + 'optima regular': [ 1.47196 + 0.9167, 1.47197 + 0.25, 1.47198 + 0 1.47199 + ], 1.47200 + 'oriya mn': [ 1.47201 + 0.9167, 1.47202 + 0.25, 1.47203 + 0 1.47204 + ], 1.47205 + 'oriya mn bold': [ 1.47206 + 0.9167, 1.47207 + 0.25, 1.47208 + 0 1.47209 + ], 1.47210 + 'oriya sangam mn': [ 1.47211 + 0.8333, 1.47212 + 0.4167, 1.47213 + 0 1.47214 + ], 1.47215 + 'oriya sangam mn bold': [ 1.47216 + 0.8333, 1.47217 + 0.4167, 1.47218 + 0 1.47219 + ], 1.47220 + 'osaka': [ 1.47221 + 1, 1.47222 + 0.25, 1.47223 + 0 1.47224 + ], 1.47225 + 'osaka-mono': [ 1.47226 + 0.8333, 1.47227 + 0.1667, 1.47228 + 0 1.47229 + ], 1.47230 + 'palatino bold': [ 1.47231 + 0.8333, 1.47232 + 0.25, 1.47233 + 0 1.47234 + ], 1.47235 + 'palatino bold italic': [ 1.47236 + 0.8333, 1.47237 + 0.25, 1.47238 + 0 1.47239 + ], 1.47240 + 'palatino italic': [ 1.47241 + 0.8333, 1.47242 + 0.25, 1.47243 + 0 1.47244 + ], 1.47245 + 'palatino': [ 1.47246 + 0.8333, 1.47247 + 0.25, 1.47248 + 0 1.47249 + ], 1.47250 + 'papyrus': [ 1.47251 + 0.9167, 1.47252 + 0.5833, 1.47253 + 0 1.47254 + ], 1.47255 + 'papyrus condensed': [ 1.47256 + 0.9167, 1.47257 + 0.5833, 1.47258 + 0 1.47259 + ], 1.47260 + 'plantagenet cherokee': [ 1.47261 + 0.6667, 1.47262 + 0.25, 1.47263 + 0 1.47264 + ], 1.47265 + 'raanana': [ 1.47266 + 0.75, 1.47267 + 0.25, 1.47268 + 0 1.47269 + ], 1.47270 + 'raanana bold': [ 1.47271 + 0.75, 1.47272 + 0.25, 1.47273 + 0 1.47274 + ], 1.47275 + 'hei regular': [ 1.47276 + 0.8333, 1.47277 + 0.1667, 1.47278 + 0 1.47279 + ], 1.47280 + 'kai regular': [ 1.47281 + 0.8333, 1.47282 + 0.1667, 1.47283 + 0 1.47284 + ], 1.47285 + 'stfangsong': [ 1.47286 + 0.8333, 1.47287 + 0.1667, 1.47288 + 0 1.47289 + ], 1.47290 + 'stheiti': [ 1.47291 + 0.8333, 1.47292 + 0.1667, 1.47293 + 0 1.47294 + ], 1.47295 + 'heiti sc light': [ 1.47296 + 0.8333, 1.47297 + 0.1667, 1.47298 + 0 1.47299 + ], 1.47300 + 'heiti sc medium': [ 1.47301 + 0.8333, 1.47302 + 0.1667, 1.47303 + 0 1.47304 + ], 1.47305 + 'heiti tc light': [ 1.47306 + 0.8333, 1.47307 + 0.1667, 1.47308 + 0 1.47309 + ], 1.47310 + 'heiti tc medium': [ 1.47311 + 0.8333, 1.47312 + 0.1667, 1.47313 + 0 1.47314 + ], 1.47315 + 'stkaiti': [ 1.47316 + 0.8333, 1.47317 + 0.1667, 1.47318 + 0 1.47319 + ], 1.47320 + 'kaiti sc black': [ 1.47321 + 1.0833, 1.47322 + 0.3333, 1.47323 + 0 1.47324 + ], 1.47325 + 'kaiti sc bold': [ 1.47326 + 1.0833, 1.47327 + 0.3333, 1.47328 + 0 1.47329 + ], 1.47330 + 'kaiti sc regular': [ 1.47331 + 1.0833, 1.47332 + 0.3333, 1.47333 + 0 1.47334 + ], 1.47335 + 'stsong': [ 1.47336 + 0.8333, 1.47337 + 0.1667, 1.47338 + 0 1.47339 + ], 1.47340 + 'songti sc black': [ 1.47341 + 1.0833, 1.47342 + 0.3333, 1.47343 + 0 1.47344 + ], 1.47345 + 'songti sc bold': [ 1.47346 + 1.0833, 1.47347 + 0.3333, 1.47348 + 0 1.47349 + ], 1.47350 + 'songti sc light': [ 1.47351 + 1.0833, 1.47352 + 0.3333, 1.47353 + 0 1.47354 + ], 1.47355 + 'songti sc regular': [ 1.47356 + 1.0833, 1.47357 + 0.3333, 1.47358 + 0 1.47359 + ], 1.47360 + 'stxihei': [ 1.47361 + 0.8333, 1.47362 + 0.1667, 1.47363 + 0 1.47364 + ], 1.47365 + 'sathu': [ 1.47366 + 0.9167, 1.47367 + 0.3333, 1.47368 + 0 1.47369 + ], 1.47370 + 'silom': [ 1.47371 + 1, 1.47372 + 0.3333, 1.47373 + 0 1.47374 + ], 1.47375 + 'sinhala mn': [ 1.47376 + 0.9167, 1.47377 + 0.25, 1.47378 + 0 1.47379 + ], 1.47380 + 'sinhala mn bold': [ 1.47381 + 0.9167, 1.47382 + 0.25, 1.47383 + 0 1.47384 + ], 1.47385 + 'sinhala sangam mn': [ 1.47386 + 1.1667, 1.47387 + 0.3333, 1.47388 + 0 1.47389 + ], 1.47390 + 'sinhala sangam mn bold': [ 1.47391 + 1.1667, 1.47392 + 0.3333, 1.47393 + 0 1.47394 + ], 1.47395 + 'skia regular': [ 1.47396 + 0.75, 1.47397 + 0.25, 1.47398 + 0 1.47399 + ], 1.47400 + 'symbol': [ 1.47401 + 0.6667, 1.47402 + 0.3333, 1.47403 + 0 1.47404 + ], 1.47405 + 'tahoma negreta': [ 1.47406 + 1, 1.47407 + 0.1667, 1.47408 + 0 1.47409 + ], 1.47410 + 'tamil mn': [ 1.47411 + 0.9167, 1.47412 + 0.25, 1.47413 + 0 1.47414 + ], 1.47415 + 'tamil mn bold': [ 1.47416 + 0.9167, 1.47417 + 0.25, 1.47418 + 0 1.47419 + ], 1.47420 + 'tamil sangam mn': [ 1.47421 + 0.75, 1.47422 + 0.25, 1.47423 + 0 1.47424 + ], 1.47425 + 'tamil sangam mn bold': [ 1.47426 + 0.75, 1.47427 + 0.25, 1.47428 + 0 1.47429 + ], 1.47430 + 'telugu mn': [ 1.47431 + 0.9167, 1.47432 + 0.25, 1.47433 + 0 1.47434 + ], 1.47435 + 'telugu mn bold': [ 1.47436 + 0.9167, 1.47437 + 0.25, 1.47438 + 0 1.47439 + ], 1.47440 + 'telugu sangam mn': [ 1.47441 + 1, 1.47442 + 0.5833, 1.47443 + 0 1.47444 + ], 1.47445 + 'telugu sangam mn bold': [ 1.47446 + 1, 1.47447 + 0.5833, 1.47448 + 0 1.47449 + ], 1.47450 + 'thonburi': [ 1.47451 + 1.0833, 1.47452 + 0.25, 1.47453 + 0 1.47454 + ], 1.47455 + 'thonburi bold': [ 1.47456 + 1.0833, 1.47457 + 0.25, 1.47458 + 0 1.47459 + ], 1.47460 + 'times bold': [ 1.47461 + 0.75, 1.47462 + 0.25, 1.47463 + 0 1.47464 + ], 1.47465 + 'times bold italic': [ 1.47466 + 0.75, 1.47467 + 0.25, 1.47468 + 0 1.47469 + ], 1.47470 + 'times italic': [ 1.47471 + 0.75, 1.47472 + 0.25, 1.47473 + 0 1.47474 + ], 1.47475 + 'times roman': [ 1.47476 + 0.75, 1.47477 + 0.25, 1.47478 + 0 1.47479 + ], 1.47480 + 'times new roman bold italic': [ 1.47481 + 0.9167, 1.47482 + 0.25, 1.47483 + 0 1.47484 + ], 1.47485 + 'times new roman bold': [ 1.47486 + 0.9167, 1.47487 + 0.25, 1.47488 + 0 1.47489 + ], 1.47490 + 'times new roman italic': [ 1.47491 + 0.9167, 1.47492 + 0.25, 1.47493 + 0 1.47494 + ], 1.47495 + 'times new roman': [ 1.47496 + 0.9167, 1.47497 + 0.25, 1.47498 + 0 1.47499 + ], 1.47500 + 'trebuchet ms bold italic': [ 1.47501 + 0.9167, 1.47502 + 0.25, 1.47503 + 0 1.47504 + ], 1.47505 + 'trebuchet ms': [ 1.47506 + 0.9167, 1.47507 + 0.25, 1.47508 + 0 1.47509 + ], 1.47510 + 'trebuchet ms bold': [ 1.47511 + 0.9167, 1.47512 + 0.25, 1.47513 + 0 1.47514 + ], 1.47515 + 'trebuchet ms italic': [ 1.47516 + 0.9167, 1.47517 + 0.25, 1.47518 + 0 1.47519 + ], 1.47520 + 'verdana': [ 1.47521 + 1, 1.47522 + 0.25, 1.47523 + 0 1.47524 + ], 1.47525 + 'verdana bold': [ 1.47526 + 1, 1.47527 + 0.25, 1.47528 + 0 1.47529 + ], 1.47530 + 'verdana bold italic': [ 1.47531 + 1, 1.47532 + 0.25, 1.47533 + 0 1.47534 + ], 1.47535 + 'verdana italic': [ 1.47536 + 1, 1.47537 + 0.25, 1.47538 + 0 1.47539 + ], 1.47540 + 'webdings': [ 1.47541 + 0.8333, 1.47542 + 0.1667, 1.47543 + 0 1.47544 + ], 1.47545 + 'wingdings 2': [ 1.47546 + 0.8333, 1.47547 + 0.25, 1.47548 + 0 1.47549 + ], 1.47550 + 'wingdings 3': [ 1.47551 + 0.9167, 1.47552 + 0.25, 1.47553 + 0 1.47554 + ], 1.47555 + 'yuppy sc regular': [ 1.47556 + 1.0833, 1.47557 + 0.3333, 1.47558 + 0 1.47559 + ], 1.47560 + 'yuppy tc regular': [ 1.47561 + 1.0833, 1.47562 + 0.3333, 1.47563 + 0 1.47564 + ], 1.47565 + 'zapf dingbats': [ 1.47566 + 0.8333, 1.47567 + 0.1667, 1.47568 + 0 1.47569 + ], 1.47570 + 'zapfino': [ 1.47571 + 1.9167, 1.47572 + 1.5, 1.47573 + 0 1.47574 + ] 1.47575 + }; 1.47576 + var DEVICE_FONT_METRICS_LINUX = { 1.47577 + 'kacstfarsi': [ 1.47578 + 1.0831, 1.47579 + 0.5215, 1.47580 + 0 1.47581 + ], 1.47582 + 'meera': [ 1.47583 + 0.682, 1.47584 + 0.4413, 1.47585 + 0 1.47586 + ], 1.47587 + 'freemono': [ 1.47588 + 0.8023, 1.47589 + 0.2006, 1.47590 + 0 1.47591 + ], 1.47592 + 'undotum': [ 1.47593 + 1.0029, 1.47594 + 0.2808, 1.47595 + 0 1.47596 + ], 1.47597 + 'loma': [ 1.47598 + 1.1634, 1.47599 + 0.4814, 1.47600 + 0 1.47601 + ], 1.47602 + 'century schoolbook l': [ 1.47603 + 1.0029, 1.47604 + 0.3209, 1.47605 + 0 1.47606 + ], 1.47607 + 'kacsttitlel': [ 1.47608 + 1.0831, 1.47609 + 0.5215, 1.47610 + 0 1.47611 + ], 1.47612 + 'undinaru': [ 1.47613 + 1.0029, 1.47614 + 0.2407, 1.47615 + 0 1.47616 + ], 1.47617 + 'ungungseo': [ 1.47618 + 1.0029, 1.47619 + 0.2808, 1.47620 + 0 1.47621 + ], 1.47622 + 'garuda': [ 1.47623 + 1.3238, 1.47624 + 0.6017, 1.47625 + 0 1.47626 + ], 1.47627 + 'rekha': [ 1.47628 + 1.1232, 1.47629 + 0.2808, 1.47630 + 0 1.47631 + ], 1.47632 + 'purisa': [ 1.47633 + 1.1232, 1.47634 + 0.5215, 1.47635 + 0 1.47636 + ], 1.47637 + 'dejavu sans mono': [ 1.47638 + 0.9628, 1.47639 + 0.2407, 1.47640 + 0 1.47641 + ], 1.47642 + 'vemana2000': [ 1.47643 + 0.8825, 1.47644 + 0.8424, 1.47645 + 0 1.47646 + ], 1.47647 + 'kacstoffice': [ 1.47648 + 1.0831, 1.47649 + 0.5215, 1.47650 + 0 1.47651 + ], 1.47652 + 'umpush': [ 1.47653 + 1.2837, 1.47654 + 0.682, 1.47655 + 0 1.47656 + ], 1.47657 + 'opensymbol': [ 1.47658 + 0.8023, 1.47659 + 0.2006, 1.47660 + 0 1.47661 + ], 1.47662 + 'sawasdee': [ 1.47663 + 1.1232, 1.47664 + 0.4413, 1.47665 + 0 1.47666 + ], 1.47667 + 'urw palladio l': [ 1.47668 + 1.0029, 1.47669 + 0.3209, 1.47670 + 0 1.47671 + ], 1.47672 + 'freeserif': [ 1.47673 + 0.9227, 1.47674 + 0.3209, 1.47675 + 0 1.47676 + ], 1.47677 + 'kacstdigital': [ 1.47678 + 1.0831, 1.47679 + 0.5215, 1.47680 + 0 1.47681 + ], 1.47682 + 'ubuntu condensed': [ 1.47683 + 0.9628, 1.47684 + 0.2006, 1.47685 + 0 1.47686 + ], 1.47687 + 'unpilgi': [ 1.47688 + 1.0029, 1.47689 + 0.4413, 1.47690 + 0 1.47691 + ], 1.47692 + 'mry_kacstqurn': [ 1.47693 + 1.4442, 1.47694 + 0.7221, 1.47695 + 0 1.47696 + ], 1.47697 + 'urw gothic l': [ 1.47698 + 1.0029, 1.47699 + 0.2407, 1.47700 + 0 1.47701 + ], 1.47702 + 'dingbats': [ 1.47703 + 0.8424, 1.47704 + 0.1605, 1.47705 + 0 1.47706 + ], 1.47707 + 'urw chancery l': [ 1.47708 + 1.0029, 1.47709 + 0.3209, 1.47710 + 0 1.47711 + ], 1.47712 + 'phetsarath ot': [ 1.47713 + 1.0831, 1.47714 + 0.5215, 1.47715 + 0 1.47716 + ], 1.47717 + 'tlwg typist': [ 1.47718 + 0.8825, 1.47719 + 0.4012, 1.47720 + 0 1.47721 + ], 1.47722 + 'kacstletter': [ 1.47723 + 1.0831, 1.47724 + 0.5215, 1.47725 + 0 1.47726 + ], 1.47727 + 'utkal': [ 1.47728 + 1.2035, 1.47729 + 0.6418, 1.47730 + 0 1.47731 + ], 1.47732 + 'dejavu sans light': [ 1.47733 + 0.9628, 1.47734 + 0.2407, 1.47735 + 0 1.47736 + ], 1.47737 + 'norasi': [ 1.47738 + 1.2436, 1.47739 + 0.5215, 1.47740 + 0 1.47741 + ], 1.47742 + 'dejavu serif condensed': [ 1.47743 + 0.9628, 1.47744 + 0.2407, 1.47745 + 0 1.47746 + ], 1.47747 + 'kacstone': [ 1.47748 + 1.2436, 1.47749 + 0.6418, 1.47750 + 0 1.47751 + ], 1.47752 + 'liberation sans narrow': [ 1.47753 + 0.9628, 1.47754 + 0.2407, 1.47755 + 0 1.47756 + ], 1.47757 + 'symbol': [ 1.47758 + 1.043, 1.47759 + 0.3209, 1.47760 + 0 1.47761 + ], 1.47762 + 'nanummyeongjo': [ 1.47763 + 0.9227, 1.47764 + 0.2407, 1.47765 + 0 1.47766 + ], 1.47767 + 'untitled1': [ 1.47768 + 0.682, 1.47769 + 0.5616, 1.47770 + 0 1.47771 + ], 1.47772 + 'lohit gujarati': [ 1.47773 + 0.9628, 1.47774 + 0.4012, 1.47775 + 0 1.47776 + ], 1.47777 + 'liberation mono': [ 1.47778 + 0.8424, 1.47779 + 0.3209, 1.47780 + 0 1.47781 + ], 1.47782 + 'kacstart': [ 1.47783 + 1.0831, 1.47784 + 0.5215, 1.47785 + 0 1.47786 + ], 1.47787 + 'mallige': [ 1.47788 + 1.0029, 1.47789 + 0.682, 1.47790 + 0 1.47791 + ], 1.47792 + 'bitstream charter': [ 1.47793 + 1.0029, 1.47794 + 0.2407, 1.47795 + 0 1.47796 + ], 1.47797 + 'nanumgothic': [ 1.47798 + 0.9227, 1.47799 + 0.2407, 1.47800 + 0 1.47801 + ], 1.47802 + 'liberation serif': [ 1.47803 + 0.9227, 1.47804 + 0.2407, 1.47805 + 0 1.47806 + ], 1.47807 + 'dejavu sans condensed': [ 1.47808 + 0.9628, 1.47809 + 0.2407, 1.47810 + 0 1.47811 + ], 1.47812 + 'ubuntu': [ 1.47813 + 0.9628, 1.47814 + 0.2006, 1.47815 + 0 1.47816 + ], 1.47817 + 'courier 10 pitch': [ 1.47818 + 0.8825, 1.47819 + 0.3209, 1.47820 + 0 1.47821 + ], 1.47822 + 'nimbus sans l': [ 1.47823 + 0.9628, 1.47824 + 0.3209, 1.47825 + 0 1.47826 + ], 1.47827 + 'takaopgothic': [ 1.47828 + 0.8825, 1.47829 + 0.2006, 1.47830 + 0 1.47831 + ], 1.47832 + 'wenquanyi micro hei mono': [ 1.47833 + 0.9628, 1.47834 + 0.2407, 1.47835 + 0 1.47836 + ], 1.47837 + 'dejavu sans': [ 1.47838 + 0.9628, 1.47839 + 0.2407, 1.47840 + 0 1.47841 + ], 1.47842 + 'kedage': [ 1.47843 + 1.0029, 1.47844 + 0.682, 1.47845 + 0 1.47846 + ], 1.47847 + 'kinnari': [ 1.47848 + 1.3238, 1.47849 + 0.5215, 1.47850 + 0 1.47851 + ], 1.47852 + 'tlwgmono': [ 1.47853 + 0.8825, 1.47854 + 0.4012, 1.47855 + 0 1.47856 + ], 1.47857 + 'standard symbols l': [ 1.47858 + 1.043, 1.47859 + 0.3209, 1.47860 + 0 1.47861 + ], 1.47862 + 'lohit punjabi': [ 1.47863 + 1.2035, 1.47864 + 0.682, 1.47865 + 0 1.47866 + ], 1.47867 + 'nimbus mono l': [ 1.47868 + 0.8424, 1.47869 + 0.2808, 1.47870 + 0 1.47871 + ], 1.47872 + 'rachana': [ 1.47873 + 0.682, 1.47874 + 0.5616, 1.47875 + 0 1.47876 + ], 1.47877 + 'waree': [ 1.47878 + 1.2436, 1.47879 + 0.4413, 1.47880 + 0 1.47881 + ], 1.47882 + 'kacstposter': [ 1.47883 + 1.0831, 1.47884 + 0.5215, 1.47885 + 0 1.47886 + ], 1.47887 + 'khmer os': [ 1.47888 + 1.2837, 1.47889 + 0.7622, 1.47890 + 0 1.47891 + ], 1.47892 + 'freesans': [ 1.47893 + 1.0029, 1.47894 + 0.3209, 1.47895 + 0 1.47896 + ], 1.47897 + 'gargi': [ 1.47898 + 0.9628, 1.47899 + 0.2808, 1.47900 + 0 1.47901 + ], 1.47902 + 'nimbus roman no9 l': [ 1.47903 + 0.9628, 1.47904 + 0.3209, 1.47905 + 0 1.47906 + ], 1.47907 + 'dejavu serif': [ 1.47908 + 0.9628, 1.47909 + 0.2407, 1.47910 + 0 1.47911 + ], 1.47912 + 'wenquanyi micro hei': [ 1.47913 + 0.9628, 1.47914 + 0.2407, 1.47915 + 0 1.47916 + ], 1.47917 + 'ubuntu light': [ 1.47918 + 0.9628, 1.47919 + 0.2006, 1.47920 + 0 1.47921 + ], 1.47922 + 'tlwgtypewriter': [ 1.47923 + 0.9227, 1.47924 + 0.4012, 1.47925 + 0 1.47926 + ], 1.47927 + 'kacstpen': [ 1.47928 + 1.0831, 1.47929 + 0.5215, 1.47930 + 0 1.47931 + ], 1.47932 + 'tlwg typo': [ 1.47933 + 0.8825, 1.47934 + 0.4012, 1.47935 + 0 1.47936 + ], 1.47937 + 'mukti narrow': [ 1.47938 + 1.2837, 1.47939 + 0.4413, 1.47940 + 0 1.47941 + ], 1.47942 + 'ubuntu mono': [ 1.47943 + 0.8424, 1.47944 + 0.2006, 1.47945 + 0 1.47946 + ], 1.47947 + 'lohit bengali': [ 1.47948 + 1.0029, 1.47949 + 0.4413, 1.47950 + 0 1.47951 + ], 1.47952 + 'liberation sans': [ 1.47953 + 0.9227, 1.47954 + 0.2407, 1.47955 + 0 1.47956 + ], 1.47957 + 'unbatang': [ 1.47958 + 1.0029, 1.47959 + 0.2808, 1.47960 + 0 1.47961 + ], 1.47962 + 'kacstdecorative': [ 1.47963 + 1.1232, 1.47964 + 0.5215, 1.47965 + 0 1.47966 + ], 1.47967 + 'khmer os system': [ 1.47968 + 1.2436, 1.47969 + 0.6017, 1.47970 + 0 1.47971 + ], 1.47972 + 'saab': [ 1.47973 + 1.0029, 1.47974 + 0.682, 1.47975 + 0 1.47976 + ], 1.47977 + 'kacsttitle': [ 1.47978 + 1.0831, 1.47979 + 0.5215, 1.47980 + 0 1.47981 + ], 1.47982 + 'mukti narrow bold': [ 1.47983 + 1.2837, 1.47984 + 0.4413, 1.47985 + 0 1.47986 + ], 1.47987 + 'lohit hindi': [ 1.47988 + 1.0029, 1.47989 + 0.5215, 1.47990 + 0 1.47991 + ], 1.47992 + 'kacstqurn': [ 1.47993 + 1.0831, 1.47994 + 0.5215, 1.47995 + 0 1.47996 + ], 1.47997 + 'urw bookman l': [ 1.47998 + 0.9628, 1.47999 + 0.2808, 1.48000 + 0 1.48001 + ], 1.48002 + 'kacstnaskh': [ 1.48003 + 1.0831, 1.48004 + 0.5215, 1.48005 + 0 1.48006 + ], 1.48007 + 'kacstscreen': [ 1.48008 + 1.0831, 1.48009 + 0.5215, 1.48010 + 0 1.48011 + ], 1.48012 + 'pothana2000': [ 1.48013 + 0.8825, 1.48014 + 0.8424, 1.48015 + 0 1.48016 + ], 1.48017 + 'ungraphic': [ 1.48018 + 1.0029, 1.48019 + 0.2808, 1.48020 + 0 1.48021 + ], 1.48022 + 'lohit tamil': [ 1.48023 + 0.8825, 1.48024 + 0.361, 1.48025 + 0 1.48026 + ], 1.48027 + 'kacstbook': [ 1.48028 + 1.0831, 1.48029 + 0.5215, 1.48030 + 0 1.48031 + ] 1.48032 + }; 1.48033 + DEVICE_FONT_METRICS_MAC.__proto__ = DEVICE_FONT_METRICS_WIN; 1.48034 + DEVICE_FONT_METRICS_LINUX.__proto__ = DEVICE_FONT_METRICS_MAC; 1.48035 +} 1.48036 +var StaticTextDefinition = function () { 1.48037 + var def = { 1.48038 + __class__: 'flash.text.StaticText', 1.48039 + initialize: function () { 1.48040 + var s = this.symbol; 1.48041 + if (s) { 1.48042 + this.draw = s.draw; 1.48043 + } 1.48044 + }, 1.48045 + get text() { 1.48046 + return this._text; 1.48047 + }, 1.48048 + set text(val) { 1.48049 + this._text = val; 1.48050 + } 1.48051 + }; 1.48052 + var desc = Object.getOwnPropertyDescriptor; 1.48053 + def.__glue__ = { 1.48054 + native: { 1.48055 + instance: { 1.48056 + text: desc(def, 'text') 1.48057 + } 1.48058 + } 1.48059 + }; 1.48060 + return def; 1.48061 + }.call(this); 1.48062 +var StyleSheetDefinition = function () { 1.48063 + return { 1.48064 + __class__: 'flash.text.StyleSheet', 1.48065 + initialize: function () { 1.48066 + }, 1.48067 + __glue__: { 1.48068 + native: { 1.48069 + static: {}, 1.48070 + instance: { 1.48071 + _update: function _update() { 1.48072 + somewhatImplemented('StyleSheet._update'); 1.48073 + }, 1.48074 + _parseCSSInternal: function _parseCSSInternal(cssText) { 1.48075 + somewhatImplemented('StyleSheet._parseCSSInternal'); 1.48076 + return null; 1.48077 + }, 1.48078 + _parseCSSFontFamily: function _parseCSSFontFamily(fontFamily) { 1.48079 + notImplemented('StyleSheet._parseCSSFontFamily'); 1.48080 + }, 1.48081 + _parseColor: function _parseColor(color) { 1.48082 + notImplemented('StyleSheet._parseColor'); 1.48083 + }, 1.48084 + _styles: { 1.48085 + get: function _styles() { 1.48086 + return this.__styles; 1.48087 + }, 1.48088 + set: function _styles(styles) { 1.48089 + somewhatImplemented('StyleSheet._styles'); 1.48090 + this.__styles = styles; 1.48091 + } 1.48092 + } 1.48093 + } 1.48094 + } 1.48095 + } 1.48096 + }; 1.48097 + }.call(this); 1.48098 +var TextFieldDefinition = function () { 1.48099 + var def = { 1.48100 + __class__: 'flash.text.TextField', 1.48101 + initialize: function () { 1.48102 + this._bbox = { 1.48103 + xMin: 0, 1.48104 + yMin: 0, 1.48105 + xMax: 2000, 1.48106 + yMax: 2000 1.48107 + }; 1.48108 + var initialFormat = { 1.48109 + align: 'LEFT', 1.48110 + face: 'serif', 1.48111 + size: 12, 1.48112 + letterspacing: 0, 1.48113 + kerning: 0, 1.48114 + color: 0, 1.48115 + leading: 0 1.48116 + }; 1.48117 + this._content = new TextFieldContent(initialFormat); 1.48118 + this._type = 'dynamic'; 1.48119 + this._embedFonts = false; 1.48120 + this._selectable = true; 1.48121 + this._autoSize = 'none'; 1.48122 + this._scrollV = 1; 1.48123 + this._maxScrollV = 1; 1.48124 + this._bottomScrollV = 1; 1.48125 + this._drawingOffsetH = 0; 1.48126 + this._background = false; 1.48127 + this._border = false; 1.48128 + this._backgroundColor = 16777215; 1.48129 + this._backgroundColorStr = '#ffffff'; 1.48130 + this._borderColor = 0; 1.48131 + this._borderColorStr = '#000000'; 1.48132 + var s = this.symbol; 1.48133 + if (!s) { 1.48134 + this._currentTransform.tx -= 40; 1.48135 + this._currentTransform.ty -= 40; 1.48136 + this._content.resolveFont(initialFormat, false); 1.48137 + this.text = ''; 1.48138 + return; 1.48139 + } 1.48140 + var tag = s.tag; 1.48141 + var bbox = tag.bbox; 1.48142 + this._currentTransform.tx += bbox.xMin; 1.48143 + this._currentTransform.ty += bbox.yMin; 1.48144 + this._bbox.xMax = bbox.xMax - bbox.xMin; 1.48145 + this._bbox.yMax = bbox.yMax - bbox.yMin; 1.48146 + if (tag.hasLayout) { 1.48147 + initialFormat.size = tag.fontHeight / 20; 1.48148 + initialFormat.leading = (tag.leading | 0) / 20; 1.48149 + } 1.48150 + if (tag.hasColor) { 1.48151 + initialFormat.color = rgbaObjToStr(tag.color); 1.48152 + } 1.48153 + if (tag.hasFont) { 1.48154 + var font = FontDefinition.getFontByUniqueName(tag.font); 1.48155 + initialFormat.font = font; 1.48156 + initialFormat.face = font._fontName; 1.48157 + initialFormat.bold = font.symbol.bold; 1.48158 + initialFormat.italic = font.symbol.italic; 1.48159 + initialFormat.str = this._content.makeFormatString(initialFormat); 1.48160 + } 1.48161 + this._content.multiline = !(!tag.multiline); 1.48162 + this._content.wordWrap = !(!tag.wordWrap); 1.48163 + this._embedFonts = !(!tag.useOutlines); 1.48164 + this._selectable = !tag.noSelect; 1.48165 + this._border = !(!tag.border); 1.48166 + switch (tag.align) { 1.48167 + case 1: 1.48168 + initialFormat.align = 'right'; 1.48169 + break; 1.48170 + case 2: 1.48171 + initialFormat.align = 'center'; 1.48172 + break; 1.48173 + case 3: 1.48174 + initialFormat.align = 'justified'; 1.48175 + break; 1.48176 + default: 1.48177 + } 1.48178 + if (tag.initialText) { 1.48179 + if (tag.html) { 1.48180 + this.htmlText = tag.initialText; 1.48181 + } else { 1.48182 + this.text = tag.initialText; 1.48183 + } 1.48184 + } else { 1.48185 + this.text = ''; 1.48186 + } 1.48187 + }, 1.48188 + _getAS2Object: function () { 1.48189 + if (!this.$as2Object) { 1.48190 + new avm1lib.AS2TextField(this); 1.48191 + } 1.48192 + return this.$as2Object; 1.48193 + }, 1.48194 + replaceText: function (begin, end, str) { 1.48195 + var text = this._content.text; 1.48196 + this.text = text.substring(0, begin) + str + text.substring(end); 1.48197 + }, 1.48198 + draw: function (ctx, ratio, colorTransform) { 1.48199 + this.ensureDimensions(); 1.48200 + var bounds = this._bbox; 1.48201 + var width = bounds.xMax / 20; 1.48202 + var height = bounds.yMax / 20; 1.48203 + if (width <= 0 || height <= 0) { 1.48204 + return; 1.48205 + } 1.48206 + ctx.save(); 1.48207 + ctx.beginPath(); 1.48208 + ctx.rect(0, 0, width + 1, height + 1); 1.48209 + ctx.clip(); 1.48210 + if (this._background) { 1.48211 + colorTransform.setFillStyle(ctx, this._backgroundColorStr); 1.48212 + ctx.fill(); 1.48213 + } 1.48214 + if (this._border) { 1.48215 + colorTransform.setStrokeStyle(ctx, this._borderColorStr); 1.48216 + ctx.lineCap = 'square'; 1.48217 + ctx.lineWidth = 1; 1.48218 + ctx.strokeRect(0.5, 0.5, width | 0, height | 0); 1.48219 + } 1.48220 + ctx.closePath(); 1.48221 + if (this._content.lines.length === 0) { 1.48222 + ctx.restore(); 1.48223 + return; 1.48224 + } 1.48225 + ctx.translate(2, 2); 1.48226 + ctx.save(); 1.48227 + colorTransform.setAlpha(ctx); 1.48228 + var runs = this._content._textRuns; 1.48229 + var offsetY = this._content.lines[this._scrollV - 1].y; 1.48230 + for (var i = 0; i < runs.length; i++) { 1.48231 + var run = runs[i]; 1.48232 + if (run.type === 'f') { 1.48233 + ctx.restore(); 1.48234 + ctx.font = run.format.str; 1.48235 + colorTransform.setFillStyle(ctx, run.format.color); 1.48236 + ctx.save(); 1.48237 + colorTransform.setAlpha(ctx); 1.48238 + } else { 1.48239 + if (run.y < offsetY) { 1.48240 + continue; 1.48241 + } 1.48242 + ctx.fillText(run.text, run.x - this._drawingOffsetH, run.y - offsetY); 1.48243 + } 1.48244 + } 1.48245 + ctx.restore(); 1.48246 + ctx.restore(); 1.48247 + }, 1.48248 + invalidateDimensions: function () { 1.48249 + this._invalidate(); 1.48250 + this._invalidateBounds(); 1.48251 + this._dimensionsValid = false; 1.48252 + }, 1.48253 + ensureDimensions: function () { 1.48254 + if (this._dimensionsValid) { 1.48255 + return; 1.48256 + } 1.48257 + var bounds = this._bbox; 1.48258 + var combinedAlign = this._content.calculateMetrics(bounds, this._embedFonts); 1.48259 + this._scrollV = 1; 1.48260 + this._maxScrollV = 1; 1.48261 + this._bottomScrollV = 1; 1.48262 + var autoSize = this._autoSize; 1.48263 + if (autoSize === 'none') { 1.48264 + var maxVisibleY = (bounds.yMax - 80) / 20; 1.48265 + if (this._content.textHeight > maxVisibleY) { 1.48266 + var lines = this._content.lines; 1.48267 + for (var i = 0; i < lines.length; i++) { 1.48268 + var line = lines[i]; 1.48269 + if (line.y + line.height > maxVisibleY) { 1.48270 + this._maxScrollV = i + 1; 1.48271 + this._bottomScrollV = i === 0 ? 1 : i; 1.48272 + break; 1.48273 + } 1.48274 + } 1.48275 + } 1.48276 + } else { 1.48277 + var width = Math.max(bounds.xMax / 20 - 4, 1); 1.48278 + var targetWidth = this._content.textWidth; 1.48279 + var align = combinedAlign; 1.48280 + var diffX = 0; 1.48281 + if (align !== 'mixed') { 1.48282 + switch (autoSize) { 1.48283 + case 'left': 1.48284 + break; 1.48285 + case 'center': 1.48286 + diffX = width - targetWidth >> 1; 1.48287 + break; 1.48288 + case 'right': 1.48289 + diffX = width - targetWidth; 1.48290 + } 1.48291 + if (align === 'left') { 1.48292 + this._drawingOffsetH = 0; 1.48293 + } else { 1.48294 + var offset; 1.48295 + switch (autoSize) { 1.48296 + case 'left': 1.48297 + offset = width - targetWidth; 1.48298 + break; 1.48299 + case 'center': 1.48300 + offset = diffX << 1; 1.48301 + break; 1.48302 + case 'right': 1.48303 + offset = diffX; 1.48304 + break; 1.48305 + } 1.48306 + if (align === 'center') { 1.48307 + offset >>= 1; 1.48308 + } 1.48309 + this._drawingOffsetH = offset; 1.48310 + } 1.48311 + this._invalidateTransform(); 1.48312 + this._currentTransform.tx += diffX * 20 | 0; 1.48313 + bounds.xMax = (targetWidth * 20 | 0) + 80; 1.48314 + } 1.48315 + bounds.yMax = (this._content.textHeight * 20 | 0) + 80; 1.48316 + console.log(bounds.yMax); 1.48317 + this._invalidateBounds(); 1.48318 + } 1.48319 + this._dimensionsValid = true; 1.48320 + }, 1.48321 + get text() { 1.48322 + return this._content.text; 1.48323 + }, 1.48324 + set text(val) { 1.48325 + this._content.text = val; 1.48326 + this.invalidateDimensions(); 1.48327 + }, 1.48328 + get htmlText() { 1.48329 + return this._content.htmlText; 1.48330 + }, 1.48331 + set htmlText(val) { 1.48332 + this._content.htmlText = val; 1.48333 + this.invalidateDimensions(); 1.48334 + }, 1.48335 + get defaultTextFormat() { 1.48336 + var format = this._content.defaultTextFormat; 1.48337 + return new flash.text.TextFormat().fromObject(format); 1.48338 + }, 1.48339 + set defaultTextFormat(val) { 1.48340 + this._content.defaultTextFormat = val.toObject(); 1.48341 + this.invalidateDimensions(); 1.48342 + }, 1.48343 + getTextFormat: function (beginIndex, endIndex) { 1.48344 + return this.defaultTextFormat; 1.48345 + }, 1.48346 + setTextFormat: function (format, beginIndex, endIndex) { 1.48347 + this.defaultTextFormat = format; 1.48348 + if (this.text === this.htmlText) { 1.48349 + this.text = this.text; 1.48350 + } 1.48351 + this.invalidateDimensions(); 1.48352 + }, 1.48353 + get x() { 1.48354 + this.ensureDimensions(); 1.48355 + return this._currentTransform.tx; 1.48356 + }, 1.48357 + set x(val) { 1.48358 + if (val === this._currentTransform.tx) { 1.48359 + return; 1.48360 + } 1.48361 + this._invalidate(); 1.48362 + this._invalidateBounds(); 1.48363 + this._invalidateTransform(); 1.48364 + this._currentTransform.tx = val; 1.48365 + }, 1.48366 + get width() { 1.48367 + this.ensureDimensions(); 1.48368 + return this._bbox.xMax; 1.48369 + }, 1.48370 + set width(value) { 1.48371 + if (value < 0) { 1.48372 + return; 1.48373 + } 1.48374 + this._bbox.xMax = value; 1.48375 + this.invalidateDimensions(); 1.48376 + }, 1.48377 + get height() { 1.48378 + this.ensureDimensions(); 1.48379 + return this._bbox.yMax; 1.48380 + }, 1.48381 + set height(value) { 1.48382 + if (value < 0) { 1.48383 + return; 1.48384 + } 1.48385 + this._bbox.yMax = value; 1.48386 + this._invalidate(); 1.48387 + }, 1.48388 + _getContentBounds: function () { 1.48389 + this.ensureDimensions(); 1.48390 + return this._bbox; 1.48391 + }, 1.48392 + _getRegion: function getRegion(targetCoordSpace) { 1.48393 + return this._getTransformedRect(this._getContentBounds(), targetCoordSpace); 1.48394 + }, 1.48395 + getLineMetrics: function (lineIndex) { 1.48396 + this.ensureDimensions(); 1.48397 + if (lineIndex < 0 || lineIndex >= this._content.lines.length) { 1.48398 + throwError('RangeError', Errors.ParamRangeError); 1.48399 + } 1.48400 + var line = this._content.lines[lineIndex]; 1.48401 + var format = line.largestFormat; 1.48402 + var metrics = format.font._metrics; 1.48403 + var size = format.size; 1.48404 + var ascent = metrics.ascent * size + 0.49999 | 0; 1.48405 + var descent = metrics.descent * size + 0.49999 | 0; 1.48406 + var leading = metrics.leading * size + 0.49999 + line.leading | 0; 1.48407 + return new flash.text.TextLineMetrics(line.x + 2, line.width, line.height, ascent, descent, leading); 1.48408 + }, 1.48409 + getCharBoundaries: function getCharBoundaries(index) { 1.48410 + somewhatImplemented('TextField.getCharBoundaries'); 1.48411 + return new flash.geom.Rectangle(0, 0, 0, 0); 1.48412 + } 1.48413 + }; 1.48414 + var desc = Object.getOwnPropertyDescriptor; 1.48415 + def.__glue__ = { 1.48416 + native: { 1.48417 + instance: { 1.48418 + text: desc(def, 'text'), 1.48419 + defaultTextFormat: desc(def, 'defaultTextFormat'), 1.48420 + draw: def.draw, 1.48421 + htmlText: desc(def, 'htmlText'), 1.48422 + replaceText: def.replaceText, 1.48423 + getTextFormat: def.getTextFormat, 1.48424 + setTextFormat: def.setTextFormat, 1.48425 + getCharBoundaries: def.getCharBoundaries, 1.48426 + autoSize: { 1.48427 + get: function autoSize() { 1.48428 + return this._autoSize; 1.48429 + }, 1.48430 + set: function autoSize(value) { 1.48431 + if (this._autoSize === value) { 1.48432 + return; 1.48433 + } 1.48434 + this._autoSize = value; 1.48435 + this.invalidateDimensions(); 1.48436 + } 1.48437 + }, 1.48438 + multiline: { 1.48439 + get: function multiline() { 1.48440 + return this._content.multiline; 1.48441 + }, 1.48442 + set: function multiline(value) { 1.48443 + if (this._content.multiline === value) { 1.48444 + return; 1.48445 + } 1.48446 + this._content.multiline = value; 1.48447 + this.invalidateDimensions(); 1.48448 + } 1.48449 + }, 1.48450 + textColor: { 1.48451 + get: function textColor() { 1.48452 + return this._content.textColor; 1.48453 + }, 1.48454 + set: function textColor(value) { 1.48455 + if (this._content.textColor === value) { 1.48456 + return; 1.48457 + } 1.48458 + this._content.textColor = value; 1.48459 + this._invalidate(); 1.48460 + } 1.48461 + }, 1.48462 + selectable: { 1.48463 + get: function selectable() { 1.48464 + return this._selectable; 1.48465 + }, 1.48466 + set: function selectable(value) { 1.48467 + somewhatImplemented('TextField.selectable'); 1.48468 + this._selectable = value; 1.48469 + } 1.48470 + }, 1.48471 + wordWrap: { 1.48472 + get: function wordWrap() { 1.48473 + return this._content.wordWrap; 1.48474 + }, 1.48475 + set: function wordWrap(value) { 1.48476 + if (this._content.wordWrap === value) { 1.48477 + return; 1.48478 + } 1.48479 + this._content.wordWrap = value; 1.48480 + this.invalidateDimensions(); 1.48481 + } 1.48482 + }, 1.48483 + textHeight: { 1.48484 + get: function textHeight() { 1.48485 + this.ensureDimensions(); 1.48486 + return this._content.textHeight; 1.48487 + } 1.48488 + }, 1.48489 + textWidth: { 1.48490 + get: function textWidth() { 1.48491 + this.ensureDimensions(); 1.48492 + return this._content.textWidth; 1.48493 + } 1.48494 + }, 1.48495 + length: { 1.48496 + get: function length() { 1.48497 + return this.text.length; 1.48498 + } 1.48499 + }, 1.48500 + numLines: { 1.48501 + get: function numLines() { 1.48502 + this.ensureDimensions(); 1.48503 + return this._content.lines.length; 1.48504 + } 1.48505 + }, 1.48506 + getLineMetrics: function (lineIndex) { 1.48507 + return this.getLineMetrics(lineIndex); 1.48508 + }, 1.48509 + setSelection: function (beginIndex, endIndex) { 1.48510 + somewhatImplemented('TextField.setSelection'); 1.48511 + }, 1.48512 + scrollV: { 1.48513 + get: function scrollV() { 1.48514 + return this._scrollV; 1.48515 + }, 1.48516 + set: function scrollV(value) { 1.48517 + this.ensureDimensions(); 1.48518 + value = Math.max(1, Math.min(this._maxScrollV, value)); 1.48519 + this._scrollV = value; 1.48520 + } 1.48521 + }, 1.48522 + bottomScrollV: { 1.48523 + get: function bottomScrollV() { 1.48524 + this.ensureDimensions(); 1.48525 + if (this._scrollV === 1) { 1.48526 + return this._bottomScrollV; 1.48527 + } 1.48528 + var maxVisibleY = (this._bbox.yMax - 80) / 20; 1.48529 + var lines = this._content.lines; 1.48530 + var offsetY = lines[this._scrollV - 1].y; 1.48531 + for (var i = this._bottomScrollV; i < lines.length; i++) { 1.48532 + var line = lines[i]; 1.48533 + if (line.y + line.height + offsetY > maxVisibleY) { 1.48534 + return i + 1; 1.48535 + } 1.48536 + } 1.48537 + } 1.48538 + }, 1.48539 + maxScrollV: { 1.48540 + get: function maxScrollV() { 1.48541 + this.ensureDimensions(); 1.48542 + return this._maxScrollV; 1.48543 + } 1.48544 + }, 1.48545 + maxScrollH: { 1.48546 + get: function maxScrollH() { 1.48547 + this.ensureDimensions(); 1.48548 + return Math.max(this._content.textWidth - this._bbox.xMax / 20 + 4, 0); 1.48549 + } 1.48550 + }, 1.48551 + background: { 1.48552 + get: function background() { 1.48553 + return this._background; 1.48554 + }, 1.48555 + set: function background(value) { 1.48556 + if (this._background === value) { 1.48557 + return; 1.48558 + } 1.48559 + this._background = value; 1.48560 + this._invalidate(); 1.48561 + } 1.48562 + }, 1.48563 + backgroundColor: { 1.48564 + get: function backgroundColor() { 1.48565 + return this._backgroundColor; 1.48566 + }, 1.48567 + set: function backgroundColor(value) { 1.48568 + if (this._backgroundColor === value) { 1.48569 + return; 1.48570 + } 1.48571 + this._backgroundColor = value; 1.48572 + this._backgroundColorStr = rgbIntAlphaToStr(value, 1); 1.48573 + if (this._background) { 1.48574 + this._invalidate(); 1.48575 + } 1.48576 + } 1.48577 + }, 1.48578 + border: { 1.48579 + get: function border() { 1.48580 + return this._border; 1.48581 + }, 1.48582 + set: function border(value) { 1.48583 + if (this._border === value) { 1.48584 + return; 1.48585 + } 1.48586 + this._border = value; 1.48587 + this._invalidate(); 1.48588 + } 1.48589 + }, 1.48590 + borderColor: { 1.48591 + get: function borderColor() { 1.48592 + return this._borderColor; 1.48593 + }, 1.48594 + set: function borderColor(value) { 1.48595 + if (this._borderColor === value) { 1.48596 + return; 1.48597 + } 1.48598 + this._borderColor = value; 1.48599 + this._borderColorStr = rgbIntAlphaToStr(value, 1); 1.48600 + if (this._border) { 1.48601 + this._invalidate(); 1.48602 + } 1.48603 + } 1.48604 + }, 1.48605 + type: { 1.48606 + get: function borderColor() { 1.48607 + return this._type; 1.48608 + }, 1.48609 + set: function borderColor(value) { 1.48610 + somewhatImplemented('TextField.type'); 1.48611 + this._type = value; 1.48612 + } 1.48613 + }, 1.48614 + embedFonts: { 1.48615 + get: function embedFonts() { 1.48616 + return this._embedFonts; 1.48617 + }, 1.48618 + set: function embedFonts(value) { 1.48619 + this.invalidateDimensions(); 1.48620 + this._embedFonts = value; 1.48621 + } 1.48622 + }, 1.48623 + condenseWhite: { 1.48624 + get: function condenseWhite() { 1.48625 + return this._content.condenseWhite; 1.48626 + }, 1.48627 + set: function condenseWhite(value) { 1.48628 + somewhatImplemented('TextField.condenseWhite'); 1.48629 + this._content.condenseWhite = value; 1.48630 + } 1.48631 + }, 1.48632 + sharpness: { 1.48633 + get: function sharpness() { 1.48634 + return this._sharpness; 1.48635 + }, 1.48636 + set: function sharpness(value) { 1.48637 + somewhatImplemented('TextField.sharpness'); 1.48638 + this._sharpness = value; 1.48639 + } 1.48640 + } 1.48641 + } 1.48642 + } 1.48643 + }; 1.48644 + return def; 1.48645 + }.call(this); 1.48646 +function TextFieldContent(initialFormat) { 1.48647 + this.defaultTextFormat = initialFormat; 1.48648 + this.textWidth = 0; 1.48649 + this.textHeight = 0; 1.48650 + this.condenseWhite = false; 1.48651 + this.wordWrap = false; 1.48652 + this.multiline = false; 1.48653 + this.textColor = null; 1.48654 + this._text = ''; 1.48655 + this._htmlText = ''; 1.48656 + this._createTrunk(); 1.48657 + this._textRuns = null; 1.48658 + this._htmlParser = document.createElement('p'); 1.48659 + this._measureCtx = document.createElement('canvas').getContext('2d'); 1.48660 +} 1.48661 +TextFieldContent.knownNodeTypes = { 1.48662 + 'BR': true, 1.48663 + 'LI': true, 1.48664 + 'P': true, 1.48665 + 'B': true, 1.48666 + 'I': true, 1.48667 + 'FONT': true, 1.48668 + 'TEXTFORMAT': true, 1.48669 + 'U': true, 1.48670 + 'A': true, 1.48671 + 'IMG': true, 1.48672 + 'SPAN': true 1.48673 +}; 1.48674 +TextFieldContent.WRAP_OPPORTUNITIES = { 1.48675 + ' ': true, 1.48676 + '.': true, 1.48677 + '-': true, 1.48678 + '\t': true 1.48679 +}; 1.48680 +TextFieldContent.TextLine = function (y) { 1.48681 + this.x = 0; 1.48682 + this.width = 0; 1.48683 + this.y = y; 1.48684 + this.height = 0; 1.48685 + this.leading = 0; 1.48686 + this.runs = []; 1.48687 + this.largestFormat = null; 1.48688 +}; 1.48689 +TextFieldContent.prototype = { 1.48690 + get text() { 1.48691 + return this._text; 1.48692 + }, 1.48693 + set text(val) { 1.48694 + val = val + ''; 1.48695 + if (this._text === val) { 1.48696 + return; 1.48697 + } 1.48698 + var lines = []; 1.48699 + var lineOffset = 0; 1.48700 + for (var index = 0; index < val.length;) { 1.48701 + var char = val[index]; 1.48702 + if (char === '\r' || char === '\n') { 1.48703 + lines.push(val.substring(lineOffset, index)); 1.48704 + lineOffset = index; 1.48705 + if (char === '\r' && val[index + 1] === '\n') { 1.48706 + index++; 1.48707 + } 1.48708 + } 1.48709 + index++; 1.48710 + } 1.48711 + lines.push(val.substring(lineOffset, index)); 1.48712 + this._createTrunk(); 1.48713 + this._text = val; 1.48714 + this._htmlText = val; 1.48715 + this._tree.children[0].children[0] = { 1.48716 + type: 'plain-text', 1.48717 + lines: lines 1.48718 + }; 1.48719 + }, 1.48720 + get htmlText() { 1.48721 + return this._htmlText; 1.48722 + }, 1.48723 + set htmlText(val) { 1.48724 + if (this._htmlText === val) { 1.48725 + return; 1.48726 + } 1.48727 + this.defaultTextFormat.bold = false; 1.48728 + this.defaultTextFormat.italic = false; 1.48729 + this._parseHtml(val); 1.48730 + }, 1.48731 + calculateMetrics: function (bounds, embedFonts) { 1.48732 + var initialFormat = this.defaultTextFormat; 1.48733 + this.resolveFont(initialFormat, embedFonts); 1.48734 + this.lines = []; 1.48735 + this._textRuns = [ 1.48736 + { 1.48737 + type: 'f', 1.48738 + format: initialFormat 1.48739 + } 1.48740 + ]; 1.48741 + var width = Math.max(bounds.xMax / 20 - 4, 1); 1.48742 + var height = Math.max(bounds.yMax / 20 - 4, 1); 1.48743 + var state = { 1.48744 + ctx: this._measureCtx, 1.48745 + w: width, 1.48746 + h: height, 1.48747 + maxLineWidth: 0, 1.48748 + formats: [ 1.48749 + initialFormat 1.48750 + ], 1.48751 + currentFormat: initialFormat, 1.48752 + line: new TextFieldContent.TextLine(0), 1.48753 + wordWrap: this.wordWrap, 1.48754 + combinedAlign: null, 1.48755 + textColor: this.textColor, 1.48756 + embedFonts: embedFonts 1.48757 + }; 1.48758 + this._collectRuns(state, this._tree); 1.48759 + this._finishLine(state, false); 1.48760 + this.textWidth = state.maxLineWidth | 0; 1.48761 + this.textHeight = state.line.y | 0; 1.48762 + return state.combinedAlign; 1.48763 + }, 1.48764 + makeFormatString: function (format) { 1.48765 + var boldItalic = ''; 1.48766 + if (format.italic) { 1.48767 + boldItalic += 'italic'; 1.48768 + } 1.48769 + if (format.bold) { 1.48770 + boldItalic += ' bold'; 1.48771 + } 1.48772 + return boldItalic + ' ' + format.size + 'px ' + (format.font._uniqueName || format.font._fontName); 1.48773 + }, 1.48774 + resolveFont: function (format, embedded) { 1.48775 + var face = format.face.toLowerCase(); 1.48776 + if (face === '_sans') { 1.48777 + face = 'sans-serif'; 1.48778 + } else if (face === '_serif') { 1.48779 + face = 'serif'; 1.48780 + } else if (face === '_typewriter') { 1.48781 + face = 'monospace'; 1.48782 + } 1.48783 + var style; 1.48784 + if (format.bold) { 1.48785 + if (format.italic) { 1.48786 + style = 'boldItalic'; 1.48787 + } else { 1.48788 + style = 'bold'; 1.48789 + } 1.48790 + } else if (format.italic) { 1.48791 + style = 'italic'; 1.48792 + } else { 1.48793 + style = 'regular'; 1.48794 + } 1.48795 + var font = FontDefinition.getFont(face, style, embedded); 1.48796 + format.font = font; 1.48797 + }, 1.48798 + _parseHtml: function (val) { 1.48799 + this._htmlParser.innerHTML = val; 1.48800 + var rootElement = this._htmlParser.childNodes.length !== 1 ? this._htmlParser : this._htmlParser.childNodes[0]; 1.48801 + this._text = ''; 1.48802 + this._htmlText = val; 1.48803 + this._createTrunk(); 1.48804 + if (rootElement.nodeType === 3) { 1.48805 + this._convertNode(rootElement, this._tree.children[0].children); 1.48806 + } 1.48807 + var initialNodeList = [ 1.48808 + rootElement 1.48809 + ]; 1.48810 + var attributes; 1.48811 + var format; 1.48812 + var key; 1.48813 + if (initialNodeList.length == 1 && rootElement.localName.toUpperCase() == 'P') { 1.48814 + attributes = this._extractAttributes(rootElement); 1.48815 + format = this._tree.format; 1.48816 + for (key in attributes) { 1.48817 + format[key] = attributes[key]; 1.48818 + } 1.48819 + initialNodeList = rootElement.childNodes; 1.48820 + rootElement = rootElement.childNodes[0]; 1.48821 + } 1.48822 + if (initialNodeList.length == 1 && rootElement.localName.toUpperCase() == 'FONT') { 1.48823 + attributes = this._extractAttributes(rootElement); 1.48824 + format = this._tree.children[0].format; 1.48825 + for (key in attributes) { 1.48826 + format[key] = attributes[key]; 1.48827 + } 1.48828 + initialNodeList = rootElement.childNodes; 1.48829 + } 1.48830 + this._convertNodeList(initialNodeList, this._tree.children[0].children); 1.48831 + }, 1.48832 + _createTrunk: function () { 1.48833 + var initialFormat = this.defaultTextFormat; 1.48834 + this._tree = { 1.48835 + type: 'SPAN', 1.48836 + format: { 1.48837 + ALIGN: initialFormat.align 1.48838 + }, 1.48839 + children: [] 1.48840 + }; 1.48841 + var fontAttributes = { 1.48842 + FACE: initialFormat.face, 1.48843 + LETTERSPACING: initialFormat.letterSpacing, 1.48844 + KERNING: initialFormat.kerning, 1.48845 + LEADING: initialFormat.leading, 1.48846 + COLOR: initialFormat.color 1.48847 + }; 1.48848 + this._tree.children[0] = { 1.48849 + type: 'FONT', 1.48850 + format: fontAttributes, 1.48851 + children: [] 1.48852 + }; 1.48853 + }, 1.48854 + _convertNode: function (input, destinationList) { 1.48855 + if (!(input.nodeType === 1 || input.nodeType === 3) || input.prefix) { 1.48856 + return; 1.48857 + } 1.48858 + var node; 1.48859 + if (input.nodeType === 3) { 1.48860 + var text = input.textContent; 1.48861 + node = { 1.48862 + type: 'text', 1.48863 + text: text, 1.48864 + format: null, 1.48865 + children: null 1.48866 + }; 1.48867 + this._text += text; 1.48868 + destinationList.push(node); 1.48869 + return; 1.48870 + } 1.48871 + var nodeType = input.localName.toUpperCase(); 1.48872 + if (!TextFieldContent.knownNodeTypes[nodeType] || this.multiline === false && (nodeType === 'P' || nodeType === 'BR')) { 1.48873 + if (nodeType === 'SBR') { 1.48874 + destinationList.push({ 1.48875 + type: 'BR', 1.48876 + text: null, 1.48877 + format: null, 1.48878 + children: null 1.48879 + }); 1.48880 + } 1.48881 + this._convertNodeList(input.childNodes, destinationList); 1.48882 + return; 1.48883 + } 1.48884 + node = { 1.48885 + type: nodeType, 1.48886 + text: null, 1.48887 + format: this._extractAttributes(input), 1.48888 + children: [] 1.48889 + }; 1.48890 + this._convertNodeList(input.childNodes, node.children); 1.48891 + destinationList.push(node); 1.48892 + }, 1.48893 + _convertNodeList: function (from, to) { 1.48894 + var childCount = from.length; 1.48895 + for (var i = 0; i < childCount; i++) { 1.48896 + this._convertNode(from[i], to); 1.48897 + } 1.48898 + }, 1.48899 + _extractAttributes: function (node) { 1.48900 + var attributesList = node.attributes; 1.48901 + var attributesMap = {}; 1.48902 + for (var i = 0; i < attributesList.length; i++) { 1.48903 + var attr = attributesList[i]; 1.48904 + if (attr.prefix) { 1.48905 + continue; 1.48906 + } 1.48907 + attributesMap[attr.localName.toUpperCase()] = attr.value; 1.48908 + } 1.48909 + return attributesMap; 1.48910 + }, 1.48911 + _collectRuns: function (state, node) { 1.48912 + var formatNode = false; 1.48913 + var blockNode = false; 1.48914 + switch (node.type) { 1.48915 + case 'plain-text': 1.48916 + var lines = node.lines; 1.48917 + for (var i = 0; i < lines.length; i++) { 1.48918 + this._addRunsForText(state, lines[i]); 1.48919 + if (i < lines.length - 1) { 1.48920 + this._finishLine(state, true); 1.48921 + } 1.48922 + } 1.48923 + return; 1.48924 + case 'text': 1.48925 + this._addRunsForText(state, node.text); 1.48926 + return; 1.48927 + case 'BR': 1.48928 + this._finishLine(state, true); 1.48929 + return; 1.48930 + case 'LI': 1.48931 + case 'P': 1.48932 + this._finishLine(state, false); 1.48933 + this._pushFormat(state, node); 1.48934 + blockNode = true; 1.48935 + break; 1.48936 + case 'B': 1.48937 + case 'I': 1.48938 + case 'FONT': 1.48939 + case 'TEXTFORMAT': 1.48940 + this._pushFormat(state, node); 1.48941 + formatNode = true; 1.48942 + break; 1.48943 + case 'U': 1.48944 + case 'A': 1.48945 + case 'IMG': 1.48946 + case 'SPAN': 1.48947 + default: 1.48948 + } 1.48949 + for (var i = 0; i < node.children.length; i++) { 1.48950 + var child = node.children[i]; 1.48951 + this._collectRuns(state, child); 1.48952 + } 1.48953 + if (formatNode) { 1.48954 + this._popFormat(state); 1.48955 + } 1.48956 + if (blockNode) { 1.48957 + this._finishLine(state, true); 1.48958 + } 1.48959 + }, 1.48960 + _addRunsForText: function (state, text) { 1.48961 + if (!text) { 1.48962 + return; 1.48963 + } 1.48964 + if (!state.wordWrap) { 1.48965 + this._addTextRun(state, text, state.ctx.measureText(text).width); 1.48966 + return; 1.48967 + } 1.48968 + while (text.length) { 1.48969 + var width = state.ctx.measureText(text).width; 1.48970 + var availableWidth = state.w - state.line.width; 1.48971 + if (availableWidth <= 0) { 1.48972 + this._finishLine(state, false); 1.48973 + availableWidth = state.w - state.line.width; 1.48974 + } 1.48975 + if (width <= availableWidth) { 1.48976 + this._addTextRun(state, text, width); 1.48977 + break; 1.48978 + } else { 1.48979 + var offset = text.length / width * availableWidth | 0; 1.48980 + while (state.ctx.measureText(text.substr(0, offset)).width < availableWidth && offset < text.length) { 1.48981 + offset++; 1.48982 + } 1.48983 + var wrapOffset = offset; 1.48984 + while (wrapOffset > -1) { 1.48985 + if (TextFieldContent.WRAP_OPPORTUNITIES[text[wrapOffset]]) { 1.48986 + wrapOffset++; 1.48987 + break; 1.48988 + } 1.48989 + wrapOffset--; 1.48990 + } 1.48991 + if (wrapOffset === -1) { 1.48992 + if (state.line.width > 0) { 1.48993 + this._finishLine(state, false); 1.48994 + continue; 1.48995 + } 1.48996 + while (state.ctx.measureText(text.substr(0, offset)).width > availableWidth) { 1.48997 + offset--; 1.48998 + } 1.48999 + if (offset === 0) { 1.49000 + offset = 1; 1.49001 + } 1.49002 + wrapOffset = offset; 1.49003 + } 1.49004 + var runText = text.substr(0, wrapOffset); 1.49005 + width = state.ctx.measureText(runText).width; 1.49006 + this._addTextRun(state, runText, width); 1.49007 + if (state.wordWrap) { 1.49008 + this._finishLine(state, false); 1.49009 + } 1.49010 + text = text.substr(wrapOffset); 1.49011 + } 1.49012 + } 1.49013 + }, 1.49014 + _addTextRun: function (state, text, width) { 1.49015 + if (text.length === 0) { 1.49016 + return; 1.49017 + } 1.49018 + var line = state.line; 1.49019 + var format = state.currentFormat; 1.49020 + var size = format.size; 1.49021 + var run = { 1.49022 + type: 't', 1.49023 + text: text, 1.49024 + x: line.width 1.49025 + }; 1.49026 + this._textRuns.push(run); 1.49027 + state.line.runs.push(run); 1.49028 + line.width += width | 0; 1.49029 + if (line.leading === 0 && format.leading > line.leading) { 1.49030 + line.leading = format.leading; 1.49031 + } 1.49032 + if (!line.largestFormat || size > line.largestFormat.size) { 1.49033 + line.largestFormat = format; 1.49034 + } 1.49035 + }, 1.49036 + _finishLine: function (state, forceNewline) { 1.49037 + var line = state.line; 1.49038 + if (line.runs.length === 0) { 1.49039 + if (forceNewline) { 1.49040 + var format = state.currentFormat; 1.49041 + state.line.y += format.font._metrics.height * format.size + format.leading | 0; 1.49042 + } 1.49043 + return; 1.49044 + } 1.49045 + var runs = line.runs; 1.49046 + var format = line.largestFormat; 1.49047 + var baselinePos = line.y + format.font._metrics.ascent * format.size; 1.49048 + for (var i = runs.length; i--;) { 1.49049 + runs[i].y = baselinePos; 1.49050 + } 1.49051 + var align = (state.currentFormat.align || '').toLowerCase(); 1.49052 + if (state.combinedAlign === null) { 1.49053 + state.combinedAlign = align; 1.49054 + } else if (state.combinedAlign !== align) { 1.49055 + state.combinedAlign = 'mixed'; 1.49056 + } 1.49057 + if (align === 'center' || align === 'right') { 1.49058 + var offset = Math.max(state.w - line.width, 0); 1.49059 + if (align === 'center') { 1.49060 + offset >>= 1; 1.49061 + } 1.49062 + for (i = runs.length; i--;) { 1.49063 + runs[i].x += offset; 1.49064 + } 1.49065 + } 1.49066 + line.height = format.font._metrics.height * format.size + line.leading | 0; 1.49067 + state.maxLineWidth = Math.max(state.maxLineWidth, line.width); 1.49068 + this.lines.push(line); 1.49069 + state.line = new TextFieldContent.TextLine(line.y + line.height); 1.49070 + }, 1.49071 + _pushFormat: function (state, node) { 1.49072 + var attributes = node.format; 1.49073 + var format = Object.create(state.formats[state.formats.length - 1]); 1.49074 + var fontChanged = false; 1.49075 + switch (node.type) { 1.49076 + case 'P': 1.49077 + if (attributes.ALIGN === format.align) { 1.49078 + return; 1.49079 + } 1.49080 + format.align = attributes.ALIGN; 1.49081 + break; 1.49082 + case 'B': 1.49083 + format.bold = true; 1.49084 + fontChanged = true; 1.49085 + break; 1.49086 + case 'I': 1.49087 + format.italic = true; 1.49088 + fontChanged = true; 1.49089 + break; 1.49090 + case 'FONT': 1.49091 + if (attributes.COLOR !== undefined) { 1.49092 + format.color = attributes.COLOR; 1.49093 + } 1.49094 + if (attributes.FACE !== undefined) { 1.49095 + format.face = attributes.FACE; 1.49096 + fontChanged = true; 1.49097 + } 1.49098 + if (attributes.SIZE !== undefined) { 1.49099 + format.size = parseFloat(attributes.SIZE); 1.49100 + } 1.49101 + if (attributes.LETTERSPACING !== undefined) { 1.49102 + format.letterspacing = parseFloat(attributes.LETTERSPACING); 1.49103 + } 1.49104 + if (attributes.KERNING !== undefined) { 1.49105 + format.kerning = attributes.KERNING && true; 1.49106 + } 1.49107 + case 'TEXTFORMAT': 1.49108 + if (attributes.LEADING !== undefined) { 1.49109 + format.leading = parseFloat(attributes.LEADING); 1.49110 + } 1.49111 + if (attributes.INDENT !== undefined) { 1.49112 + state.line.x = attributes.INDENT; 1.49113 + state.line.width += attributes.INDENT | 0; 1.49114 + } 1.49115 + break; 1.49116 + default: 1.49117 + warning('Unknown format node encountered: ' + node.type); 1.49118 + return; 1.49119 + } 1.49120 + if (state.textColor !== null) { 1.49121 + format.color = rgbIntAlphaToStr(state.textColor, 1); 1.49122 + } 1.49123 + if (fontChanged) { 1.49124 + this.resolveFont(format, state.embedFonts); 1.49125 + } 1.49126 + format.str = this.makeFormatString(format); 1.49127 + state.formats.push(format); 1.49128 + this._textRuns.push({ 1.49129 + type: 'f', 1.49130 + format: format 1.49131 + }); 1.49132 + state.currentFormat = format; 1.49133 + state.ctx.font = format.str; 1.49134 + }, 1.49135 + _popFormat: function (state) { 1.49136 + state.formats.pop(); 1.49137 + var format = state.currentFormat = state.formats[state.formats.length - 1]; 1.49138 + this._textRuns.push({ 1.49139 + type: 'f', 1.49140 + format: format 1.49141 + }); 1.49142 + state.ctx.font = state.str; 1.49143 + } 1.49144 +}; 1.49145 +var TextFormatDefinition = function () { 1.49146 + var measureTextField; 1.49147 + return { 1.49148 + __class__: 'flash.text.TextFormat', 1.49149 + initialize: function () { 1.49150 + }, 1.49151 + fromObject: function (obj) { 1.49152 + this._font = obj.face || null; 1.49153 + this._size = typeof obj.size === 'number' ? obj.size : null; 1.49154 + this._color = typeof obj.color === 'number' ? obj.color : null; 1.49155 + this._bold = typeof obj.bold === 'boolean' ? obj.bold : null; 1.49156 + this._italic = typeof obj.italic === 'boolean' ? obj.italic : null; 1.49157 + this._underline = typeof obj.underline === 'boolean' ? obj.underline : null; 1.49158 + this._url = obj.url || null; 1.49159 + this._target = obj.target || null; 1.49160 + this._align = obj.align || null; 1.49161 + this._leftMargin = typeof obj.leftMargin === 'number' ? obj.leftMargin : null; 1.49162 + this._rightMargin = typeof obj.rightMargin === 'number' ? obj.rightMargin : null; 1.49163 + this._indent = typeof obj.indent === 'number' ? obj.indent : null; 1.49164 + this._leading = typeof obj.leading === 'number' ? obj.leading : null; 1.49165 + return this; 1.49166 + }, 1.49167 + toObject: function () { 1.49168 + return { 1.49169 + face: this._font || 'serif', 1.49170 + size: this._size || 12, 1.49171 + color: this._color || 0, 1.49172 + bold: this._bold || false, 1.49173 + italic: this._italic || false, 1.49174 + underline: this._underline || false, 1.49175 + url: this._url, 1.49176 + target: this._target, 1.49177 + align: this._align || 'left', 1.49178 + leftMargin: this._leftMargin || 0, 1.49179 + rightMargin: this._rightMargin || 0, 1.49180 + indent: this._indent || 0, 1.49181 + leading: this._leading || 0 1.49182 + }; 1.49183 + }, 1.49184 + as2GetTextExtent: function (text, width) { 1.49185 + if (!measureTextField) { 1.49186 + measureTextField = new flash.text.TextField(); 1.49187 + measureTextField._multiline = true; 1.49188 + } 1.49189 + if (!isNaN(width) && width > 0) { 1.49190 + measureTextField.width = width + 4; 1.49191 + measureTextField._wordWrap = true; 1.49192 + } else { 1.49193 + measureTextField._wordWrap = false; 1.49194 + } 1.49195 + measureTextField.defaultTextFormat = this; 1.49196 + measureTextField.text = text; 1.49197 + measureTextField.ensureDimensions(); 1.49198 + var result = {}; 1.49199 + var textWidth = measureTextField._textWidth; 1.49200 + var textHeight = measureTextField._textHeight; 1.49201 + result.asSetPublicProperty('width', textWidth); 1.49202 + result.asSetPublicProperty('height', textHeight); 1.49203 + result.asSetPublicProperty('textFieldWidth', textWidth + 4); 1.49204 + result.asSetPublicProperty('textFieldHeight', textHeight + 4); 1.49205 + var metrics = measureTextField.getLineMetrics(0); 1.49206 + result.asSetPublicProperty('ascent', metrics.asGetPublicProperty('ascent')); 1.49207 + result.asSetPublicProperty('descent', metrics.asGetPublicProperty('descent')); 1.49208 + return result; 1.49209 + }, 1.49210 + __glue__: { 1.49211 + native: { 1.49212 + static: {}, 1.49213 + instance: { 1.49214 + align: { 1.49215 + get: function align() { 1.49216 + return this._align; 1.49217 + }, 1.49218 + set: function align(value) { 1.49219 + this._align = value; 1.49220 + } 1.49221 + }, 1.49222 + blockIndent: { 1.49223 + get: function blockIndent() { 1.49224 + return this._blockIndent; 1.49225 + }, 1.49226 + set: function blockIndent(value) { 1.49227 + this._blockIndent = value; 1.49228 + } 1.49229 + }, 1.49230 + bold: { 1.49231 + get: function bold() { 1.49232 + return this._bold; 1.49233 + }, 1.49234 + set: function bold(value) { 1.49235 + this._bold = value; 1.49236 + } 1.49237 + }, 1.49238 + bullet: { 1.49239 + get: function bullet() { 1.49240 + return this._bullet; 1.49241 + }, 1.49242 + set: function bullet(value) { 1.49243 + this._bullet = value; 1.49244 + } 1.49245 + }, 1.49246 + color: { 1.49247 + get: function color() { 1.49248 + return this._color; 1.49249 + }, 1.49250 + set: function color(value) { 1.49251 + this._color = value; 1.49252 + } 1.49253 + }, 1.49254 + display: { 1.49255 + get: function display() { 1.49256 + return this._display; 1.49257 + }, 1.49258 + set: function display(value) { 1.49259 + this._display = value; 1.49260 + } 1.49261 + }, 1.49262 + font: { 1.49263 + get: function font() { 1.49264 + return this._font; 1.49265 + }, 1.49266 + set: function font(value) { 1.49267 + this._font = value; 1.49268 + } 1.49269 + }, 1.49270 + indent: { 1.49271 + get: function indent() { 1.49272 + return this._indent; 1.49273 + }, 1.49274 + set: function indent(value) { 1.49275 + this._indent = value; 1.49276 + } 1.49277 + }, 1.49278 + italic: { 1.49279 + get: function italic() { 1.49280 + return this._italic; 1.49281 + }, 1.49282 + set: function italic(value) { 1.49283 + this._italic = value; 1.49284 + } 1.49285 + }, 1.49286 + kerning: { 1.49287 + get: function kerning() { 1.49288 + return this._kerning; 1.49289 + }, 1.49290 + set: function kerning(value) { 1.49291 + this._kerning = value; 1.49292 + } 1.49293 + }, 1.49294 + leading: { 1.49295 + get: function leading() { 1.49296 + return this._leading; 1.49297 + }, 1.49298 + set: function leading(value) { 1.49299 + this._leading = value; 1.49300 + } 1.49301 + }, 1.49302 + leftMargin: { 1.49303 + get: function leftMargin() { 1.49304 + return this._leftMargin; 1.49305 + }, 1.49306 + set: function leftMargin(value) { 1.49307 + this._leftMargin = value; 1.49308 + } 1.49309 + }, 1.49310 + letterSpacing: { 1.49311 + get: function letterSpacing() { 1.49312 + return this._letterSpacing; 1.49313 + }, 1.49314 + set: function letterSpacing(value) { 1.49315 + this._letterSpacing = value; 1.49316 + } 1.49317 + }, 1.49318 + rightMargin: { 1.49319 + get: function rightMargin() { 1.49320 + return this._rightMargin; 1.49321 + }, 1.49322 + set: function rightMargin(value) { 1.49323 + this._rightMargin = value; 1.49324 + } 1.49325 + }, 1.49326 + size: { 1.49327 + get: function size() { 1.49328 + return this._size; 1.49329 + }, 1.49330 + set: function size(value) { 1.49331 + this._size = value; 1.49332 + } 1.49333 + }, 1.49334 + tabStops: { 1.49335 + get: function tabStops() { 1.49336 + return this._tabStops; 1.49337 + }, 1.49338 + set: function tabStops(value) { 1.49339 + this._tabStops = value; 1.49340 + } 1.49341 + }, 1.49342 + target: { 1.49343 + get: function target() { 1.49344 + return this._target; 1.49345 + }, 1.49346 + set: function target(value) { 1.49347 + this._target = value; 1.49348 + } 1.49349 + }, 1.49350 + underline: { 1.49351 + get: function underline() { 1.49352 + return this._underline; 1.49353 + }, 1.49354 + set: function underline(value) { 1.49355 + this._underline = value; 1.49356 + } 1.49357 + }, 1.49358 + url: { 1.49359 + get: function url() { 1.49360 + return this._url; 1.49361 + }, 1.49362 + set: function url(value) { 1.49363 + this._url = value; 1.49364 + } 1.49365 + } 1.49366 + } 1.49367 + } 1.49368 + } 1.49369 + }; 1.49370 + }.call(this); 1.49371 +var ContentElementDefinition = function () { 1.49372 + return { 1.49373 + __class__: 'flash.text.engine.ContentElement', 1.49374 + initialize: function () { 1.49375 + }, 1.49376 + __glue__: { 1.49377 + native: { 1.49378 + static: {}, 1.49379 + instance: { 1.49380 + textBlock: { 1.49381 + get: function textBlock() { 1.49382 + notImplemented('ContentElement.textBlock'); 1.49383 + return this._textBlock; 1.49384 + } 1.49385 + }, 1.49386 + textBlockBeginIndex: { 1.49387 + get: function textBlockBeginIndex() { 1.49388 + notImplemented('ContentElement.textBlockBeginIndex'); 1.49389 + return this._textBlockBeginIndex; 1.49390 + } 1.49391 + }, 1.49392 + elementFormat: { 1.49393 + get: function elementFormat() { 1.49394 + return this._elementFormat; 1.49395 + }, 1.49396 + set: function elementFormat(value) { 1.49397 + somewhatImplemented('ContentElement.elementFormat'); 1.49398 + this._elementFormat = value; 1.49399 + } 1.49400 + }, 1.49401 + eventMirror: { 1.49402 + get: function eventMirror() { 1.49403 + return this._eventMirror; 1.49404 + }, 1.49405 + set: function eventMirror(value) { 1.49406 + somewhatImplemented('ContentElement.eventMirror'); 1.49407 + this._eventMirror = value; 1.49408 + } 1.49409 + }, 1.49410 + groupElement: { 1.49411 + get: function groupElement() { 1.49412 + notImplemented('ContentElement.groupElement'); 1.49413 + return this._groupElement; 1.49414 + } 1.49415 + }, 1.49416 + rawText: { 1.49417 + get: function rawText() { 1.49418 + notImplemented('ContentElement.rawText'); 1.49419 + return this._rawText; 1.49420 + } 1.49421 + }, 1.49422 + text: { 1.49423 + get: function text() { 1.49424 + notImplemented('ContentElement.text'); 1.49425 + return this._text; 1.49426 + } 1.49427 + }, 1.49428 + textRotation: { 1.49429 + get: function textRotation() { 1.49430 + return this._textRotation; 1.49431 + }, 1.49432 + set: function textRotation(value) { 1.49433 + somewhatImplemented('ContentElement.textRotation'); 1.49434 + this._textRotation = value; 1.49435 + } 1.49436 + } 1.49437 + } 1.49438 + } 1.49439 + } 1.49440 + }; 1.49441 + }.call(this); 1.49442 +var ElementFormatDefinition = function () { 1.49443 + return { 1.49444 + __class__: 'flash.text.engine.ElementFormat', 1.49445 + initialize: function () { 1.49446 + }, 1.49447 + __glue__: { 1.49448 + native: { 1.49449 + static: {}, 1.49450 + instance: { 1.49451 + getFontMetrics: function getFontMetrics() { 1.49452 + notImplemented('ElementFormat.getFontMetrics'); 1.49453 + }, 1.49454 + alignmentBaseline: { 1.49455 + get: function alignmentBaseline() { 1.49456 + return this._alignmentBaseline; 1.49457 + }, 1.49458 + set: function alignmentBaseline(alignmentBaseline) { 1.49459 + somewhatImplemented('ElementFormat.alignmentBaseline'); 1.49460 + this._alignmentBaseline = alignmentBaseline; 1.49461 + } 1.49462 + }, 1.49463 + alpha: { 1.49464 + get: function alpha() { 1.49465 + return this._alpha; 1.49466 + }, 1.49467 + set: function alpha(value) { 1.49468 + somewhatImplemented('ElementFormat.alpha'); 1.49469 + this._alpha = value; 1.49470 + } 1.49471 + }, 1.49472 + baselineShift: { 1.49473 + get: function baselineShift() { 1.49474 + return this._baselineShift; 1.49475 + }, 1.49476 + set: function baselineShift(value) { 1.49477 + somewhatImplemented('ElementFormat.baselineShift'); 1.49478 + this._baselineShift = value; 1.49479 + } 1.49480 + }, 1.49481 + breakOpportunity: { 1.49482 + get: function breakOpportunity() { 1.49483 + return this._breakOpportunity; 1.49484 + }, 1.49485 + set: function breakOpportunity(opportunityType) { 1.49486 + somewhatImplemented('ElementFormat.breakOpportunity'); 1.49487 + this._breakOpportunity = opportunityType; 1.49488 + } 1.49489 + }, 1.49490 + color: { 1.49491 + get: function color() { 1.49492 + return this._color; 1.49493 + }, 1.49494 + set: function color(value) { 1.49495 + somewhatImplemented('ElementFormat.color'); 1.49496 + this._color = value; 1.49497 + } 1.49498 + }, 1.49499 + dominantBaseline: { 1.49500 + get: function dominantBaseline() { 1.49501 + return this._dominantBaseline; 1.49502 + }, 1.49503 + set: function dominantBaseline(dominantBaseline) { 1.49504 + somewhatImplemented('ElementFormat.dominantBaseline'); 1.49505 + this._dominantBaseline = dominantBaseline; 1.49506 + } 1.49507 + }, 1.49508 + fontDescription: { 1.49509 + get: function fontDescription() { 1.49510 + return this._fontDescription; 1.49511 + }, 1.49512 + set: function fontDescription(value) { 1.49513 + somewhatImplemented('ElementFormat.fontDescription'); 1.49514 + this._fontDescription = value; 1.49515 + } 1.49516 + }, 1.49517 + digitCase: { 1.49518 + get: function digitCase() { 1.49519 + return this._digitCase; 1.49520 + }, 1.49521 + set: function digitCase(digitCaseType) { 1.49522 + somewhatImplemented('ElementFormat.digitCase'); 1.49523 + this._digitCase = digitCaseType; 1.49524 + } 1.49525 + }, 1.49526 + digitWidth: { 1.49527 + get: function digitWidth() { 1.49528 + return this._digitWidth; 1.49529 + }, 1.49530 + set: function digitWidth(digitWidthType) { 1.49531 + somewhatImplemented('ElementFormat.digitWidth'); 1.49532 + this._digitWidth = digitWidthType; 1.49533 + } 1.49534 + }, 1.49535 + ligatureLevel: { 1.49536 + get: function ligatureLevel() { 1.49537 + return this._ligatureLevel; 1.49538 + }, 1.49539 + set: function ligatureLevel(ligatureLevelType) { 1.49540 + somewhatImplemented('ElementFormat.ligatureLevel'); 1.49541 + this._ligatureLevel = ligatureLevelType; 1.49542 + } 1.49543 + }, 1.49544 + fontSize: { 1.49545 + get: function fontSize() { 1.49546 + return this._fontSize; 1.49547 + }, 1.49548 + set: function fontSize(value) { 1.49549 + somewhatImplemented('ElementFormat.fontSize'); 1.49550 + this._fontSize = value; 1.49551 + } 1.49552 + }, 1.49553 + kerning: { 1.49554 + get: function kerning() { 1.49555 + return this._kerning; 1.49556 + }, 1.49557 + set: function kerning(value) { 1.49558 + somewhatImplemented('ElementFormat.kerning'); 1.49559 + this._kerning = value; 1.49560 + } 1.49561 + }, 1.49562 + locale: { 1.49563 + get: function locale() { 1.49564 + return this._locale; 1.49565 + }, 1.49566 + set: function locale(value) { 1.49567 + somewhatImplemented('ElementFormat.locale'); 1.49568 + this._locale = value; 1.49569 + } 1.49570 + }, 1.49571 + textRotation: { 1.49572 + get: function textRotation() { 1.49573 + return this._textRotation; 1.49574 + }, 1.49575 + set: function textRotation(value) { 1.49576 + somewhatImplemented('ElementFormat.textRotation'); 1.49577 + this._textRotation = value; 1.49578 + } 1.49579 + }, 1.49580 + trackingRight: { 1.49581 + get: function trackingRight() { 1.49582 + return this._trackingRight; 1.49583 + }, 1.49584 + set: function trackingRight(value) { 1.49585 + somewhatImplemented('ElementFormat.trackingRight'); 1.49586 + this._trackingRight = value; 1.49587 + } 1.49588 + }, 1.49589 + trackingLeft: { 1.49590 + get: function trackingLeft() { 1.49591 + return this._trackingLeft; 1.49592 + }, 1.49593 + set: function trackingLeft(value) { 1.49594 + somewhatImplemented('ElementFormat.trackingLeft'); 1.49595 + this._trackingLeft = value; 1.49596 + } 1.49597 + }, 1.49598 + typographicCase: { 1.49599 + get: function typographicCase() { 1.49600 + return this._typographicCase; 1.49601 + }, 1.49602 + set: function typographicCase(typographicCaseType) { 1.49603 + somewhatImplemented('ElementFormat.typographicCase'); 1.49604 + this._typographicCase = typographicCaseType; 1.49605 + } 1.49606 + }, 1.49607 + locked: { 1.49608 + get: function locked() { 1.49609 + notImplemented('ElementFormat.locked'); 1.49610 + return this._locked; 1.49611 + }, 1.49612 + set: function locked(value) { 1.49613 + notImplemented('ElementFormat.locked'); 1.49614 + this._locked = value; 1.49615 + } 1.49616 + } 1.49617 + } 1.49618 + } 1.49619 + } 1.49620 + }; 1.49621 + }.call(this); 1.49622 +var FontDescriptionDefinition = function () { 1.49623 + return { 1.49624 + __class__: 'flash.text.engine.FontDescription', 1.49625 + initialize: function () { 1.49626 + }, 1.49627 + __glue__: { 1.49628 + native: { 1.49629 + static: { 1.49630 + isFontCompatible: function isFontCompatible(fontName, fontWeight, fontPosture) { 1.49631 + notImplemented('FontDescription.isFontCompatible'); 1.49632 + }, 1.49633 + isDeviceFontCompatible: function isDeviceFontCompatible(fontName, fontWeight, fontPosture) { 1.49634 + notImplemented('FontDescription.isDeviceFontCompatible'); 1.49635 + } 1.49636 + }, 1.49637 + instance: { 1.49638 + renderingMode: { 1.49639 + get: function renderingMode() { 1.49640 + return this._renderingMode; 1.49641 + }, 1.49642 + set: function renderingMode(value) { 1.49643 + somewhatImplemented('FontDescription.renderingMode'); 1.49644 + this._renderingMode = value; 1.49645 + } 1.49646 + }, 1.49647 + fontLookup: { 1.49648 + get: function fontLookup() { 1.49649 + return this._fontLookup; 1.49650 + }, 1.49651 + set: function fontLookup(value) { 1.49652 + somewhatImplemented('FontDescription.fontLookup'); 1.49653 + this._fontLookup = value; 1.49654 + } 1.49655 + }, 1.49656 + fontName: { 1.49657 + get: function fontName() { 1.49658 + return this._fontName; 1.49659 + }, 1.49660 + set: function fontName(value) { 1.49661 + somewhatImplemented('FontDescription.fontName'); 1.49662 + this._fontName = value; 1.49663 + } 1.49664 + }, 1.49665 + fontPosture: { 1.49666 + get: function fontPosture() { 1.49667 + return this._fontPosture; 1.49668 + }, 1.49669 + set: function fontPosture(value) { 1.49670 + somewhatImplemented('FontDescription.fontPosture'); 1.49671 + this._fontPosture = value; 1.49672 + } 1.49673 + }, 1.49674 + fontWeight: { 1.49675 + get: function fontWeight() { 1.49676 + return this._fontWeight; 1.49677 + }, 1.49678 + set: function fontWeight(value) { 1.49679 + somewhatImplemented('FontDescription.fontWeight'); 1.49680 + this._fontWeight = value; 1.49681 + } 1.49682 + }, 1.49683 + cffHinting: { 1.49684 + get: function cffHinting() { 1.49685 + return this._cffHinting; 1.49686 + }, 1.49687 + set: function cffHinting(value) { 1.49688 + somewhatImplemented('FontDescription.cffHinting'); 1.49689 + this._cffHinting = value; 1.49690 + } 1.49691 + }, 1.49692 + locked: { 1.49693 + get: function locked() { 1.49694 + notImplemented('FontDescription.locked'); 1.49695 + return this._locked; 1.49696 + }, 1.49697 + set: function locked(value) { 1.49698 + notImplemented('FontDescription.locked'); 1.49699 + this._locked = value; 1.49700 + } 1.49701 + } 1.49702 + } 1.49703 + }, 1.49704 + script: { 1.49705 + static: {}, 1.49706 + instance: {} 1.49707 + } 1.49708 + } 1.49709 + }; 1.49710 + }.call(this); 1.49711 +var GroupElementDefinition = function () { 1.49712 + return { 1.49713 + __class__: 'flash.text.engine.GroupElement', 1.49714 + initialize: function () { 1.49715 + }, 1.49716 + __glue__: { 1.49717 + native: { 1.49718 + static: {}, 1.49719 + instance: { 1.49720 + getElementAt: function getElementAt(index) { 1.49721 + notImplemented('GroupElement.getElementAt'); 1.49722 + }, 1.49723 + setElements: function setElements(value) { 1.49724 + somewhatImplemented('GroupElement.setElements'); 1.49725 + this._elements = value; 1.49726 + }, 1.49727 + groupElements: function groupElements(beginIndex, endIndex) { 1.49728 + notImplemented('GroupElement.groupElements'); 1.49729 + }, 1.49730 + ungroupElements: function ungroupElements(groupIndex) { 1.49731 + notImplemented('GroupElement.ungroupElements'); 1.49732 + }, 1.49733 + mergeTextElements: function mergeTextElements(beginIndex, endIndex) { 1.49734 + notImplemented('GroupElement.mergeTextElements'); 1.49735 + }, 1.49736 + splitTextElement: function splitTextElement(elementIndex, splitIndex) { 1.49737 + notImplemented('GroupElement.splitTextElement'); 1.49738 + }, 1.49739 + replaceElements: function replaceElements(beginIndex, endIndex, newElements) { 1.49740 + notImplemented('GroupElement.replaceElements'); 1.49741 + }, 1.49742 + getElementAtCharIndex: function getElementAtCharIndex(charIndex) { 1.49743 + notImplemented('GroupElement.getElementAtCharIndex'); 1.49744 + }, 1.49745 + elementCount: { 1.49746 + get: function elementCount() { 1.49747 + notImplemented('GroupElement.elementCount'); 1.49748 + return this._elementCount; 1.49749 + } 1.49750 + } 1.49751 + } 1.49752 + } 1.49753 + } 1.49754 + }; 1.49755 + }.call(this); 1.49756 +var SpaceJustifierDefinition = function () { 1.49757 + return { 1.49758 + __class__: 'flash.text.engine.SpaceJustifier', 1.49759 + initialize: function () { 1.49760 + this._letterSpacing = false; 1.49761 + this._optimumSpacing = 1; 1.49762 + this._minimumSpacing = 0.5; 1.49763 + this._maximumSpacing = 1.5; 1.49764 + }, 1.49765 + __glue__: { 1.49766 + native: { 1.49767 + static: {}, 1.49768 + instance: { 1.49769 + cloneSpacing: function cloneSpacing(justifier) { 1.49770 + somewhatImplemented('SpaceJustifier.cloneSpacing'); 1.49771 + justifier._optimumSpacing = this._optimumSpacing; 1.49772 + justifier._minimumSpacing = this._minimumSpacing; 1.49773 + justifier._maximumSpacing = this._maximumSpacing; 1.49774 + }, 1.49775 + letterSpacing: { 1.49776 + get: function letterSpacing() { 1.49777 + return this._letterSpacing; 1.49778 + }, 1.49779 + set: function letterSpacing(value) { 1.49780 + somewhatImplemented('SpaceJustifier.letterSpacing'); 1.49781 + this._letterSpacing = value; 1.49782 + } 1.49783 + }, 1.49784 + minimumSpacing: { 1.49785 + get: function minimumSpacing() { 1.49786 + return this._minimumSpacing; 1.49787 + }, 1.49788 + set: function minimumSpacing(value) { 1.49789 + somewhatImplemented('SpaceJustifier.minimumSpacing'); 1.49790 + this._minimumSpacing = value; 1.49791 + } 1.49792 + }, 1.49793 + optimumSpacing: { 1.49794 + get: function optimumSpacing() { 1.49795 + return this._optimumSpacing; 1.49796 + }, 1.49797 + set: function optimumSpacing(value) { 1.49798 + somewhatImplemented('SpaceJustifier.optimumSpacing'); 1.49799 + this._optimumSpacing = value; 1.49800 + } 1.49801 + }, 1.49802 + maximumSpacing: { 1.49803 + get: function maximumSpacing() { 1.49804 + return this._maximumSpacing; 1.49805 + }, 1.49806 + set: function maximumSpacing(value) { 1.49807 + somewhatImplemented('SpaceJustifier.maximumSpacing'); 1.49808 + this._maximumSpacing = value; 1.49809 + } 1.49810 + } 1.49811 + } 1.49812 + } 1.49813 + } 1.49814 + }; 1.49815 + }.call(this); 1.49816 +var TextBlockDefinition = function () { 1.49817 + return { 1.49818 + __class__: 'flash.text.engine.TextBlock', 1.49819 + initialize: function () { 1.49820 + this._firstLine = null; 1.49821 + this._lastLine = null; 1.49822 + }, 1.49823 + __glue__: { 1.49824 + native: { 1.49825 + static: {}, 1.49826 + instance: { 1.49827 + getTextJustifier: function getTextJustifier() { 1.49828 + return this._textJustifier; 1.49829 + }, 1.49830 + setTextJustifier: function setTextJustifier(value) { 1.49831 + somewhatImplemented('TextBlock.setTextJustifier'); 1.49832 + this._textJustifier = value; 1.49833 + }, 1.49834 + getTabStops: function getTabStops() { 1.49835 + return this._tabStops; 1.49836 + }, 1.49837 + setTabStops: function setTabStops(value) { 1.49838 + somewhatImplemented('TextBlock.setTabStops'); 1.49839 + this._tabStops = value; 1.49840 + }, 1.49841 + findNextAtomBoundary: function findNextAtomBoundary(afterCharIndex) { 1.49842 + notImplemented('TextBlock.findNextAtomBoundary'); 1.49843 + }, 1.49844 + findPreviousAtomBoundary: function findPreviousAtomBoundary(beforeCharIndex) { 1.49845 + notImplemented('TextBlock.findPreviousAtomBoundary'); 1.49846 + }, 1.49847 + findNextWordBoundary: function findNextWordBoundary(afterCharIndex) { 1.49848 + notImplemented('TextBlock.findNextWordBoundary'); 1.49849 + }, 1.49850 + findPreviousWordBoundary: function findPreviousWordBoundary(beforeCharIndex) { 1.49851 + notImplemented('TextBlock.findPreviousWordBoundary'); 1.49852 + }, 1.49853 + getTextLineAtCharIndex: function getTextLineAtCharIndex(charIndex) { 1.49854 + notImplemented('TextBlock.getTextLineAtCharIndex'); 1.49855 + }, 1.49856 + DoCreateTextLine: function DoCreateTextLine(previousLine, width, lineOffset, fitSomething, reuseLine) { 1.49857 + somewhatImplemented('TextBlock.DoCreateTextLine'); 1.49858 + if (previousLine) { 1.49859 + return null; 1.49860 + } 1.49861 + var textLine = new flash.text.engine.TextLine(); 1.49862 + textLine._textBlock = this; 1.49863 + textLine._specifiedWidth = width; 1.49864 + textLine._rawTextLength = 0; 1.49865 + textLine._textWidth = 0; 1.49866 + textLine._textHeight = 0; 1.49867 + textLine._ascent = 0; 1.49868 + textLine._descent = 0; 1.49869 + textLine._unjustifiedTextWidth = 0; 1.49870 + textLine._validity = 'valid'; 1.49871 + textLine._previousLine = null; 1.49872 + textLine._nextLine = null; 1.49873 + this._firstLine = textLine; 1.49874 + this._lastLine = textLine; 1.49875 + return textLine; 1.49876 + }, 1.49877 + releaseLineCreationData: function releaseLineCreationData() { 1.49878 + notImplemented('TextBlock.releaseLineCreationData'); 1.49879 + }, 1.49880 + releaseLines: function releaseLines(firstLine, lastLine) { 1.49881 + notImplemented('TextBlock.releaseLines'); 1.49882 + }, 1.49883 + dump: function dump() { 1.49884 + notImplemented('TextBlock.dump'); 1.49885 + }, 1.49886 + applyNonLinearFontScaling: { 1.49887 + get: function applyNonLinearFontScaling() { 1.49888 + return this._applyNonLinearFontScaling; 1.49889 + }, 1.49890 + set: function applyNonLinearFontScaling(value) { 1.49891 + somewhatImplemented('TextBlock.applyNonLinearFontScaling'); 1.49892 + this._applyNonLinearFontScaling = value; 1.49893 + } 1.49894 + }, 1.49895 + baselineFontDescription: { 1.49896 + get: function baselineFontDescription() { 1.49897 + return this._baselineFontDescription; 1.49898 + }, 1.49899 + set: function baselineFontDescription(value) { 1.49900 + somewhatImplemented('TextBlock.baselineFontDescription'); 1.49901 + this._baselineFontDescription = value; 1.49902 + } 1.49903 + }, 1.49904 + baselineFontSize: { 1.49905 + get: function baselineFontSize() { 1.49906 + return this._baselineFontSize; 1.49907 + }, 1.49908 + set: function baselineFontSize(value) { 1.49909 + somewhatImplemented('TextBlock.baselineFontSize'); 1.49910 + this._baselineFontSize = value; 1.49911 + } 1.49912 + }, 1.49913 + baselineZero: { 1.49914 + get: function baselineZero() { 1.49915 + return this._baselineZero; 1.49916 + }, 1.49917 + set: function baselineZero(value) { 1.49918 + somewhatImplemented('TextBlock.baselineZero'); 1.49919 + this._baselineZero = value; 1.49920 + } 1.49921 + }, 1.49922 + content: { 1.49923 + get: function content() { 1.49924 + return this._content; 1.49925 + }, 1.49926 + set: function content(value) { 1.49927 + somewhatImplemented('TextBlock.content'); 1.49928 + this._content = value; 1.49929 + } 1.49930 + }, 1.49931 + bidiLevel: { 1.49932 + get: function bidiLevel() { 1.49933 + return this._bidiLevel; 1.49934 + }, 1.49935 + set: function bidiLevel(value) { 1.49936 + somewhatImplemented('TextBlock.bidiLevel'); 1.49937 + this._bidiLevel = value; 1.49938 + } 1.49939 + }, 1.49940 + firstInvalidLine: { 1.49941 + get: function firstInvalidLine() { 1.49942 + notImplemented('TextBlock.firstInvalidLine'); 1.49943 + return this._firstInvalidLine; 1.49944 + } 1.49945 + }, 1.49946 + firstLine: { 1.49947 + get: function firstLine() { 1.49948 + somewhatImplemented('TextBlock.firstLine'); 1.49949 + return this._firstLine; 1.49950 + } 1.49951 + }, 1.49952 + lastLine: { 1.49953 + get: function lastLine() { 1.49954 + somewhatImplemented('TextBlock.lastLine'); 1.49955 + return this._lastLine; 1.49956 + } 1.49957 + }, 1.49958 + textLineCreationResult: { 1.49959 + get: function textLineCreationResult() { 1.49960 + notImplemented('TextBlock.textLineCreationResult'); 1.49961 + return this._textLineCreationResult; 1.49962 + } 1.49963 + }, 1.49964 + lineRotation: { 1.49965 + get: function lineRotation() { 1.49966 + return this._lineRotation; 1.49967 + }, 1.49968 + set: function lineRotation(value) { 1.49969 + somewhatImplemented('TextBlock.lineRotation'); 1.49970 + this._lineRotation = value; 1.49971 + } 1.49972 + } 1.49973 + } 1.49974 + } 1.49975 + } 1.49976 + }; 1.49977 + }.call(this); 1.49978 +var TextElementDefinition = function () { 1.49979 + return { 1.49980 + __class__: 'flash.text.engine.TextElement', 1.49981 + initialize: function () { 1.49982 + }, 1.49983 + __glue__: { 1.49984 + native: { 1.49985 + static: {}, 1.49986 + instance: { 1.49987 + replaceText: function replaceText(beginIndex, endIndex, newText) { 1.49988 + somewhatImplemented('TextElement.replaceText'); 1.49989 + var text = this._text || ''; 1.49990 + this._text = text.slice(0, beginIndex) + newText + text.slice(endIndex); 1.49991 + }, 1.49992 + text: { 1.49993 + set: function text(value) { 1.49994 + somewhatImplemented('TextElement.text'); 1.49995 + this._text = value; 1.49996 + } 1.49997 + } 1.49998 + } 1.49999 + } 1.50000 + } 1.50001 + }; 1.50002 + }.call(this); 1.50003 +var TextJustifierDefinition = function () { 1.50004 + return { 1.50005 + __class__: 'flash.text.engine.TextJustifier', 1.50006 + initialize: function () { 1.50007 + this._locale = null; 1.50008 + this._lineJustification = null; 1.50009 + }, 1.50010 + __glue__: { 1.50011 + native: { 1.50012 + static: {}, 1.50013 + instance: { 1.50014 + setLocale: function setLocale(value) { 1.50015 + somewhatImplemented('TextJustifier.setLocale'); 1.50016 + this._locale = value; 1.50017 + }, 1.50018 + locale: { 1.50019 + get: function locale() { 1.50020 + return this._locale; 1.50021 + } 1.50022 + }, 1.50023 + lineJustification: { 1.50024 + get: function lineJustification() { 1.50025 + return this._lineJustification; 1.50026 + }, 1.50027 + set: function lineJustification(value) { 1.50028 + somewhatImplemented('TextJustifier.lineJustification'); 1.50029 + this._lineJustification = value; 1.50030 + } 1.50031 + } 1.50032 + } 1.50033 + } 1.50034 + } 1.50035 + }; 1.50036 + }.call(this); 1.50037 +var TextLineDefinition = function () { 1.50038 + return { 1.50039 + __class__: 'flash.text.engine.TextLine', 1.50040 + initialize: function () { 1.50041 + }, 1.50042 + __glue__: { 1.50043 + native: { 1.50044 + static: {}, 1.50045 + instance: { 1.50046 + getAtomIndexAtPoint: function getAtomIndexAtPoint(stageX, stageY) { 1.50047 + notImplemented('TextLine.getAtomIndexAtPoint'); 1.50048 + }, 1.50049 + getAtomIndexAtCharIndex: function getAtomIndexAtCharIndex(charIndex) { 1.50050 + notImplemented('TextLine.getAtomIndexAtCharIndex'); 1.50051 + }, 1.50052 + getAtomBounds: function getAtomBounds(atomIndex) { 1.50053 + notImplemented('TextLine.getAtomBounds'); 1.50054 + }, 1.50055 + getAtomBidiLevel: function getAtomBidiLevel(atomIndex) { 1.50056 + notImplemented('TextLine.getAtomBidiLevel'); 1.50057 + }, 1.50058 + getAtomTextRotation: function getAtomTextRotation(atomIndex) { 1.50059 + notImplemented('TextLine.getAtomTextRotation'); 1.50060 + }, 1.50061 + getAtomTextBlockBeginIndex: function getAtomTextBlockBeginIndex(atomIndex) { 1.50062 + notImplemented('TextLine.getAtomTextBlockBeginIndex'); 1.50063 + }, 1.50064 + getAtomTextBlockEndIndex: function getAtomTextBlockEndIndex(atomIndex) { 1.50065 + notImplemented('TextLine.getAtomTextBlockEndIndex'); 1.50066 + }, 1.50067 + getAtomCenter: function getAtomCenter(atomIndex) { 1.50068 + notImplemented('TextLine.getAtomCenter'); 1.50069 + }, 1.50070 + getAtomWordBoundaryOnLeft: function getAtomWordBoundaryOnLeft(atomIndex) { 1.50071 + notImplemented('TextLine.getAtomWordBoundaryOnLeft'); 1.50072 + }, 1.50073 + getAtomGraphic: function getAtomGraphic(atomIndex) { 1.50074 + notImplemented('TextLine.getAtomGraphic'); 1.50075 + }, 1.50076 + getBaselinePosition: function getBaselinePosition(baseline) { 1.50077 + notImplemented('TextLine.getBaselinePosition'); 1.50078 + }, 1.50079 + dump: function dump() { 1.50080 + notImplemented('TextLine.dump'); 1.50081 + }, 1.50082 + textBlock: { 1.50083 + get: function textBlock() { 1.50084 + notImplemented('TextLine.textBlock'); 1.50085 + return this._textBlock; 1.50086 + } 1.50087 + }, 1.50088 + hasGraphicElement: { 1.50089 + get: function hasGraphicElement() { 1.50090 + notImplemented('TextLine.hasGraphicElement'); 1.50091 + return this._hasGraphicElement; 1.50092 + } 1.50093 + }, 1.50094 + hasTabs: { 1.50095 + get: function hasTabs() { 1.50096 + notImplemented('TextLine.hasTabs'); 1.50097 + return this._hasTabs; 1.50098 + } 1.50099 + }, 1.50100 + nextLine: { 1.50101 + get: function nextLine() { 1.50102 + somewhatImplemented('TextLine.nextLine'); 1.50103 + return this._nextLine; 1.50104 + } 1.50105 + }, 1.50106 + previousLine: { 1.50107 + get: function previousLine() { 1.50108 + somewhatImplemented('TextLine.previousLine'); 1.50109 + return this._previousLine; 1.50110 + } 1.50111 + }, 1.50112 + ascent: { 1.50113 + get: function ascent() { 1.50114 + somewhatImplemented('TextLine.ascent'); 1.50115 + return this._ascent; 1.50116 + } 1.50117 + }, 1.50118 + descent: { 1.50119 + get: function descent() { 1.50120 + somewhatImplemented('TextLine.descent'); 1.50121 + return this._descent; 1.50122 + } 1.50123 + }, 1.50124 + textHeight: { 1.50125 + get: function textHeight() { 1.50126 + somewhatImplemented('TextLine.textHeight'); 1.50127 + return this._textHeight; 1.50128 + } 1.50129 + }, 1.50130 + textWidth: { 1.50131 + get: function textWidth() { 1.50132 + somewhatImplemented('TextLine.textWidth'); 1.50133 + return this._textWidth; 1.50134 + } 1.50135 + }, 1.50136 + totalAscent: { 1.50137 + get: function totalAscent() { 1.50138 + notImplemented('TextLine.totalAscent'); 1.50139 + return this._totalAscent; 1.50140 + } 1.50141 + }, 1.50142 + totalDescent: { 1.50143 + get: function totalDescent() { 1.50144 + notImplemented('TextLine.totalDescent'); 1.50145 + return this._totalDescent; 1.50146 + } 1.50147 + }, 1.50148 + totalHeight: { 1.50149 + get: function totalHeight() { 1.50150 + notImplemented('TextLine.totalHeight'); 1.50151 + return this._totalHeight; 1.50152 + } 1.50153 + }, 1.50154 + textBlockBeginIndex: { 1.50155 + get: function textBlockBeginIndex() { 1.50156 + notImplemented('TextLine.textBlockBeginIndex'); 1.50157 + return this._textBlockBeginIndex; 1.50158 + } 1.50159 + }, 1.50160 + rawTextLength: { 1.50161 + get: function rawTextLength() { 1.50162 + somewhatImplemented('TextLine.rawTextLength'); 1.50163 + return this._rawTextLength; 1.50164 + } 1.50165 + }, 1.50166 + specifiedWidth: { 1.50167 + get: function specifiedWidth() { 1.50168 + somewhatImplemented('TextLine.specifiedWidth'); 1.50169 + return this._specifiedWidth; 1.50170 + } 1.50171 + }, 1.50172 + unjustifiedTextWidth: { 1.50173 + get: function unjustifiedTextWidth() { 1.50174 + somewhatImplemented('TextLine.unjustifiedTextWidth'); 1.50175 + return this._unjustifiedTextWidth; 1.50176 + } 1.50177 + }, 1.50178 + validity: { 1.50179 + get: function validity() { 1.50180 + return this._validity; 1.50181 + }, 1.50182 + set: function validity(value) { 1.50183 + somewhatImplemented('TextLine.validity'); 1.50184 + this._validity = value; 1.50185 + } 1.50186 + }, 1.50187 + atomCount: { 1.50188 + get: function atomCount() { 1.50189 + notImplemented('TextLine.atomCount'); 1.50190 + return this._atomCount; 1.50191 + } 1.50192 + }, 1.50193 + mirrorRegions: { 1.50194 + get: function mirrorRegions() { 1.50195 + notImplemented('TextLine.mirrorRegions'); 1.50196 + return this._mirrorRegions; 1.50197 + } 1.50198 + } 1.50199 + } 1.50200 + } 1.50201 + } 1.50202 + }; 1.50203 + }.call(this); 1.50204 +{ 1.50205 + var ContextMenuDefinition = function () { 1.50206 + return { 1.50207 + __class__: 'flash.ui.ContextMenu', 1.50208 + initialize: function () { 1.50209 + }, 1.50210 + __glue__: { 1.50211 + native: { 1.50212 + static: { 1.50213 + _checkSupported: function _checkSupported() { 1.50214 + notImplemented('ContextMenu._checkSupported'); 1.50215 + } 1.50216 + }, 1.50217 + instance: { 1.50218 + cloneLinkAndClipboardProperties: function cloneLinkAndClipboardProperties(c) { 1.50219 + notImplemented('ContextMenu.cloneLinkAndClipboardProperties'); 1.50220 + }, 1.50221 + builtInItems: { 1.50222 + get: function builtInItems() { 1.50223 + somewhatImplemented('ContextMenu.builtInItems'); 1.50224 + return this._builtInItems; 1.50225 + }, 1.50226 + set: function builtInItems(value) { 1.50227 + somewhatImplemented('ContextMenu.builtInItems'); 1.50228 + this._builtInItems = value; 1.50229 + } 1.50230 + }, 1.50231 + customItems: { 1.50232 + get: function customItems() { 1.50233 + somewhatImplemented('ContextMenu.customItems'); 1.50234 + return this._customItems; 1.50235 + }, 1.50236 + set: function customItems(value) { 1.50237 + somewhatImplemented('ContextMenu.customItems'); 1.50238 + this._customItems = value; 1.50239 + } 1.50240 + }, 1.50241 + link: { 1.50242 + get: function link() { 1.50243 + notImplemented('ContextMenu.link'); 1.50244 + return this._link; 1.50245 + }, 1.50246 + set: function link(value) { 1.50247 + notImplemented('ContextMenu.link'); 1.50248 + this._link = value; 1.50249 + } 1.50250 + }, 1.50251 + clipboardMenu: { 1.50252 + get: function clipboardMenu() { 1.50253 + notImplemented('ContextMenu.clipboardMenu'); 1.50254 + return this._clipboardMenu; 1.50255 + }, 1.50256 + set: function clipboardMenu(value) { 1.50257 + notImplemented('ContextMenu.clipboardMenu'); 1.50258 + this._clipboardMenu = value; 1.50259 + } 1.50260 + }, 1.50261 + clipboardItems: { 1.50262 + get: function clipboardItems() { 1.50263 + notImplemented('ContextMenu.clipboardItems'); 1.50264 + return this._clipboardItems; 1.50265 + }, 1.50266 + set: function clipboardItems(value) { 1.50267 + notImplemented('ContextMenu.clipboardItems'); 1.50268 + this._clipboardItems = value; 1.50269 + } 1.50270 + } 1.50271 + } 1.50272 + } 1.50273 + } 1.50274 + }; 1.50275 + }.call(this); 1.50276 +} 1.50277 +var ContextMenuItemDefinition = function () { 1.50278 + return { 1.50279 + __class__: 'flash.ui.ContextMenuItem', 1.50280 + initialize: function () { 1.50281 + }, 1.50282 + __glue__: { 1.50283 + native: { 1.50284 + static: {}, 1.50285 + instance: { 1.50286 + caption: { 1.50287 + get: function caption() { 1.50288 + somewhatImplemented('ContextMenuItem.caption'); 1.50289 + return this._caption; 1.50290 + }, 1.50291 + set: function caption(value) { 1.50292 + somewhatImplemented('ContextMenuItem.caption'); 1.50293 + this._caption = value; 1.50294 + } 1.50295 + }, 1.50296 + separatorBefore: { 1.50297 + get: function separatorBefore() { 1.50298 + somewhatImplemented('ContextMenuItem.separatorBefore'); 1.50299 + return this._separatorBefore; 1.50300 + }, 1.50301 + set: function separatorBefore(value) { 1.50302 + somewhatImplemented('ContextMenuItem.separatorBefore'); 1.50303 + this._separatorBefore = value; 1.50304 + } 1.50305 + }, 1.50306 + visible: { 1.50307 + get: function visible() { 1.50308 + somewhatImplemented('ContextMenuItem.visible'); 1.50309 + return this._visible; 1.50310 + }, 1.50311 + set: function visible(value) { 1.50312 + somewhatImplemented('ContextMenuItem.visible'); 1.50313 + this._visible = value; 1.50314 + } 1.50315 + } 1.50316 + } 1.50317 + } 1.50318 + } 1.50319 + }; 1.50320 + }.call(this); 1.50321 +var ShumwayKeyboardListener = { 1.50322 + _lastKeyCode: 0, 1.50323 + _captureKeyPress: false, 1.50324 + _charCodeMap: [], 1.50325 + focus: null, 1.50326 + handleEvent: function (domEvt) { 1.50327 + var keyCode = domEvt.keyCode; 1.50328 + if (domEvt.type === 'keydown') { 1.50329 + this._lastKeyCode = keyCode; 1.50330 + this._captureKeyPress = keyCode === 8 || keyCode === 9 || keyCode === 13 || keyCode === 32 || keyCode >= 48 && keyCode <= 90 || keyCode > 145; 1.50331 + if (this._captureKeyPress) { 1.50332 + return; 1.50333 + } 1.50334 + this._charCodeMap[keyCode] = 0; 1.50335 + } else if (domEvt.type === 'keypress') { 1.50336 + if (this._captureKeyPress) { 1.50337 + keyCode = this._lastKeyCode; 1.50338 + this._charCodeMap[keyCode] = domEvt.charCode; 1.50339 + } else { 1.50340 + return; 1.50341 + } 1.50342 + } 1.50343 + if (this.focus) { 1.50344 + this.focus._dispatchEvent(new flash.events.KeyboardEvent(domEvt.type === 'keyup' ? 'keyUp' : 'keyDown', true, false, domEvt.type === 'keyup' ? this._charCodeMap[keyCode] : domEvt.charCode, domEvt.type === 'keyup' ? domEvt.keyCode : this._lastKeyCode, domEvt.keyLocation, domEvt.ctrlKey, domEvt.altKey, domEvt.shiftKey)); 1.50345 + } 1.50346 + } 1.50347 + }; 1.50348 +window.addEventListener('keydown', ShumwayKeyboardListener); 1.50349 +window.addEventListener('keypress', ShumwayKeyboardListener); 1.50350 +window.addEventListener('keyup', ShumwayKeyboardListener); 1.50351 +var KeyboardDefinition = function () { 1.50352 + var def = { 1.50353 + get capsLock() { 1.50354 + return false; 1.50355 + }, 1.50356 + get hasVirtualKeyboard() { 1.50357 + return false; 1.50358 + }, 1.50359 + get numLock() { 1.50360 + return false; 1.50361 + }, 1.50362 + get physicalKeyboardType() { 1.50363 + return 'alphanumeric'; 1.50364 + }, 1.50365 + get isAccessible() { 1.50366 + return true; 1.50367 + } 1.50368 + }; 1.50369 + var desc = Object.getOwnPropertyDescriptor; 1.50370 + def.__glue__ = { 1.50371 + script: { 1.50372 + static: scriptProperties('public', [ 1.50373 + 'A', 1.50374 + 'ALTERNATE', 1.50375 + 'AUDIO', 1.50376 + 'B', 1.50377 + 'BACK', 1.50378 + 'BACKQUOTE', 1.50379 + 'BACKSLASH', 1.50380 + 'BACKSPACE', 1.50381 + 'BLUE', 1.50382 + 'C', 1.50383 + 'CAPS_LOCK', 1.50384 + 'CHANNEL_DOWN', 1.50385 + 'CHANNEL_UP', 1.50386 + 'COMMA', 1.50387 + 'COMMAND', 1.50388 + 'CONTROL', 1.50389 + 'D', 1.50390 + 'DELETE', 1.50391 + 'DOWN', 1.50392 + 'DVR', 1.50393 + 'E', 1.50394 + 'END', 1.50395 + 'ENTER', 1.50396 + 'EQUAL', 1.50397 + 'ESCAPE', 1.50398 + 'EXIT', 1.50399 + 'F', 1.50400 + 'F1', 1.50401 + 'F10', 1.50402 + 'F11', 1.50403 + 'F12', 1.50404 + 'F13', 1.50405 + 'F14', 1.50406 + 'F15', 1.50407 + 'F2', 1.50408 + 'F3', 1.50409 + 'F4', 1.50410 + 'F5', 1.50411 + 'F6', 1.50412 + 'F7', 1.50413 + 'F8', 1.50414 + 'F9', 1.50415 + 'FAST_FORWARD', 1.50416 + 'G', 1.50417 + 'GREEN', 1.50418 + 'GUIDE', 1.50419 + 'H', 1.50420 + 'HELP', 1.50421 + 'HOME', 1.50422 + 'I', 1.50423 + 'INFO', 1.50424 + 'INPUT', 1.50425 + 'INSERT', 1.50426 + 'J', 1.50427 + 'K', 1.50428 + 'KEYNAME_BEGIN', 1.50429 + 'KEYNAME_BREAK', 1.50430 + 'KEYNAME_CLEARDISPLAY', 1.50431 + 'KEYNAME_CLEARLINE', 1.50432 + 'KEYNAME_DELETE', 1.50433 + 'KEYNAME_DELETECHAR', 1.50434 + 'KEYNAME_DELETELINE', 1.50435 + 'KEYNAME_DOWNARROW', 1.50436 + 'KEYNAME_END', 1.50437 + 'KEYNAME_EXECUTE', 1.50438 + 'KEYNAME_F1', 1.50439 + 'KEYNAME_F10', 1.50440 + 'KEYNAME_F11', 1.50441 + 'KEYNAME_F12', 1.50442 + 'KEYNAME_F13', 1.50443 + 'KEYNAME_F14', 1.50444 + 'KEYNAME_F15', 1.50445 + 'KEYNAME_F16', 1.50446 + 'KEYNAME_F17', 1.50447 + 'KEYNAME_F18', 1.50448 + 'KEYNAME_F19', 1.50449 + 'KEYNAME_F2', 1.50450 + 'KEYNAME_F20', 1.50451 + 'KEYNAME_F21', 1.50452 + 'KEYNAME_F22', 1.50453 + 'KEYNAME_F23', 1.50454 + 'KEYNAME_F24', 1.50455 + 'KEYNAME_F25', 1.50456 + 'KEYNAME_F26', 1.50457 + 'KEYNAME_F27', 1.50458 + 'KEYNAME_F28', 1.50459 + 'KEYNAME_F29', 1.50460 + 'KEYNAME_F3', 1.50461 + 'KEYNAME_F30', 1.50462 + 'KEYNAME_F31', 1.50463 + 'KEYNAME_F32', 1.50464 + 'KEYNAME_F33', 1.50465 + 'KEYNAME_F34', 1.50466 + 'KEYNAME_F35', 1.50467 + 'KEYNAME_F4', 1.50468 + 'KEYNAME_F5', 1.50469 + 'KEYNAME_F6', 1.50470 + 'KEYNAME_F7', 1.50471 + 'KEYNAME_F8', 1.50472 + 'KEYNAME_F9', 1.50473 + 'KEYNAME_FIND', 1.50474 + 'KEYNAME_HELP', 1.50475 + 'KEYNAME_HOME', 1.50476 + 'KEYNAME_INSERT', 1.50477 + 'KEYNAME_INSERTCHAR', 1.50478 + 'KEYNAME_INSERTLINE', 1.50479 + 'KEYNAME_LEFTARROW', 1.50480 + 'KEYNAME_MENU', 1.50481 + 'KEYNAME_MODESWITCH', 1.50482 + 'KEYNAME_NEXT', 1.50483 + 'KEYNAME_PAGEDOWN', 1.50484 + 'KEYNAME_PAGEUP', 1.50485 + 'KEYNAME_PAUSE', 1.50486 + 'KEYNAME_PREV', 1.50487 + 'KEYNAME_PRINT', 1.50488 + 'KEYNAME_PRINTSCREEN', 1.50489 + 'KEYNAME_REDO', 1.50490 + 'KEYNAME_RESET', 1.50491 + 'KEYNAME_RIGHTARROW', 1.50492 + 'KEYNAME_SCROLLLOCK', 1.50493 + 'KEYNAME_SELECT', 1.50494 + 'KEYNAME_STOP', 1.50495 + 'KEYNAME_SYSREQ', 1.50496 + 'KEYNAME_SYSTEM', 1.50497 + 'KEYNAME_UNDO', 1.50498 + 'KEYNAME_UPARROW', 1.50499 + 'KEYNAME_USER', 1.50500 + 'L', 1.50501 + 'LAST', 1.50502 + 'LEFT', 1.50503 + 'LEFTBRACKET', 1.50504 + 'LIVE', 1.50505 + 'M', 1.50506 + 'MASTER_SHELL', 1.50507 + 'MENU', 1.50508 + 'MINUS', 1.50509 + 'N', 1.50510 + 'NEXT', 1.50511 + 'NUMBER_0', 1.50512 + 'NUMBER_1', 1.50513 + 'NUMBER_2', 1.50514 + 'NUMBER_3', 1.50515 + 'NUMBER_4', 1.50516 + 'NUMBER_5', 1.50517 + 'NUMBER_6', 1.50518 + 'NUMBER_7', 1.50519 + 'NUMBER_8', 1.50520 + 'NUMBER_9', 1.50521 + 'NUMPAD', 1.50522 + 'NUMPAD_0', 1.50523 + 'NUMPAD_1', 1.50524 + 'NUMPAD_2', 1.50525 + 'NUMPAD_3', 1.50526 + 'NUMPAD_4', 1.50527 + 'NUMPAD_5', 1.50528 + 'NUMPAD_6', 1.50529 + 'NUMPAD_7', 1.50530 + 'NUMPAD_8', 1.50531 + 'NUMPAD_9', 1.50532 + 'NUMPAD_ADD', 1.50533 + 'NUMPAD_DECIMAL', 1.50534 + 'NUMPAD_DIVIDE', 1.50535 + 'NUMPAD_ENTER', 1.50536 + 'NUMPAD_MULTIPLY', 1.50537 + 'NUMPAD_SUBTRACT', 1.50538 + 'O', 1.50539 + 'P', 1.50540 + 'PAGE_DOWN', 1.50541 + 'PAGE_UP', 1.50542 + 'PAUSE', 1.50543 + 'PERIOD', 1.50544 + 'PLAY', 1.50545 + 'PREVIOUS', 1.50546 + 'Q', 1.50547 + 'QUOTE', 1.50548 + 'R', 1.50549 + 'RECORD', 1.50550 + 'RED', 1.50551 + 'REWIND', 1.50552 + 'RIGHT', 1.50553 + 'RIGHTBRACKET', 1.50554 + 'S', 1.50555 + 'SEARCH', 1.50556 + 'SEMICOLON', 1.50557 + 'SETUP', 1.50558 + 'SHIFT', 1.50559 + 'SKIP_BACKWARD', 1.50560 + 'SKIP_FORWARD', 1.50561 + 'SLASH', 1.50562 + 'SPACE', 1.50563 + 'STOP', 1.50564 + 'STRING_BEGIN', 1.50565 + 'STRING_BREAK', 1.50566 + 'STRING_CLEARDISPLAY', 1.50567 + 'STRING_CLEARLINE', 1.50568 + 'STRING_DELETE', 1.50569 + 'STRING_DELETECHAR', 1.50570 + 'STRING_DELETELINE', 1.50571 + 'STRING_DOWNARROW', 1.50572 + 'STRING_END', 1.50573 + 'STRING_EXECUTE', 1.50574 + 'STRING_F1', 1.50575 + 'STRING_F10', 1.50576 + 'STRING_F11', 1.50577 + 'STRING_F12', 1.50578 + 'STRING_F13', 1.50579 + 'STRING_F14', 1.50580 + 'STRING_F15', 1.50581 + 'STRING_F16', 1.50582 + 'STRING_F17', 1.50583 + 'STRING_F18', 1.50584 + 'STRING_F19', 1.50585 + 'STRING_F2', 1.50586 + 'STRING_F20', 1.50587 + 'STRING_F21', 1.50588 + 'STRING_F22', 1.50589 + 'STRING_F23', 1.50590 + 'STRING_F24', 1.50591 + 'STRING_F25', 1.50592 + 'STRING_F26', 1.50593 + 'STRING_F27', 1.50594 + 'STRING_F28', 1.50595 + 'STRING_F29', 1.50596 + 'STRING_F3', 1.50597 + 'STRING_F30', 1.50598 + 'STRING_F31', 1.50599 + 'STRING_F32', 1.50600 + 'STRING_F33', 1.50601 + 'STRING_F34', 1.50602 + 'STRING_F35', 1.50603 + 'STRING_F4', 1.50604 + 'STRING_F5', 1.50605 + 'STRING_F6', 1.50606 + 'STRING_F7', 1.50607 + 'STRING_F8', 1.50608 + 'STRING_F9', 1.50609 + 'STRING_FIND', 1.50610 + 'STRING_HELP', 1.50611 + 'STRING_HOME', 1.50612 + 'STRING_INSERT', 1.50613 + 'STRING_INSERTCHAR', 1.50614 + 'STRING_INSERTLINE', 1.50615 + 'STRING_LEFTARROW', 1.50616 + 'STRING_MENU', 1.50617 + 'STRING_MODESWITCH', 1.50618 + 'STRING_NEXT', 1.50619 + 'STRING_PAGEDOWN', 1.50620 + 'STRING_PAGEUP', 1.50621 + 'STRING_PAUSE', 1.50622 + 'STRING_PREV', 1.50623 + 'STRING_PRINT', 1.50624 + 'STRING_PRINTSCREEN', 1.50625 + 'STRING_REDO', 1.50626 + 'STRING_RESET', 1.50627 + 'STRING_RIGHTARROW', 1.50628 + 'STRING_SCROLLLOCK', 1.50629 + 'STRING_SELECT', 1.50630 + 'STRING_STOP', 1.50631 + 'STRING_SYSREQ', 1.50632 + 'STRING_SYSTEM', 1.50633 + 'STRING_UNDO', 1.50634 + 'STRING_UPARROW', 1.50635 + 'STRING_USER', 1.50636 + 'SUBTITLE', 1.50637 + 'T', 1.50638 + 'TAB', 1.50639 + 'U', 1.50640 + 'UP', 1.50641 + 'V', 1.50642 + 'VOD', 1.50643 + 'W', 1.50644 + 'X', 1.50645 + 'Y', 1.50646 + 'YELLOW', 1.50647 + 'Z', 1.50648 + 'CharCodeStrings' 1.50649 + ]) 1.50650 + }, 1.50651 + native: { 1.50652 + instance: { 1.50653 + capsLock: desc(def, 'capsLock'), 1.50654 + hasVirtualKeyboard: desc(def, 'hasVirtualKeyboard'), 1.50655 + numLock: desc(def, 'numLock'), 1.50656 + physicalKeyboardType: desc(def, 'physicalKeyboardType'), 1.50657 + isAccessible: desc(def, 'isAccessible') 1.50658 + } 1.50659 + } 1.50660 + }; 1.50661 + return def; 1.50662 + }.call(this); 1.50663 +var MouseDefinition = function () { 1.50664 + var def = { 1.50665 + __class__: 'flash.ui.Mouse' 1.50666 + }; 1.50667 + function hide() { 1.50668 + } 1.50669 + function show() { 1.50670 + } 1.50671 + function registerCursor() { 1.50672 + notImplemented(); 1.50673 + } 1.50674 + function unregisterCursor() { 1.50675 + notImplemented(); 1.50676 + } 1.50677 + def.__glue__ = { 1.50678 + native: { 1.50679 + static: { 1.50680 + cursor: { 1.50681 + get: function () { 1.50682 + return 'auto'; 1.50683 + }, 1.50684 + set: function () { 1.50685 + notImplemented(); 1.50686 + } 1.50687 + }, 1.50688 + supportsCursor: { 1.50689 + get: function () { 1.50690 + return true; 1.50691 + } 1.50692 + }, 1.50693 + supportsNativeCursor: { 1.50694 + get: function () { 1.50695 + return true; 1.50696 + } 1.50697 + }, 1.50698 + hide: hide, 1.50699 + show: show, 1.50700 + registerCursor: registerCursor, 1.50701 + unregisterCursor: unregisterCursor 1.50702 + } 1.50703 + } 1.50704 + }; 1.50705 + return def; 1.50706 + }.call(this); 1.50707 +var MouseCursorDataDefinition = function () { 1.50708 + return { 1.50709 + __class__: 'flash.ui.MouseCursorData', 1.50710 + initialize: function () { 1.50711 + }, 1.50712 + __glue__: { 1.50713 + native: { 1.50714 + static: {}, 1.50715 + instance: { 1.50716 + data: { 1.50717 + get: function data() { 1.50718 + notImplemented('MouseCursorData.data'); 1.50719 + return this._data; 1.50720 + }, 1.50721 + set: function data(data) { 1.50722 + notImplemented('MouseCursorData.data'); 1.50723 + this._data = data; 1.50724 + } 1.50725 + }, 1.50726 + hotSpot: { 1.50727 + get: function hotSpot() { 1.50728 + notImplemented('MouseCursorData.hotSpot'); 1.50729 + return this._hotSpot; 1.50730 + }, 1.50731 + set: function hotSpot(data) { 1.50732 + notImplemented('MouseCursorData.hotSpot'); 1.50733 + this._hotSpot = data; 1.50734 + } 1.50735 + }, 1.50736 + frameRate: { 1.50737 + get: function frameRate() { 1.50738 + notImplemented('MouseCursorData.frameRate'); 1.50739 + return this._frameRate; 1.50740 + }, 1.50741 + set: function frameRate(data) { 1.50742 + notImplemented('MouseCursorData.frameRate'); 1.50743 + this._frameRate = data; 1.50744 + } 1.50745 + } 1.50746 + } 1.50747 + } 1.50748 + } 1.50749 + }; 1.50750 + }.call(this); 1.50751 +{ 1.50752 + var DictionaryDefinition = function () { 1.50753 + return { 1.50754 + __class__: 'flash.utils.Dictionary', 1.50755 + initialize: function () { 1.50756 + }, 1.50757 + __glue__: { 1.50758 + native: { 1.50759 + static: {}, 1.50760 + instance: { 1.50761 + init: function init(weakKeys) { 1.50762 + notImplemented('Dictionary.init'); 1.50763 + } 1.50764 + } 1.50765 + } 1.50766 + } 1.50767 + }; 1.50768 + }.call(this); 1.50769 +} 1.50770 +var TimerDefinition = function () { 1.50771 + var def = { 1.50772 + __class__: 'flash.utils.Timer', 1.50773 + initialize: function () { 1.50774 + this._running = false; 1.50775 + } 1.50776 + }; 1.50777 + def.__glue__ = { 1.50778 + native: { 1.50779 + instance: { 1.50780 + running: { 1.50781 + get: function () { 1.50782 + return this._running; 1.50783 + } 1.50784 + }, 1.50785 + _start: function (delay, closure) { 1.50786 + this._running = true; 1.50787 + this.interval = setInterval(closure, delay); 1.50788 + }, 1.50789 + stop: function () { 1.50790 + this._running = false; 1.50791 + clearInterval(this.interval); 1.50792 + }, 1.50793 + _tick: function () { 1.50794 + if (!this._running) { 1.50795 + return; 1.50796 + } 1.50797 + this._dispatchEvent(new flash.events.TimerEvent('timer', true, false)); 1.50798 + } 1.50799 + } 1.50800 + } 1.50801 + }; 1.50802 + return def; 1.50803 + }.call(this); 1.50804 +{ 1.50805 + var AccessibilityDefinition = function () { 1.50806 + return { 1.50807 + __class__: 'flash.accessibility.Accessibility', 1.50808 + initialize: function () { 1.50809 + }, 1.50810 + __glue__: { 1.50811 + native: { 1.50812 + static: { 1.50813 + sendEvent: function sendEvent(source, childID, eventType, nonHTML) { 1.50814 + notImplemented('Accessibility.sendEvent'); 1.50815 + }, 1.50816 + updateProperties: function updateProperties() { 1.50817 + notImplemented('Accessibility.updateProperties'); 1.50818 + }, 1.50819 + active: { 1.50820 + get: function active() { 1.50821 + somewhatImplemented('Accessibility.active'); 1.50822 + return false; 1.50823 + } 1.50824 + } 1.50825 + }, 1.50826 + instance: {} 1.50827 + } 1.50828 + } 1.50829 + }; 1.50830 + }.call(this); 1.50831 +} 1.50832 +{ 1.50833 + var AS2ButtonDefinition = function () { 1.50834 + var def = { 1.50835 + __class__: 'avm1lib.AS2Button', 1.50836 + initialize: function () { 1.50837 + } 1.50838 + }; 1.50839 + var desc = Object.getOwnPropertyDescriptor; 1.50840 + def.__glue__ = { 1.50841 + native: { 1.50842 + instance: { 1.50843 + _as3Object: { 1.50844 + get: function () { 1.50845 + return this.$nativeObject; 1.50846 + } 1.50847 + }, 1.50848 + _init: function init(nativeButton) { 1.50849 + Object.defineProperty(this, '$nativeObject', { 1.50850 + value: nativeButton 1.50851 + }); 1.50852 + nativeButton.$as2Object = this; 1.50853 + initDefaultListeners(this); 1.50854 + } 1.50855 + } 1.50856 + }, 1.50857 + script: { 1.50858 + instance: Glue.ALL 1.50859 + } 1.50860 + }; 1.50861 + return def; 1.50862 + }.call(this); 1.50863 +} 1.50864 +var AS2GlobalsDefinition = function () { 1.50865 + var def = { 1.50866 + __class__: 'avm1lib.AS2Globals', 1.50867 + initialize: function () { 1.50868 + flash.text.TextFormat.prototype.asDefinePublicProperty('getTextExtent', { 1.50869 + value: TextFormatDefinition.as2GetTextExtent, 1.50870 + writable: false, 1.50871 + enumerable: false, 1.50872 + configurable: false 1.50873 + }); 1.50874 + } 1.50875 + }; 1.50876 + def.__glue__ = { 1.50877 + native: { 1.50878 + instance: { 1.50879 + ASSetPropFlags: function ASSetPropFlags(obj, children, flags, allowFalse) { 1.50880 + }, 1.50881 + _addToPendingScripts: function _addToPendingScripts(subject, fn, args) { 1.50882 + AS2Context.instance.addToPendingScripts(function () { 1.50883 + fn.apply(subject, args); 1.50884 + }); 1.50885 + }, 1.50886 + _setLevel: function _setLevel(level, loader) { 1.50887 + AS2Context.instance.stage._as2SetLevel(level, loader); 1.50888 + }, 1.50889 + trace: function (expression) { 1.50890 + var trace = avm2.applicationDomain.getProperty(Multiname.fromSimpleName('trace'), true, true); 1.50891 + trace(expression); 1.50892 + } 1.50893 + }, 1.50894 + static: { 1.50895 + _addInternalClasses: function _addInternalClasses(proto) { 1.50896 + proto.asSetPublicProperty('Object', Stubs.Object); 1.50897 + proto.asSetPublicProperty('Function', Stubs.Function); 1.50898 + proto.asSetPublicProperty('Array', Stubs.Array); 1.50899 + proto.asSetPublicProperty('Number', Stubs.Number); 1.50900 + proto.asSetPublicProperty('Math', avm2.systemDomain.getClass('Math')); 1.50901 + proto.asSetPublicProperty('Boolean', Stubs.Boolean); 1.50902 + proto.asSetPublicProperty('Date', Stubs.Date); 1.50903 + proto.asSetPublicProperty('RegExp', Stubs.RegExp); 1.50904 + proto.asSetPublicProperty('String', Stubs.String); 1.50905 + } 1.50906 + } 1.50907 + }, 1.50908 + script: { 1.50909 + instance: Glue.ALL 1.50910 + } 1.50911 + }; 1.50912 + return def; 1.50913 + }.call(this); 1.50914 +var AS2MovieClipDefinition = function () { 1.50915 + var def = { 1.50916 + __class__: 'avm1lib.AS2MovieClip', 1.50917 + initialize: function () { 1.50918 + }, 1.50919 + _insertChildAtDepth: function _insertChildAtDepth(mc, depth) { 1.50920 + return this.$nativeObject._insertChildAtDepth(mc, depth); 1.50921 + }, 1.50922 + _duplicate: function _duplicate(name, depth, initObject) { 1.50923 + return this.$nativeObject._duplicate(name, depth, initObject); 1.50924 + }, 1.50925 + _constructSymbol: function constructSymbol(symbolId, name) { 1.50926 + var theClass = AS2Context.instance.classes && AS2Context.instance.classes[symbolId]; 1.50927 + var symbolProps = AS2Context.instance.assets[symbolId]; 1.50928 + var symbolClass = flash.display.MovieClip.class; 1.50929 + var mc = symbolClass.createAsSymbol(symbolProps); 1.50930 + mc._avm1SymbolClass = theClass; 1.50931 + symbolClass.instanceConstructor.call(mc); 1.50932 + this.$nativeObject.addChild(mc); 1.50933 + return mc; 1.50934 + }, 1.50935 + _gotoLabel: function (label) { 1.50936 + this.$nativeObject.gotoLabel(label); 1.50937 + }, 1.50938 + _callFrame: function callFrame(frame) { 1.50939 + this.$nativeObject._callFrame(frame); 1.50940 + }, 1.50941 + init: function init(nativeMovieClip) { 1.50942 + if (!nativeMovieClip) { 1.50943 + return; 1.50944 + } 1.50945 + Object.defineProperty(this, '$nativeObject', { 1.50946 + value: nativeMovieClip 1.50947 + }); 1.50948 + nativeMovieClip.$as2Object = this; 1.50949 + initDefaultListeners(this); 1.50950 + } 1.50951 + }; 1.50952 + var desc = Object.getOwnPropertyDescriptor; 1.50953 + def.__glue__ = { 1.50954 + native: { 1.50955 + instance: { 1.50956 + _as3Object: { 1.50957 + get: function () { 1.50958 + return this.$nativeObject; 1.50959 + } 1.50960 + }, 1.50961 + _init: def.init, 1.50962 + _insertChildAtDepth: def._insertChildAtDepth, 1.50963 + _duplicate: def._duplicate, 1.50964 + _constructSymbol: def._constructSymbol, 1.50965 + _callFrame: def._callFrame, 1.50966 + _gotoLabel: def._gotoLabel 1.50967 + } 1.50968 + }, 1.50969 + script: { 1.50970 + instance: Glue.ALL 1.50971 + } 1.50972 + }; 1.50973 + return def; 1.50974 + }.call(this); 1.50975 +var AS2MovieClipLoaderDefinition = function () { 1.50976 + var def = { 1.50977 + __class__: 'avm1lib.AS2MovieClipLoader', 1.50978 + initialize: function () { 1.50979 + }, 1.50980 + get _bytesLoaded() { 1.50981 + return this.$nativeObject._contentLoaderInfo._bytesLoaded; 1.50982 + } 1.50983 + }; 1.50984 + var desc = Object.getOwnPropertyDescriptor; 1.50985 + def.__glue__ = { 1.50986 + native: { 1.50987 + instance: { 1.50988 + $nativeObject: { 1.50989 + get: function () { 1.50990 + return this.$nativeObject; 1.50991 + } 1.50992 + }, 1.50993 + _bytesLoaded: desc(def, '_bytesLoaded') 1.50994 + } 1.50995 + }, 1.50996 + script: { 1.50997 + instance: Glue.ALL 1.50998 + } 1.50999 + }; 1.51000 + return def; 1.51001 + }.call(this); 1.51002 +var AS2TextFieldDefinition = function () { 1.51003 + var def = { 1.51004 + __class__: 'avm1lib.AS2TextField', 1.51005 + initialize: function () { 1.51006 + this._variable = ''; 1.51007 + } 1.51008 + }; 1.51009 + def.__glue__ = { 1.51010 + native: { 1.51011 + instance: { 1.51012 + variable: { 1.51013 + get: function () { 1.51014 + return this._variable; 1.51015 + }, 1.51016 + set: function (name) { 1.51017 + if (name === this._variable) { 1.51018 + return; 1.51019 + } 1.51020 + this._variable = name; 1.51021 + var instance = this.$nativeObject; 1.51022 + var hasPath = name.indexOf('.') >= 0 || name.indexOf(':') >= 0; 1.51023 + var clip; 1.51024 + if (hasPath) { 1.51025 + var targetPath = name.split(/[.:\/]/g); 1.51026 + name = targetPath.pop(); 1.51027 + if (targetPath[0] == '_root' || targetPath[0] === '') { 1.51028 + clip = instance.root._getAS2Object(); 1.51029 + targetPath.shift(); 1.51030 + if (targetPath[0] === '') { 1.51031 + targetPath.shift(); 1.51032 + } 1.51033 + } else { 1.51034 + clip = instance._parent._getAS2Object(); 1.51035 + } 1.51036 + while (targetPath.length > 0) { 1.51037 + var childName = targetPath.shift(); 1.51038 + clip = clip.asGetPublicProperty(childName) || clip[childName]; 1.51039 + if (!clip) { 1.51040 + throw new Error('Cannot find ' + childName + ' variable'); 1.51041 + } 1.51042 + } 1.51043 + } else { 1.51044 + clip = instance._parent._getAS2Object(); 1.51045 + } 1.51046 + if (!clip.asHasProperty(undefined, name, 0)) { 1.51047 + clip.asSetPublicProperty(name, instance.text); 1.51048 + } 1.51049 + instance._addEventListener('advanceFrame', function () { 1.51050 + instance.text = '' + clip.asGetPublicProperty(name); 1.51051 + }); 1.51052 + } 1.51053 + }, 1.51054 + _as3Object: { 1.51055 + get: function () { 1.51056 + return this.$nativeObject; 1.51057 + } 1.51058 + }, 1.51059 + _init: function init(nativeTextField) { 1.51060 + Object.defineProperty(this, '$nativeObject', { 1.51061 + value: nativeTextField 1.51062 + }); 1.51063 + nativeTextField.$as2Object = this; 1.51064 + initDefaultListeners(this); 1.51065 + } 1.51066 + } 1.51067 + }, 1.51068 + script: { 1.51069 + instance: Glue.ALL 1.51070 + } 1.51071 + }; 1.51072 + return def; 1.51073 + }.call(this); 1.51074 +var AS2UtilsDefinition = function () { 1.51075 + var def = { 1.51076 + __class__: 'avm1lib.AS2Utils', 1.51077 + initialize: function () { 1.51078 + } 1.51079 + }; 1.51080 + function installObjectMethods() { 1.51081 + var c = Stubs.Object, p = c.asGetPublicProperty('prototype'); 1.51082 + c.asSetPublicProperty('registerClass', function registerClass(name, theClass) { 1.51083 + var classes = AS2Context.instance.classes || (AS2Context.instance.classes = {}); 1.51084 + classes[name] = theClass; 1.51085 + }); 1.51086 + p.asDefinePublicProperty('addProperty', { 1.51087 + value: function addProperty(name, getter, setter) { 1.51088 + if (typeof name !== 'string' || name === '') { 1.51089 + return false; 1.51090 + } 1.51091 + if (typeof getter !== 'function') { 1.51092 + return false; 1.51093 + } 1.51094 + if (typeof setter !== 'function' && setter !== null) { 1.51095 + return false; 1.51096 + } 1.51097 + this.asDefinePublicProperty(name, { 1.51098 + get: getter, 1.51099 + set: setter || undefined, 1.51100 + configurable: true, 1.51101 + enumerable: true 1.51102 + }); 1.51103 + return true; 1.51104 + }, 1.51105 + writable: false, 1.51106 + enumerable: false, 1.51107 + configurable: false 1.51108 + }); 1.51109 + } 1.51110 + def.__glue__ = { 1.51111 + native: { 1.51112 + static: { 1.51113 + getAS2Object: function (nativeObject) { 1.51114 + return nativeObject && nativeObject._getAS2Object ? nativeObject._getAS2Object() : null; 1.51115 + }, 1.51116 + addProperty: function (obj, propertyName, getter, setter, enumerable) { 1.51117 + obj.asDefinePublicProperty(propertyName, { 1.51118 + get: getter, 1.51119 + set: setter || undefined, 1.51120 + enumerable: enumerable, 1.51121 + configurable: true 1.51122 + }); 1.51123 + }, 1.51124 + resolveTarget: function (target_mc) { 1.51125 + return AS2Context.instance.resolveTarget(target_mc); 1.51126 + }, 1.51127 + resolveLevel: function (level) { 1.51128 + return AS2Context.instance.resolveLevel(level); 1.51129 + }, 1.51130 + currentStage: { 1.51131 + get: function () { 1.51132 + return AS2Context.instance.stage; 1.51133 + } 1.51134 + }, 1.51135 + _installObjectMethods: installObjectMethods 1.51136 + } 1.51137 + } 1.51138 + }; 1.51139 + return def; 1.51140 + }.call(this); 1.51141 +function initDefaultListeners(thisArg) { 1.51142 + var defaultListeners = thisArg.asGetPublicProperty('$defaultListeners'); 1.51143 + if (!defaultListeners) { 1.51144 + return; 1.51145 + } 1.51146 + for (var i = 0; i < defaultListeners.length; i++) { 1.51147 + var p = defaultListeners[i]; 1.51148 + p.asGetPublicProperty('setter').call(thisArg, p.value); 1.51149 + } 1.51150 +} 1.51151 +function bindNativeClassDefinition(nativeName, definition) { 1.51152 + natives[nativeName] = function (domain, scope, instanceConstructor, baseClass) { 1.51153 + var c = new Class(undefined, instanceConstructor, ApplicationDomain.coerceCallable); 1.51154 + c.extend(baseClass); 1.51155 + c.linkNatives(definition); 1.51156 + return c; 1.51157 + }; 1.51158 +} 1.51159 +var Stubs = new function () { 1.51160 + var that = this; 1.51161 + var definitions = createEmptyObject(); 1.51162 + var DEFAULT_DEFINITION = { 1.51163 + __glue__: { 1.51164 + script: { 1.51165 + instance: Glue.ALL, 1.51166 + static: Glue.ALL 1.51167 + } 1.51168 + } 1.51169 + }; 1.51170 + this.getClassNames = function () { 1.51171 + return Object.keys(definitions); 1.51172 + }; 1.51173 + this.onClassCreated = function (eventType, cls) { 1.51174 + var classOriginalName = cls.classInfo.instanceInfo.name.getOriginalName(); 1.51175 + if (classOriginalName in definitions) { 1.51176 + cls.link(definitions[classOriginalName] || DEFAULT_DEFINITION); 1.51177 + } 1.51178 + }; 1.51179 + function makeStub(container, classSimpleName, shortName) { 1.51180 + Object.defineProperty(container, shortName, { 1.51181 + get: function () { 1.51182 + var cls = avm2.systemDomain.getClass(classSimpleName); 1.51183 + true; 1.51184 + Object.defineProperty(container, shortName, { 1.51185 + value: cls.instanceConstructor, 1.51186 + writable: false 1.51187 + }); 1.51188 + return container[shortName]; 1.51189 + }, 1.51190 + configurable: true 1.51191 + }); 1.51192 + } 1.51193 + [ 1.51194 + 'Boolean', 1.51195 + 'Date', 1.51196 + 'String', 1.51197 + 'Function', 1.51198 + 'Object', 1.51199 + 'Number', 1.51200 + 'Math', 1.51201 + 'Array', 1.51202 + 'RegExp' 1.51203 + ].forEach(function (classSimpleName) { 1.51204 + makeStub(that, classSimpleName, classSimpleName); 1.51205 + }); 1.51206 + [ 1.51207 + 'Error', 1.51208 + 'DefinitionError', 1.51209 + 'EvalError', 1.51210 + 'RangeError', 1.51211 + 'ReferenceError', 1.51212 + 'SecurityError', 1.51213 + 'SyntaxError', 1.51214 + 'TypeError', 1.51215 + 'URIError', 1.51216 + 'VerifyError', 1.51217 + 'UninitializedError', 1.51218 + 'ArgumentError' 1.51219 + ].forEach(function (classSimpleName) { 1.51220 + makeStub(that, classSimpleName, classSimpleName); 1.51221 + }); 1.51222 + function M(classSimpleName, nativeName, definition) { 1.51223 + return { 1.51224 + classSimpleName: classSimpleName, 1.51225 + nativeName: nativeName, 1.51226 + definition: definition 1.51227 + }; 1.51228 + } 1.51229 + [ 1.51230 + M('flash.display.DisplayObject', 'DisplayObjectClass', DisplayObjectDefinition), 1.51231 + M('flash.display.InteractiveObject', 'InteractiveObjectClass', InteractiveObjectDefinition), 1.51232 + M('flash.display.DisplayObjectContainer', 'ContainerClass', DisplayObjectContainerDefinition), 1.51233 + M('flash.display.Sprite', 'SpriteClass', SpriteDefinition), 1.51234 + M('flash.display.MovieClip', 'MovieClipClass', MovieClipDefinition), 1.51235 + M('flash.display.Shape', 'ShapeClass', ShapeDefinition), 1.51236 + M('flash.display.Bitmap', 'BitmapClass', BitmapDefinition), 1.51237 + M('flash.display.BitmapData', 'BitmapDataClass', BitmapDataDefinition), 1.51238 + M('flash.display.Stage', 'StageClass', StageDefinition), 1.51239 + M('flash.display.Loader', 'LoaderClass', LoaderDefinition), 1.51240 + M('flash.display.LoaderInfo', 'LoaderInfoClass', LoaderInfoDefinition), 1.51241 + M('flash.display.Graphics', 'GraphicsClass', GraphicsDefinition), 1.51242 + M('flash.display.SimpleButton', 'SimpleButtonClass', SimpleButtonDefinition), 1.51243 + M('flash.display.MorphShape', 'MorphShapeClass', MorphShapeDefinition), 1.51244 + M('flash.display.NativeMenu', 'MenuClass', NativeMenuDefinition), 1.51245 + M('flash.display.NativeMenuItem', 'MenuItemClass', NativeMenuItemDefinition), 1.51246 + M('flash.display.FrameLabel', 'FrameLabelClass', FrameLabelDefinition), 1.51247 + M('flash.display.Scene'), 1.51248 + M('flash.display.BlendMode'), 1.51249 + M('flash.display.Shader', 'ShaderClass', ShaderDefinition), 1.51250 + M('flash.display.ShaderData', 'ShaderDataClass', ShaderDataDefinition), 1.51251 + M('flash.filters.BevelFilter', 'BevelFilterClass', BevelFilterDefinition), 1.51252 + M('flash.filters.BitmapFilter', 'BitmapFilterClass', BitmapFilterDefinition), 1.51253 + M('flash.filters.BlurFilter', 'BlurFilterClass', BlurFilterDefinition), 1.51254 + M('flash.filters.ColorMatrixFilter', 'ColorMatrixFilterClass', ColorMatrixFilterDefinition), 1.51255 + M('flash.filters.ConvolutionFilter', 'ConvolutionFilterClass', ConvolutionFilterDefinition), 1.51256 + M('flash.filters.DisplacementMapFilter', 'DisplacementMapFilterClass', DisplacementMapFilterDefinition), 1.51257 + M('flash.filters.DropShadowFilter', 'DropShadowFilterClass', DropShadowFilterDefinition), 1.51258 + M('flash.filters.GlowFilter', 'GlowFilterClass', GlowFilterDefinition), 1.51259 + M('flash.filters.GradientBevelFilter', 'GradientBevelFilterClass', GradientBevelFilterDefinition), 1.51260 + M('flash.filters.GradientGlowFilter', 'GradientGlowFilterClass', GradientGlowFilterDefinition), 1.51261 + M('flash.filters.ShaderFilter', 'ShaderFilterClass', ShaderFilterDefinition), 1.51262 + M('flash.geom.Point', 'PointClass', PointDefinition), 1.51263 + M('flash.geom.Rectangle', 'RectangleClass', RectangleDefinition), 1.51264 + M('flash.geom.Matrix', 'MatrixClass', MatrixDefinition), 1.51265 + M('flash.geom.Matrix3D', 'Matrix3DClass', Matrix3DDefinition), 1.51266 + M('flash.geom.Vector3D', 'Vector3DClass', Vector3DDefinition), 1.51267 + M('flash.geom.Transform', 'TransformClass', TransformDefinition), 1.51268 + M('flash.geom.ColorTransform', 'ColorTransformClass', ColorTransformDefinition), 1.51269 + M('flash.events.EventDispatcher', 'EventDispatcherClass', EventDispatcherDefinition), 1.51270 + M('flash.events.Event', 'EventClass', EventDefinition), 1.51271 + M('flash.events.IOErrorEvent'), 1.51272 + M('flash.events.NetStatusEvent'), 1.51273 + M('flash.events.KeyboardEvent', 'KeyboardEventClass', KeyboardEventDefinition), 1.51274 + M('flash.events.MouseEvent', 'MouseEventClass', MouseEventDefinition), 1.51275 + M('flash.events.TextEvent', 'TextEventClass', TextEventDefinition), 1.51276 + M('flash.events.TimerEvent', 'TimerEventClass', TimerEventDefinition), 1.51277 + M('flash.events.ProgressEvent'), 1.51278 + M('flash.events.NetStatusEvent'), 1.51279 + M('flash.external.ExternalInterface', 'ExternalInterfaceClass', ExternalInterfaceDefinition), 1.51280 + M('flash.ui.ContextMenu', 'ContextMenuClass', ContextMenuDefinition), 1.51281 + M('flash.ui.ContextMenuItem', 'ContextMenuItemClass', ContextMenuItemDefinition), 1.51282 + M('flash.ui.Keyboard', 'KeyboardClass', KeyboardDefinition), 1.51283 + M('flash.ui.Mouse', 'MouseClass', MouseDefinition), 1.51284 + M('flash.ui.MouseCursorData', 'MouseCursorDataClass', MouseCursorDataDefinition), 1.51285 + M('flash.text.Font', 'FontClass', FontDefinition), 1.51286 + M('flash.text.TextField', 'TextFieldClass', TextFieldDefinition), 1.51287 + M('flash.text.StaticText', 'StaticTextClass', StaticTextDefinition), 1.51288 + M('flash.text.StyleSheet', 'StyleSheetClass', StyleSheetDefinition), 1.51289 + M('flash.text.TextFormat', 'TextFormatClass', TextFormatDefinition), 1.51290 + M('flash.text.TextLineMetrics'), 1.51291 + M('flash.text.engine.ContentElement', 'ContentElementClass', ContentElementDefinition), 1.51292 + M('flash.text.engine.ElementFormat', 'ElementFormatClass', ElementFormatDefinition), 1.51293 + M('flash.text.engine.FontDescription', 'FontDescriptionClass', FontDescriptionDefinition), 1.51294 + M('flash.text.engine.GroupElement', 'GroupElementClass', GroupElementDefinition), 1.51295 + M('flash.text.engine.SpaceJustifier', 'SpaceJustifierClass', SpaceJustifierDefinition), 1.51296 + M('flash.text.engine.TextBlock', 'TextBlockClass', TextBlockDefinition), 1.51297 + M('flash.text.engine.TextElement', 'TextElementClass', TextElementDefinition), 1.51298 + M('flash.text.engine.TextJustifier', 'TextJustifierClass', TextJustifierDefinition), 1.51299 + M('flash.text.engine.TextLine', 'TextLineClass', TextLineDefinition), 1.51300 + M('flash.media.Sound', 'SoundClass', SoundDefinition), 1.51301 + M('flash.media.SoundChannel', 'SoundChannelClass', SoundChannelDefinition), 1.51302 + M('flash.media.SoundMixer', 'SoundMixerClass', SoundMixerDefinition), 1.51303 + M('flash.media.SoundTransform', 'SoundTransformClass', SoundTransformDefinition), 1.51304 + M('flash.media.Video', 'VideoClass', VideoDefinition), 1.51305 + M('flash.media.ID3Info', 'ID3InfoClass', ID3InfoDefinition), 1.51306 + M('flash.media.Microphone', 'MicrophoneClass', MicrophoneDefinition), 1.51307 + M('flash.net.FileFilter', 'FileFilterClass', FileFilterDefinition), 1.51308 + M('flash.net.NetConnection', 'NetConnectionClass', NetConnectionDefinition), 1.51309 + M('flash.net.NetStream', 'NetStreamClass', NetStreamDefinition), 1.51310 + M('flash.net.Responder', 'ResponderClass', ResponderDefinition), 1.51311 + M('flash.net.URLRequest', 'URLRequestClass', URLRequestDefinition), 1.51312 + M('flash.net.URLStream', 'URLStreamClass', URLStreamDefinition), 1.51313 + M('flash.net.URLLoader', 'URLLoaderClass', URLLoaderDefinition), 1.51314 + M('flash.net.SharedObject', 'SharedObjectClass', SharedObjectDefinition), 1.51315 + M('flash.net.ObjectEncoding', 'ObjectEncodingClass', ObjectEncodingDefinition), 1.51316 + M('flash.net.LocalConnection', 'LocalConnectionClass', LocalConnectionDefinition), 1.51317 + M('flash.net.Socket', 'SocketClass', SocketDefinition), 1.51318 + M('flash.net.URLVariables'), 1.51319 + M('packageInternal flash.system.FSCommand', 'FSCommandClass', FSCommandDefinition), 1.51320 + M('flash.system.Capabilities', 'CapabilitiesClass', CapabilitiesDefinition), 1.51321 + M('flash.system.System', 'SystemClass', SystemDefinition), 1.51322 + M('flash.system.Security', 'SecurityClass', SecurityDefinition), 1.51323 + M('flash.system.SecurityDomain', 'SecurityDomainClass', SecurityDomainDefinition), 1.51324 + M('flash.system.ApplicationDomain', 'ApplicationDomainClass', ApplicationDomainDefinition), 1.51325 + M('flash.accessibility.Accessibility', 'AccessibilityClass', AccessibilityDefinition), 1.51326 + M('flash.utils.Timer', 'TimerClass', TimerDefinition), 1.51327 + M('avm1lib.AS2Utils', 'AS2Utils', AS2UtilsDefinition), 1.51328 + M('avm1lib.AS2Broadcaster'), 1.51329 + M('avm1lib.AS2Key'), 1.51330 + M('avm1lib.AS2Mouse'), 1.51331 + M('avm1lib.AS2MovieClip', 'AS2MovieClip', AS2MovieClipDefinition), 1.51332 + M('avm1lib.AS2Button', 'AS2Button', AS2ButtonDefinition), 1.51333 + M('avm1lib.AS2TextField', 'AS2TextField', AS2TextFieldDefinition), 1.51334 + M('avm1lib.AS2Stage'), 1.51335 + M('avm1lib.AS2System'), 1.51336 + M('avm1lib.AS2Color'), 1.51337 + M('avm1lib.AS2Globals', 'AS2Globals', AS2GlobalsDefinition), 1.51338 + M('avm1lib.AS2MovieClipLoader', 'AS2MovieClipLoader', AS2MovieClipLoaderDefinition) 1.51339 + ].forEach(function (m) { 1.51340 + var className = Multiname.fromSimpleName(m.classSimpleName); 1.51341 + var path = className.getOriginalName().split('.'); 1.51342 + var container = this; 1.51343 + for (var i = 0, j = path.length - 1; i < j; i++) { 1.51344 + if (!container[path[i]]) { 1.51345 + container[path[i]] = {}; 1.51346 + } 1.51347 + container = container[path[i]]; 1.51348 + } 1.51349 + makeStub(container, m.classSimpleName, path[path.length - 1]); 1.51350 + if (m.nativeName) { 1.51351 + bindNativeClassDefinition(m.nativeName, m.definition); 1.51352 + } 1.51353 + definitions[className.getOriginalName()] = m.definition; 1.51354 + }); 1.51355 + }(); 1.51356 +natives['FlashUtilScript::getAliasName'] = function (domain, scope, instanceConstructor, baseClass) { 1.51357 + return function getAliasName(value) { 1.51358 + return value.debugName; 1.51359 + }; 1.51360 +}; 1.51361 +natives['FlashUtilScript::getDefinitionByName'] = natives.getDefinitionByName; 1.51362 +natives['FlashUtilScript::getTimer'] = function GetTimerMethod(domain, scope, instanceConstructor, baseClass) { 1.51363 + var start = Date.now(); 1.51364 + return function getTimer() { 1.51365 + return Date.now() - start; 1.51366 + }; 1.51367 +}; 1.51368 +natives['FlashUtilScript::escapeMultiByte'] = function EscapeMultiByteMethod(domain, scope, instanceConstructor, baseClass) { 1.51369 + return escape; 1.51370 +}; 1.51371 +natives['FlashUtilScript::unescapeMultiByte'] = function UnescapeMultiByteMethod(domain, scope, instanceConstructor, baseClass) { 1.51372 + return unescape; 1.51373 +}; 1.51374 +natives['FlashNetScript::navigateToURL'] = function GetNavigateToURLMethod(domain, scope, instanceConstructor, baseClass) { 1.51375 + return function navigateToURL(request, window_) { 1.51376 + if (request === null || request === undefined) { 1.51377 + throwError('TypeError', Errors.NullPointerError, 'request'); 1.51378 + } 1.51379 + var RequestClass = avm2.systemDomain.getClass('flash.net.URLRequest'); 1.51380 + if (!RequestClass.isInstanceOf(request)) { 1.51381 + throwError('TypeError', Errors.CheckTypeFailedError, request, 'flash.net.URLRequest'); 1.51382 + } 1.51383 + var url = request.url; 1.51384 + if (/^fscommand:/i.test(url)) { 1.51385 + var fscommand = avm2.applicationDomain.getProperty(Multiname.fromSimpleName('flash.system.fscommand'), true, true); 1.51386 + fscommand.call(null, url.substring('fscommand:'.length), window_); 1.51387 + return; 1.51388 + } 1.51389 + var targetWindow = window_ || '_parent'; 1.51390 + window.open(FileLoadingService.resolveUrl(url), targetWindow); 1.51391 + }; 1.51392 +}; 1.51393 +natives['FlashNetScript::sendToURL'] = function GetSendToURLMethod(domain, scope, instanceConstructor, baseClass) { 1.51394 + return function sendToURL(request) { 1.51395 + if (request === null || request === undefined) { 1.51396 + throwError('TypeError', Errors.NullPointerError, 'request'); 1.51397 + } 1.51398 + var RequestClass = avm2.systemDomain.getClass('flash.net.URLRequest'); 1.51399 + if (!RequestClass.isInstanceOf(request)) { 1.51400 + throwError('TypeError', Errors.CheckTypeFailedError, request, 'flash.net.URLRequest'); 1.51401 + } 1.51402 + var session = FileLoadingService.createSession(); 1.51403 + session.onprogress = function () { 1.51404 + }; 1.51405 + session.open(request); 1.51406 + }; 1.51407 +}; 1.51408 +natives['Toplevel::registerClassAlias'] = function GetRegisterClassAliasMethod(domain, scope, instance, baseClass) { 1.51409 + return function registerClassAlias(aliasName, classObject) { 1.51410 + if (!aliasName) { 1.51411 + throwError('TypeError', Errors.NullPointerError, 'aliasName'); 1.51412 + } 1.51413 + if (!classObject) { 1.51414 + throwError('TypeError', Errors.NullPointerError, 'classObject'); 1.51415 + } 1.51416 + AMFUtils.aliasesCache.classes.set(classObject, aliasName); 1.51417 + AMFUtils.aliasesCache.names[aliasName] = classObject; 1.51418 + }; 1.51419 +}; 1.51420 +natives['Toplevel::getClassByAlias'] = function GetGetClassByAliasMethod(domain, scope, instance, baseClass) { 1.51421 + return function getClassByAlias(aliasName) { 1.51422 + if (!aliasName) { 1.51423 + throwError('TypeError', Errors.NullPointerError, 'aliasName'); 1.51424 + } 1.51425 + var classObject = AMFUtils.aliasesCache.names[aliasName]; 1.51426 + if (!classObject) { 1.51427 + throwError('ReferenceError', Errors.ClassNotFoundError, aliasName); 1.51428 + } 1.51429 + return classObject; 1.51430 + }; 1.51431 +};